-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
44 lines (34 loc) · 1012 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
include bootloader/bootloader.mk
include bsp/bsp.mk
include freertos/freertos.mk
include osal/osal.mk
TOOLCHAIN = arm-none-eabi
AS = $(TOOLCHAIN)-as
GCC = $(TOOLCHAIN)-gcc
LD = $(TOOLCHAIN)-ld
OBJCOPY = $(TOOLCHAIN)-objcopy
OBJDUMP = $(TOOLCHAIN)-objdump
CPU = -mcpu=cortex-m4
FPU = -mfpu=fpv4-sp-d16 -mfloat-abi=hard
MCU = $(CPU) $(FPU) -mthumb
CFLAGS = -Wall -nostdlib -nostartfiles -ffreestanding $(MCU) $(DEBUG)
ASFLAGS = --warn --fatal-warnings $(CPU) $(DEBUG)
LDFLAGS = --specs=nosys.specs $(MCU)
BUILD_DIR = build
CONFIG_DIR = config
all: bootloader
prep:
mkdir -p $(BUILD_DIR)
debug: DEBUG = -g
debug: all
openocd -f board/stm32l4discovery.cfg
flash: build/bootloader.bin
openocd -f board/stm32l4discovery.cfg \
-c "program $< verify reset exit 0x08000000"
clean:
@find . -maxdepth 2 -name '*.o' -exec rm {} \;
@find . -maxdepth 2 -name '*.elf' -exec rm {} \;
@find . -maxdepth 2 -name '*.list' -exec rm {} \;
@find . -maxdepth 2 -name '*.bin' -exec rm {} \;
distclean:
rm -rf build