Hallo,
ich habe mir ein eigenes Makefile geschrieben:
1 | SRCDIRS = src
|
2 | SRCDIRS+= drv/src
|
3 | SRCDIRS+= dev
|
4 |
|
5 | INCLUDES = -I"dev"
|
6 | INCLUDES += -I"lib"
|
7 | INCLUDES += -I"drv/inc"
|
8 |
|
9 | CC=arm-none-eabi-gcc
|
10 |
|
11 | SRCS = $(foreach srcdir, $(SRCDIRS), $(wildcard $(srcdir)/*.c))
|
12 | OBJS = $(addprefix bin/, $(subst .c,.o,$(filter %.c,$(SRCS))))
|
13 | ASMS = $(foreach srcdir, $(SRCDIRS), $(wildcard $(srcdir)/*.s))
|
14 | ASMO = $(addprefix bin/, $(subst .s,.os,$(filter %.s,$(ASMS))))
|
15 |
|
16 | DIRS = $(addprefix bin/, $(SRCDIRS))
|
17 |
|
18 | VERSION = `cat src/main.c`
|
19 |
|
20 | CFLAGS = -std=gnu99 -march=armv6-m -mcpu=cortex-m0plus -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections
|
21 | CFLAGS += -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -Wall -Wextra -Wpedantic -Wno-overflow
|
22 | CFLAGS += -DSTM32L051xx -DARM_MATH_CM0PLUS -DDEBUG -DPREMIUM
|
23 |
|
24 | ASFLAGS = -x assembler-with-cpp
|
25 |
|
26 | LDFLAGS = -T dev/STM32L051C8_FLASH.ld -nostartfiles -nodefaultlibs -nostdlib -Xlinker --gc-sections
|
27 | LIBS = -lc -lm -lnosys -Wl,-Map -Wl,bin/program.map
|
28 |
|
29 | .PHONY: all
|
30 |
|
31 | all: directories program
|
32 |
|
33 | directories:
|
34 | @mkdir -p ${DIRS}
|
35 |
|
36 | program : $(OBJS) $(ASMO)
|
37 | @echo linking...
|
38 | @$(CCDIR)$(CC) $(CFLAGS) -o bin/$@.elf $(LDFLAGS) $^ $(LIBS)
|
39 | @$(CCDIR)arm-none-eabi-size --format=berkeley bin/$@.elf
|
40 | @$(CCDIR)arm-none-eabi-objcopy -O ihex bin/$@.elf bin/$@.hex
|
41 | @$(CCDIR)arm-none-eabi-objcopy -O binary bin/$@.elf bin/$@.bin
|
42 | echo $(VERSION)
|
43 |
|
44 | bin/%.o : %.c
|
45 | @echo compiling $<...
|
46 | @$(CCDIR)$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
47 |
|
48 | bin/%.os : %.s
|
49 | @echo compiling $<...
|
50 | @$(CCDIR)$(CC) $(ASFLAGS) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
51 |
|
52 |
|
53 | .PHONY: clean
|
54 | clean:
|
55 | rm -f $(ASMO) $(OBJS)
|
Ich arbeite mit Eclipse Neon (GCC 5.3). Das Makefile an sich ist kein
Problem. Jedoch bleibt die Ausgabe hängen, wenn ich in den
Projekteigenschaften den Build mit 4 Jobs auswähle:
1 | make -j4 all
|
2 | compiling src/commands.c...
|
3 | compiling src/config.c...
|
4 | compiling src/crc.c...
|
5 | compiling src/debug.c...
|
Danach geht es nicht weiter. Wenn ich das make manuell per Kommandozeile
starte läuft alles wunderbar schnell durch. Habt ihr eine Idee, woran es
liegen kann?