-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
34 lines (22 loc) · 916 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
PEBBLE_TOOLCHAIN_PATH ?= /usr/local/Cellar/pebble-toolchain/2.0/arm-cs-tools/bin
ifneq "$(WAIT_GDB)" ""
QEMUFLAGS += -S
endif
PFX ?= $(PEBBLE_TOOLCHAIN_PATH)/arm-none-eabi-
CC = $(PFX)gcc
ASFLAGS += -ggdb
CFLAGS += -g
CFLAGS += -mcpu=cortex-m3 -mthumb -Icmsis -Istm32f2/inc -DUSE_STDPERIPH_DRIVER -std=c99
OBJS = boot.o stm32f2/stm32f2xx_gpio.o stm32f2/stm32f2xx_rcc.o stm32f2/stm32f2xx_spi.o main.o
target: fw.qemu_flash.bin
qemu: fw.qemu_flash.bin
qemu-pebble -rtc base=localtime -serial null -serial null -serial stdio -gdb tcp::63770,server -machine pebble-bb2 -cpu cortex-m3 -pflash fw.qemu_flash.bin $(QEMUFLAGS)
gdb:
$(PFX)gdb -ex 'target remote localhost:63770' -ex 'sym fw.elf'
fw.elf: $(OBJS) fw.lds
$(PFX)ld -o $@ -T fw.lds $(OBJS)
%.bin: %.elf
$(PFX)objcopy $< -O binary $@
%.qemu_flash.bin: %.bin tintin_boot.bin
cat tintin_boot.bin $< > $@
.PRECIOUS: fw.elf fw.bin fw.qemu_flash.bin