contrib: add GPL license tag on files that miss it
[fw/openocd] / contrib / loaders / flash / stm32 / Makefile
1 # SPDX-License-Identifier: GPL-2.0-or-later
2
3 BIN2C = ../../../../src/helper/bin2char.sh
4
5 CROSS_COMPILE ?= arm-none-eabi-
6
7 CC=$(CROSS_COMPILE)gcc
8 OBJCOPY=$(CROSS_COMPILE)objcopy
9 OBJDUMP=$(CROSS_COMPILE)objdump
10
11
12 AFLAGS = -static -nostartfiles -mlittle-endian -Wa,-EL
13 CFLAGS = -c -mthumb -nostdlib -nostartfiles -Os -g -fPIC
14
15 all: stm32f1x.inc stm32f2x.inc stm32h7x.inc stm32l4x.inc stm32lx.inc
16
17 .PHONY: clean
18
19 %.elf: %.S
20         $(CC) $(AFLAGS) $< -o $@
21
22 stm32l4x.elf: stm32l4x.c
23         $(CC) $(CFLAGS) -mcpu=cortex-m0plus -fstack-usage -Wa,-adhln=$(<:.c=.lst) $< -o $@
24
25 %.lst: %.elf
26         $(OBJDUMP) -S $< > $@
27
28 %.bin: %.elf
29         $(OBJCOPY) -Obinary $< $@
30
31 %.inc: %.bin
32         $(BIN2C) < $< > $@
33
34 clean:
35         -rm -f *.elf *.lst *.bin *.inc