forked from kbrtny/Bootloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.f1
54 lines (42 loc) · 1.28 KB
/
Makefile.f1
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
45
46
47
48
49
50
51
52
53
54
#
# PX4 bootloader build rules for STM32F1 targets.
#
PRODUCT = px4$(TARGET)_bl
OPENOCD ?= ../../sat/bin/openocd
JTAGCONFIG ?= interface/olimex-jtag-tiny.cfg
#JTAGCONFIG ?= interface/jtagkey-tiny.cfg
# 3 seconds / 3000 ms default delay
PX4_BOOTLOADER_DELAY ?= 3000
SRCS = $(COMMON_SRCS) main_f1.c
ifeq ($(INTERFACE),USB)
SRCS += cdcacm.c
endif
ifeq ($(INTERFACE),USART)
SRCS += usart.c
endif
ifeq ($(INTERFACE),I2C)
SRCS += i2c.c
endif
FLAGS += -mthumb -mcpu=cortex-m3\
-DSTM32F1 \
-DAPP_LOAD_ADDRESS=$(F1_APP_LOAD_ADDRESS) \
-DAPP_SIZE_MAX=$(F1_APP_SIZE_MAX) \
-DBOOTLOADER_DELAY=$(PX4_BOOTLOADER_DELAY) \
-DBOARD_$(BOARD) \
-DINTERFACE_$(INTERFACE) \
-DUSBDEVICESTRING="$(USBDEVICESTRING)" \
-DUSBPRODUCTID="$(USBPRODUCTID)" \
-T$(LINKER_FILE) \
-L$(LIBOPENCM3)/lib/stm32/f1/ \
-lopencm3_stm32f1 \
ELF = $(PRODUCT).elf
BINARY = $(PRODUCT).bin
all: $(ELF) $(BINARY)
$(ELF): $(SRCS) $(MAKEFILE_LIST)
$(CC) -o $@ $(SRCS) $(FLAGS)
$(BINARY): $(ELF)
$(OBJCOPY) -O binary $(ELF) $(BINARY)
#upload: all flash flash-bootloader
upload: all flash-bootloader
flash-bootloader:
$(OPENOCD) --search ../px4_bootloader -f $(JTAGCONFIG) -f stm32f1.cfg -c init -c "reset halt" -c "flash write_image erase $(BINARY)" -c "reset run" -c shutdown