2023-04-30 18:46:37 +00:00
|
|
|
# The flash loader code cannot be compiled by the system gcc.
|
|
|
|
# This makefile uses arm-none-eabi-gcc for this purpose.
|
2020-04-25 07:25:27 +00:00
|
|
|
|
2021-03-23 15:06:47 +00:00
|
|
|
CROSS_COMPILE ?= arm-none-eabi-
|
2020-04-25 07:25:27 +00:00
|
|
|
|
2021-03-18 14:28:40 +00:00
|
|
|
CC = $(CROSS_COMPILE)gcc
|
|
|
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
|
|
|
|
|
|
|
XXD = xxd
|
|
|
|
XXDFLAGS = -i -c 4
|
|
|
|
|
2021-03-23 15:06:47 +00:00
|
|
|
CFLAGS_ARMV6_M = -mcpu=Cortex-M0 -Tlinker.ld -ffreestanding -nostdlib
|
|
|
|
CFLAGS_ARMV7_M = -mcpu=Cortex-M3 -Tlinker.ld -ffreestanding -nostdlib
|
2021-03-18 14:28:40 +00:00
|
|
|
|
|
|
|
all: stm32vl.h stm32f0.h stm32lx.h stm32f4.h stm32f4lv.h stm32l4.h stm32f7.h stm32f7lv.h
|
2021-03-23 15:06:47 +00:00
|
|
|
|
2020-04-25 07:25:27 +00:00
|
|
|
|
2021-03-23 15:06:47 +00:00
|
|
|
%.h: %.bin
|
|
|
|
$(XXD) $(XXDFLAGS) $< $@
|
|
|
|
|
|
|
|
%.bin: %.o
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
rm $<
|
|
|
|
|
|
|
|
# separate rule for STM32F0
|
|
|
|
stm32f0.o: stm32f0.s
|
|
|
|
$(CC) stm32f0.s $(CFLAGS_ARMV6_M) -o stm32f0.o
|
|
|
|
|
|
|
|
# separate rule for STM32F1/F3
|
|
|
|
stm32vl.o: stm32f0.s
|
|
|
|
$(CC) stm32f0.s $(CFLAGS_ARMV7_M) -o stm32vl.o
|
|
|
|
|
2023-08-27 18:01:45 +00:00
|
|
|
# separate rule for STM32Lx.
|
|
|
|
# Built for ARMv6-M target to be compatible with both Cortex M0 and Cortex M3.
|
|
|
|
stm32lx.o: stm32lx.s
|
|
|
|
$(CC) stm32lx.s $(CFLAGS_ARMV6_M) -o stm32lx.o
|
|
|
|
|
2021-03-23 15:06:47 +00:00
|
|
|
# generic rule for all other ARMv7-M
|
2021-03-27 14:17:13 +00:00
|
|
|
%.o: %.s
|
2021-03-23 15:06:47 +00:00
|
|
|
$(CC) $< $(CFLAGS_ARMV7_M) -o $@
|
2021-03-18 14:28:40 +00:00
|
|
|
|
|
|
|
clean:
|
2021-03-23 15:06:47 +00:00
|
|
|
rm -f *.h
|