stlink/flashloaders/Makefile

44 wiersze
1.0 KiB
Makefile

# The flash loader code cannot be compiled by the system gcc.
# This makefile uses arm-none-eabi-gcc for this purpose.
CROSS_COMPILE ?= arm-none-eabi-
CC = $(CROSS_COMPILE)gcc
OBJCOPY = $(CROSS_COMPILE)objcopy
XXD = xxd
XXDFLAGS = -i -c 4
CFLAGS_ARMV6_M = -mcpu=Cortex-M0 -Tlinker.ld -ffreestanding -nostdlib
CFLAGS_ARMV7_M = -mcpu=Cortex-M3 -Tlinker.ld -ffreestanding -nostdlib
all: stm32vl.h stm32f0.h stm32lx.h stm32f4.h stm32f4lv.h stm32l4.h stm32f7.h stm32f7lv.h
%.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
# 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
# generic rule for all other ARMv7-M
%.o: %.s
$(CC) $< $(CFLAGS_ARMV7_M) -o $@
clean:
rm -f *.h