Исходными файлами являются:
startup_ARMCM3.asm
system_stm32f10x.c
main.c
Набросал следующий Makefile
Код
all: hellow.bin
hellow.bin: hellow.elf
hellow.elf: startup_ARMCM3.o main.o system_stm32f10x.o
startup_ARMCM3.o: startup_ARMCM3.asm
main.o: main.c
system_stm32f10x.o: system_stm32f10x.c
CC = arm-none-eabi-gcc
AS = arm-none-eabi-as
LD = arm-none-eabi-ld
OC = arm-none-eabi-objcopy
CCFLAGS = -mcpu=cortex-m3 -mthumb -Wall -c
ASFLAGS = -mcpu=cortex-m3 -mthumb -mapcs-32 -gstabs
LDFLAGS = -v -T gcc_arm.ld
OCFLAGS = -O binary
%.o: %.c
$(CC) $(CCFLAGS) $< -o $@
%.o: %.asm
$(AS) $(ASFLAGS) $< -o $@
%.elf: %.o
$(LD) $(LDFLAGS) $< -o $@
%.bin: %.elf
$(OC) $(OCFLAGS) $< $@
.PHONY: all clean
.DEFAULT:
.SUFFIXES:
hellow.bin: hellow.elf
hellow.elf: startup_ARMCM3.o main.o system_stm32f10x.o
startup_ARMCM3.o: startup_ARMCM3.asm
main.o: main.c
system_stm32f10x.o: system_stm32f10x.c
CC = arm-none-eabi-gcc
AS = arm-none-eabi-as
LD = arm-none-eabi-ld
OC = arm-none-eabi-objcopy
CCFLAGS = -mcpu=cortex-m3 -mthumb -Wall -c
ASFLAGS = -mcpu=cortex-m3 -mthumb -mapcs-32 -gstabs
LDFLAGS = -v -T gcc_arm.ld
OCFLAGS = -O binary
%.o: %.c
$(CC) $(CCFLAGS) $< -o $@
%.o: %.asm
$(AS) $(ASFLAGS) $< -o $@
%.elf: %.o
$(LD) $(LDFLAGS) $< -o $@
%.bin: %.elf
$(OC) $(OCFLAGS) $< $@
.PHONY: all clean
.DEFAULT:
.SUFFIXES:
В результате получаю следующее:
Код
arm-none-eabi-as -mcpu=cortex-m3 -mthumb -mapcs-32 -gstabs startup_ARMCM3.asm -o startup_ARMCM3.o
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -c main.c -o main.o
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -c system_stm32f10x.c -o system_stm32f10x.o
arm-none-eabi-objcopy -O binary hellow.elf hellow.bin
arm-none-eabi-objcopy: 'hellow.elf': No such file
make: *** [hellow.bin] Error 1
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -c main.c -o main.o
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -c system_stm32f10x.c -o system_stm32f10x.o
arm-none-eabi-objcopy -O binary hellow.elf hellow.bin
arm-none-eabi-objcopy: 'hellow.elf': No such file
make: *** [hellow.bin] Error 1
При сборке вручную всё в порядке:
Код
I:\CORTEX_M3\WORK_SPACE\hellow_world_2>arm-none-eabi-as -mcpu=cortex-m3 -mthumb -mapcs-32 -gstabs startup_ARMCM3.asm -o startup_ARMCM3.o
I:\CORTEX_M3\WORK_SPACE\hellow_world_2>arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -c main.c -o main.o
I:\CORTEX_M3\WORK_SPACE\hellow_world_2>arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -c system_stm32f10x.c -o system_stm32f10x.o
I:\CORTEX_M3\WORK_SPACE\hellow_world_2>arm-none-eabi-ld -v -T gcc_arm.ld startup_ARMCM3.o main.o system_stm32f10x.o -o hellow.elf
GNU ld (GNU Binutils) 2.21
I:\CORTEX_M3\WORK_SPACE\hellow_world_2>arm-none-eabi-objcopy -O binary hellow.elf hellow.bin
I:\CORTEX_M3\WORK_SPACE\hellow_world_2>arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -c main.c -o main.o
I:\CORTEX_M3\WORK_SPACE\hellow_world_2>arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -c system_stm32f10x.c -o system_stm32f10x.o
I:\CORTEX_M3\WORK_SPACE\hellow_world_2>arm-none-eabi-ld -v -T gcc_arm.ld startup_ARMCM3.o main.o system_stm32f10x.o -o hellow.elf
GNU ld (GNU Binutils) 2.21
I:\CORTEX_M3\WORK_SPACE\hellow_world_2>arm-none-eabi-objcopy -O binary hellow.elf hellow.bin
GCC toolchain - YAGARTO
Подскажите, пожалуйста, где собака зарыта?