summaryrefslogtreecommitdiff
path: root/minimal/Makefile
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-01-07 17:43:07 +0000
committerDamien George <damien.p.george@gmail.com>2016-01-07 17:43:07 +0000
commit54729247e11eac1c86a2e0b1778b8c4406a53445 (patch)
treec692b561a6b37e64d8e44a342b9f275b8a63a335 /minimal/Makefile
parentdd0a0f79d777684aba7986d44fae1a6eff176151 (diff)
minimal: Add enough code to run minimal build on STM32F4xx hardware.
Minimal support code for a Cortex-M CPU is added, along with set-up code for an STM32F4xx MCU, including a UART for a REPL. Tested on a pyboard. Code size is 77592 bytes.
Diffstat (limited to 'minimal/Makefile')
-rw-r--r--minimal/Makefile22
1 files changed, 16 insertions, 6 deletions
diff --git a/minimal/Makefile b/minimal/Makefile
index f6e0ef14c..3206a2121 100644
--- a/minimal/Makefile
+++ b/minimal/Makefile
@@ -19,6 +19,8 @@ INC += -I../stmhal
INC += -I$(BUILD)
ifeq ($(CROSS), 1)
+DFU = ../tools/dfu.py
+PYDFU = ../tools/pydfu.py
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
else
@@ -49,20 +51,28 @@ SRC_C = \
lib/libc/string0.c \
lib/mp-readline/readline.c \
-SRC_S = \
-
-# startup_stm32f40xx.s \
-# gchelper.s \
-
-OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o))
+OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
+ifeq ($(CROSS), 1)
+all: $(BUILD)/firmware.dfu
+else
all: $(BUILD)/firmware.elf
+endif
$(BUILD)/firmware.elf: $(OBJ)
$(ECHO) "LINK $@"
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
$(Q)$(SIZE) $@
+$(BUILD)/firmware.dfu: $(BUILD)/firmware.elf
+ $(ECHO) "Create $@"
+ $(Q)$(OBJCOPY) -O binary -j .isr_vector -j .text -j .data $^ $(BUILD)/firmware.bin
+ $(Q)$(PYTHON) $(DFU) -b 0x08000000:$(BUILD)/firmware.bin $@
+
+deploy: $(BUILD)/firmware.dfu
+ $(ECHO) "Writing $< to the board"
+ $(Q)$(PYTHON) $(PYDFU) -u $<
+
# Run emulation build on a POSIX system with suitable terminal settings
run:
stty raw opost -echo