Problème avec GNU make qui ne reconnait pas mes "target"
Bonjour,
Je suis en train de développer sur plateforme embarquée et j'ai repris la bibliothèque Procyon ARMLIB.
Le makefile fournit avec les exemples fonctionne bien (modulo des problèmes de script pour le linker mais ce n'est pas le problème pour le moment).
Mon souci est que j'ai besoin d'apporter quelques modifications à au code car je ne peux pas utiliser directement ARMLIB. Or le makefile modifié (et presque identique à l'original) ne fonctionne pas.
Voici ce que j'obtiens :
Code:
1 2 3 4 5 6 7
|
user@clevo:~/Projects/eclipse/workspace/test-serial/apps$ make
make -C usart_example
make[1]: Entering directory `/home/user/Projects/eclipse/workspace/test-serial/apps/usart_example'
make[1]: *** No rule to make target `main.bin', needed by `all'. Stop.
make[1]: Leaving directory `/home/user/Projects/eclipse/workspace/test-serial/apps/usart_example'
make: *** [usart_example] Error 2 |
Le makefile appelé est le suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
###### Define directories to build ######
SUBDIRS = usart_example \
#SUBDIRS = $(dir ./*)
###### Define build rules ######
.PHONY: apps $(SUBDIRS)
apps: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY : all
all : apps
.PHONY : clean
clean : apps
rm -vf $(addsuffix /GCCProject.ncb, $(SUBDIRS))
rm -vf $(addsuffix /GCCProject.opt, $(SUBDIRS))
rm -vf $(addsuffix /GCCProject.plg, $(SUBDIRS))
rm -vf ../*.lst
rm -vf ../arch/at91/*.lst |
Le makefile qui se trouve dans le répertoire "usart_example" est le suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
# Makefile for ARM
# Pascal Stang
########### change this lines according to your project ##################
#put the name of the target mcu architecture here (arm7tdmi, etc)
CPU = arm7tdmi
#put the name of the target file here (without extension)
TRG = main
#put your C sourcefiles here
ARMLIB = ../..
ARCH = at91
ARMLIB_ARCH_SRC = board_lowlevel.c board_memories.c board_powermode.c
ARMLIB_SRC =
SRC = $(TRG).c
#put additional assembler source file here
ASRC = $(ARMLIB)/arch/$(ARCH)/board_cstartup.S
#additional libraries and object files to link
LIB =
#additional includes to compile
INC =
#assembler flags
ASFLAGS = -Wa, -gstabs
#compiler flags
CPFLAGS = -g -O1 -Wall -Wstrict-prototypes -I$(ARMLIB) -I$(ARMLIB)/arch/$(ARCH) -I$(ARMLIB)/arch/$(ARCH)/include -I$(ARMLIB)/peripherals -I/usr/lib/gcc/arm-linux-gnueabi/4.4.5/include -Wa,-ahlms=$(<:.c=.lst)
#linker flags
LDFLAGS = -T$(ARMLIB)/arch/$(ARCH)/boot/at91sam7se512-rom.ld -lm -nostartfiles -Wl,-Map=$(TRG).map,--cref,-nostdlib
########### you should not need to change the following line #############
#include $(ARMLIB)/make/armproj_make
###### BLOCK 1) define some variables based on the toolchain to be used #######
CC = arm-linux-gnueabi-gcc
AS = arm-linux-gnueabi-gcc -x assembler-with-cpp
LD = arm-linux-gnueabi-gcc
RM = rm -f
RN = mv
CP = cp
BIN = arm-linux-gnueabi-objcopy
SIZE = arm-linux-gnueabi-size
INCDIR = .
SHELL = /bin/sh
###### BLOCK 2) output format can be srec, ihex (bin is always created) #######
FORMAT = ihex
###### BLOCK 3) define all project specific object files ######
ARMLIB_ARCH = $(ARMLIB)/arch/$(arch)
SRC += $(addprefix $(ARMLIB)/,$(ARMLIB_SRC))
SRC += $(addprefix $(ARMLIB)/arch/$(ARCH)/,$(ARMLIB_ARCH_SRC))
OBJ = $(ASRC:.s=.o) $(SRC:.c=.o)
CPFLAGS += -mcpu=$(CPU)
ASFLAGS += -mcpu=$(CPU)
# LDFLAGS += -mcpu=$(CPU)
###### BLOCK 4) this defines the aims of the make process ######
#all: $(TRG).obj $(TRG).elf $(TRG).hex $(TRG).cof $(TRG).eep $(TRG).ok
all: $(TRG).bin $(TRG).elf $(TRG).hex $(TRG).ok
###### BLOCK 5) compile: instructions to create assembler and/or object files from C source ######
%.o : %.c
$(CC) -c $(CPFLAGS) -I$(INCDIR) $< -o $@
%.s : %.c
$(CC) -S $(CPFLAGS) -I$(INCDIR) $< -o $@
###### BLOCK 6) assemble: instructions to create object file from assembler files ######
%.o : %.s
$(AS) -c $(ASFLAGS) -I$(INCDIR) $< -o $@
###### BLOCK 7) link: instructions to create elf output file from object files ######
%.elf: $(OBJ)
$(LD) $(OBJ) $(LIB) $(LDFLAGS) -o $@
# $(CC) $(OBJ) $(LIB) $(LDFLAGS) -o $@
###### BLOCK 8) create binary file from elf output file ######
%.bin: %.elf
$(BIN) -O binary $< $@
###### BLOCK 9) create hex file from elf output file ######
%.hex: %.elf
$(BIN) -O $(FORMAT) $< $@
###### BLOCK 10) If all other steps compile ok then echo "Errors: none" ######
%ok:
$(SIZE) $(TRG).elf
@echo "Errors: none"
###### BLOCK 11) make instruction to delete created files ######
clean:
$(RM) $(OBJ)
$(RM) $(SRC:.c=.s)
$(RM) $(SRC:.c=.lst)
$(RM) $(TRG).map
$(RM) $(TRG).elf
$(RM) $(TRG).obj
$(RM) $(TRG).hex
$(RM) $(TRG).bin
$(RM) $(TRG).hex
@echo "Errors: none"
size:
$(SIZE) $(TRG).elf
###### dependecies, add any dependencies you need here ###################
$(TRG).o : $(TRG).c makefile conf/board.h |
Si quelqu'un a une idée sur ce qui pose problème...
Merci d'avance