1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

update bootloader makefile to follow upstream changes

This commit is contained in:
Pavol Rusnak 2017-01-22 19:47:21 +01:00
parent d13006ebbe
commit 892409c9b8
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 18 additions and 14 deletions

View File

@ -26,6 +26,9 @@ build_stmhal_debug: vendor ## build stmhal port with debug symbols
build_stmhal_frozen: vendor res build_cross ## build stmhal port with frozen modules (from /src) build_stmhal_frozen: vendor res build_cross ## build stmhal port with frozen modules (from /src)
$(MAKE) -C vendor/micropython/stmhal BOARD=$(BOARD) FROZEN_MPY_DIR=../../../src $(MAKE) -C vendor/micropython/stmhal BOARD=$(BOARD) FROZEN_MPY_DIR=../../../src
build_bootloader: vendor ## build bootloader
$(MAKE) -C vendor/micropython/stmhal -f Makefile.bootloader BOARD=$(BOARD)
build_unix: vendor ## build unix port build_unix: vendor ## build unix port
$(MAKE) -C vendor/micropython/unix MICROPY_FORCE_32BIT=1 $(MAKE) -C vendor/micropython/unix MICROPY_FORCE_32BIT=1
@ -38,9 +41,6 @@ build_unix_frozen: vendor res build_cross ## build unix port with frozen modules
build_cross: vendor ## build mpy-cross port build_cross: vendor ## build mpy-cross port
$(MAKE) -C vendor/micropython/mpy-cross MICROPY_FORCE_32BIT=1 $(MAKE) -C vendor/micropython/mpy-cross MICROPY_FORCE_32BIT=1
build_bootloader: vendor ## build bootloader
$(MAKE) -C vendor/micropython/stmhal -f Makefile.bootloader BOARD=$(BOARD)
run: ## run unix port run: ## run unix port
cd src ; ../vendor/micropython/unix/micropython cd src ; ../vendor/micropython/unix/micropython

View File

@ -1,6 +1,6 @@
# Select the board to build for: if not given on the command line, # Select the board to build for: if not given on the command line,
# then default to TREZORV2. # then default to PYBV10.
BOARD ?= TREZORV2 BOARD ?= PYBV10
ifeq ($(wildcard boards/$(BOARD)/.),) ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified) $(error Invalid BOARD specified)
endif endif
@ -73,7 +73,7 @@ COPT += -Os -DNDEBUG
endif endif
# uncomment this if you want libgcc # uncomment this if you want libgcc
LIBS += $(shell $(CC) -print-libgcc-file-name) LIBS += $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
SRC_LIB = $(addprefix lib/,\ SRC_LIB = $(addprefix lib/,\
libc/string0.c \ libc/string0.c \
@ -150,12 +150,15 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_USBDEV:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
OBJ += $(BUILD)/pins_$(BOARD).o OBJ += $(BUILD)/pins_$(BOARD).o
# We put ff.o and stm32f4xx_hal_sd.o into the first 16K section with the ISRs. # We put several files into the first 16K section with the ISRs.
# If we compile these using -O0 then it won't fit. So if you really want these # If we compile these using -O0 then it won't fit. So if you really want these
# to be compiled with -O0, then edit stm32f405.ld (in the .isr_vector section) # to be compiled with -O0, then edit boards/common.ld (in the .isr_vector section)
# and comment out the following 2 lines. # and comment out the following lines.
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os $(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
$(BUILD)/$(HAL_DIR)/src/stm32$(MCU_SERIES)xx_hal_sd.o: COPT += -Os $(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
$(PY_BUILD)/formatfloat.o: COPT += -Os
$(PY_BUILD)/parsenum.o: COPT += -Os
$(PY_BUILD)/mpprint.o: COPT += -Os
all: $(BUILD)/bootloader.dfu $(BUILD)/bootloader.hex all: $(BUILD)/bootloader.dfu $(BUILD)/bootloader.hex
@ -169,23 +172,24 @@ else
$(Q)$(DFU_UTIL) -a 0 -d $(DEVICE) -D $< $(Q)$(DFU_UTIL) -a 0 -d $(DEVICE) -D $<
endif endif
FLASH_ADDR ?= 0x08000000
TEXT_ADDR ?= 0x08020000 TEXT_ADDR ?= 0x08020000
deploy-stlink: $(BUILD)/bootloader.dfu deploy-stlink: $(BUILD)/bootloader.dfu
$(ECHO) "Writing $(BUILD)/bootloader0.bin to the board via ST-LINK" $(ECHO) "Writing $(BUILD)/bootloader0.bin to the board via ST-LINK"
$(Q)$(STFLASH) write $(BUILD)/bootloader0.bin 0x08000000 $(Q)$(STFLASH) write $(BUILD)/bootloader0.bin $(FLASH_ADDR)
$(ECHO) "Writing $(BUILD)/bootloader1.bin to the board via ST-LINK" $(ECHO) "Writing $(BUILD)/bootloader1.bin to the board via ST-LINK"
$(Q)$(STFLASH) --reset write $(BUILD)/bootloader1.bin 0x08020000 $(Q)$(STFLASH) --reset write $(BUILD)/bootloader1.bin $(TEXT_ADDR)
deploy-openocd: $(BUILD)/bootloader.dfu deploy-openocd: $(BUILD)/bootloader.dfu
$(ECHO) "Writing $(BUILD)/bootloader{0,1}.bin to the board via ST-LINK using OpenOCD" $(ECHO) "Writing $(BUILD)/bootloader{0,1}.bin to the board via ST-LINK using OpenOCD"
$(Q)$(OPENOCD) -f $(OPENOCD_CONFIG) -c "stm_flash $(BUILD)/bootloader0.bin $(BUILD)/bootloader1.bin" $(Q)$(OPENOCD) -f $(OPENOCD_CONFIG) -c "stm_flash $(BUILD)/bootloader0.bin $(FLASH_ADDR) $(BUILD)/bootloader1.bin $(TEXT_ADDR)"
$(BUILD)/bootloader.dfu: $(BUILD)/bootloader.elf $(BUILD)/bootloader.dfu: $(BUILD)/bootloader.elf
$(ECHO) "Create $@" $(ECHO) "Create $@"
$(Q)$(OBJCOPY) -O binary -j .isr_vector $^ $(BUILD)/bootloader0.bin $(Q)$(OBJCOPY) -O binary -j .isr_vector $^ $(BUILD)/bootloader0.bin
$(Q)$(OBJCOPY) -O binary -j .text -j .data $^ $(BUILD)/bootloader1.bin $(Q)$(OBJCOPY) -O binary -j .text -j .data $^ $(BUILD)/bootloader1.bin
$(Q)$(PYTHON) $(DFU) -b 0x08000000:$(BUILD)/bootloader0.bin -b 0x08020000:$(BUILD)/bootloader1.bin $@ $(Q)$(PYTHON) $(DFU) -b $(FLASH_ADDR):$(BUILD)/bootloader0.bin -b $(TEXT_ADDR):$(BUILD)/bootloader1.bin $@
$(BUILD)/bootloader.hex: $(BUILD)/bootloader.elf $(BUILD)/bootloader.hex: $(BUILD)/bootloader.elf
$(ECHO) "Create $@" $(ECHO) "Create $@"