mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-03 11:20:59 +00:00
build: reorg makefiles
This commit is contained in:
parent
2c1e0b8253
commit
1c4fbd02b4
34
Makefile
34
Makefile
@ -20,7 +20,19 @@ vendor: ## update git submodules
|
|||||||
res: ## update resources
|
res: ## update resources
|
||||||
./tools/res_collect
|
./tools/res_collect
|
||||||
|
|
||||||
build: build_firmware build_unix build_cross ## build firmware, unix and mpy-cross micropython ports
|
run: ## run unix port
|
||||||
|
cd src ; ../vendor/micropython/unix/micropython
|
||||||
|
|
||||||
|
emu: ## run emulator
|
||||||
|
./emu.sh
|
||||||
|
|
||||||
|
test: ## run unit tests
|
||||||
|
cd tests ; ./run_tests.sh
|
||||||
|
|
||||||
|
testpy: ## run selected unit tests from python-trezor
|
||||||
|
cd tests ; ./run_tests_python_trezor.sh
|
||||||
|
|
||||||
|
build: build_firmware build_bootloader build_loader build_unix build_cross ## build all
|
||||||
|
|
||||||
build_firmware: vendor res build_cross ## build firmware with frozen modules
|
build_firmware: vendor res build_cross ## build firmware with frozen modules
|
||||||
$(MAKE) -f Makefile.firmware $(TREZORHAL_PORT_OPTS)
|
$(MAKE) -f Makefile.firmware $(TREZORHAL_PORT_OPTS)
|
||||||
@ -43,17 +55,17 @@ build_unix_debug: vendor ## build unix port with debug symbols
|
|||||||
build_cross: vendor ## build mpy-cross port
|
build_cross: vendor ## build mpy-cross port
|
||||||
$(MAKE) -C vendor/micropython/mpy-cross $(CROSS_PORT_OPTS)
|
$(MAKE) -C vendor/micropython/mpy-cross $(CROSS_PORT_OPTS)
|
||||||
|
|
||||||
run: ## run unix port
|
clean: clean_firmware clean_bootloader clean_loader clean_unix clean_cross ## clean all
|
||||||
cd src ; ../vendor/micropython/unix/micropython
|
|
||||||
|
|
||||||
emu: ## run emulator
|
|
||||||
./emu.sh
|
|
||||||
|
|
||||||
clean: clean_firmware clean_unix clean_cross ## clean all builds
|
|
||||||
|
|
||||||
clean_firmware: ## clean firmware build
|
clean_firmware: ## clean firmware build
|
||||||
$(MAKE) -f Makefile.firmware clean $(TREZORHAL_PORT_OPTS)
|
$(MAKE) -f Makefile.firmware clean $(TREZORHAL_PORT_OPTS)
|
||||||
|
|
||||||
|
clean_bootloader: ## clean bootloader build
|
||||||
|
$(MAKE) -f Makefile.bootloader clean $(TREZORHAL_PORT_OPTS)
|
||||||
|
|
||||||
|
clean_loader: ## clean loader build
|
||||||
|
$(MAKE) -f Makefile.loader clean $(TREZORHAL_PORT_OPTS)
|
||||||
|
|
||||||
clean_unix: ## clean unix build
|
clean_unix: ## clean unix build
|
||||||
$(MAKE) -f ../../../micropython/unix/Makefile -C vendor/micropython/unix clean $(UNIX_PORT_OPTS)
|
$(MAKE) -f ../../../micropython/unix/Makefile -C vendor/micropython/unix clean $(UNIX_PORT_OPTS)
|
||||||
# workaround for relative paths containing ../.. in unix Makefile
|
# workaround for relative paths containing ../.. in unix Makefile
|
||||||
@ -85,9 +97,3 @@ openocd: ## start openocd which connects to the device
|
|||||||
|
|
||||||
gdb: ## start remote gdb session which connects to the openocd
|
gdb: ## start remote gdb session which connects to the openocd
|
||||||
arm-none-eabi-gdb $(FIRMWARE_BUILD_DIR)/firmware.elf -ex 'target remote localhost:3333'
|
arm-none-eabi-gdb $(FIRMWARE_BUILD_DIR)/firmware.elf -ex 'target remote localhost:3333'
|
||||||
|
|
||||||
test: ## run unit tests
|
|
||||||
cd tests ; ./run_tests.sh
|
|
||||||
|
|
||||||
testpy: ## run selected unit tests from python-trezor
|
|
||||||
cd tests ; ./run_tests_python_trezor.sh
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# target directory
|
# target directory
|
||||||
BUILD ?= micropython/bootloader/build
|
BUILD ?= micropython/bootloader/build
|
||||||
|
TARGET ?= bootloader
|
||||||
|
|
||||||
# include py core make definitions
|
# include py core make definitions
|
||||||
include vendor/micropython/py/mkenv.mk
|
include vendor/micropython/py/mkenv.mk
|
||||||
@ -136,15 +137,15 @@ LDFLAGS += --gc-sections
|
|||||||
# comp rules
|
# comp rules
|
||||||
# =====================================
|
# =====================================
|
||||||
|
|
||||||
all: $(BUILD)/bootloader.bin
|
all: $(BUILD)/$(TARGET).bin
|
||||||
|
|
||||||
$(BUILD)/bootloader.elf: $(OBJ)
|
$(BUILD)/$(TARGET).elf: $(OBJ)
|
||||||
$(ECHO) "LINK $@"
|
$(ECHO) "LINK $@"
|
||||||
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
$(Q)$(SIZE) $@
|
$(Q)$(SIZE) $@
|
||||||
|
|
||||||
$(BUILD)/bootloader.bin: $(BUILD)/bootloader.elf
|
$(BUILD)/$(TARGET).bin: $(BUILD)/$(TARGET).elf
|
||||||
$(Q)$(OBJCOPY) -O binary -j .flash -j .data $^ $(BUILD)/bootloader.bin
|
$(Q)$(OBJCOPY) -O binary -j .flash -j .data $^ $(BUILD)/$(TARGET).bin
|
||||||
|
|
||||||
$(BUILD)/%.o: %.S
|
$(BUILD)/%.o: %.S
|
||||||
$(ECHO) "CC $<"
|
$(ECHO) "CC $<"
|
||||||
@ -160,13 +161,12 @@ $(BUILD)/%.o: %.c
|
|||||||
|
|
||||||
OBJ_DIRS = $(sort $(dir $(OBJ)))
|
OBJ_DIRS = $(sort $(dir $(OBJ)))
|
||||||
$(OBJ): | $(OBJ_DIRS)
|
$(OBJ): | $(OBJ_DIRS)
|
||||||
$(OBJ_DIRS):
|
$(OBJ_DIRS) $(BUILD_HDR):
|
||||||
$(MKDIR) -p $@
|
$(MKDIR) -p $@
|
||||||
|
|
||||||
$(OBJ): | $(BUILD_HDR)/qstrdefs.generated.h
|
$(OBJ): | $(BUILD_HDR)/qstrdefs.generated.h
|
||||||
|
|
||||||
$(BUILD_HDR)/qstrdefs.generated.h:
|
$(BUILD_HDR)/qstrdefs.generated.h: | $(BUILD_HDR)
|
||||||
$(MKDIR) -p $(BUILD_HDR)
|
|
||||||
touch $(BUILD_HDR)/qstrdefs.generated.h
|
touch $(BUILD_HDR)/qstrdefs.generated.h
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -3,6 +3,7 @@ FROZEN_MPY_DIR ?= src
|
|||||||
|
|
||||||
# target directory
|
# target directory
|
||||||
BUILD ?= micropython/firmware/build
|
BUILD ?= micropython/firmware/build
|
||||||
|
TARGET ?= firmware
|
||||||
|
|
||||||
# include py core make definitions
|
# include py core make definitions
|
||||||
include vendor/micropython/py/mkenv.mk
|
include vendor/micropython/py/mkenv.mk
|
||||||
@ -394,15 +395,15 @@ QSTR_GEN_EXTRA_CFLAGS += -DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB -DN_ARM -DN_XTENSA
|
|||||||
# comp rules
|
# comp rules
|
||||||
# =====================================
|
# =====================================
|
||||||
|
|
||||||
all: $(BUILD)/firmware.bin
|
all: $(BUILD)/$(TARGET).bin
|
||||||
|
|
||||||
$(BUILD)/firmware.elf: $(OBJ)
|
$(BUILD)/$(TARGET).elf: $(OBJ)
|
||||||
$(ECHO) "LINK $@"
|
$(ECHO) "LINK $@"
|
||||||
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
$(Q)$(SIZE) $@
|
$(Q)$(SIZE) $@
|
||||||
|
|
||||||
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
|
$(BUILD)/$(TARGET).bin: $(BUILD)/$(TARGET).elf
|
||||||
$(Q)$(OBJCOPY) -O binary -j .flash -j .data $^ $(BUILD)/firmware.bin
|
$(Q)$(OBJCOPY) -O binary -j .flash -j .data $^ $(BUILD)/$(TARGET).bin
|
||||||
|
|
||||||
$(BUILD)/%.o: %.S
|
$(BUILD)/%.o: %.S
|
||||||
$(ECHO) "CC $<"
|
$(ECHO) "CC $<"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# target directory
|
# target directory
|
||||||
BUILD ?= micropython/loader/build
|
BUILD ?= micropython/loader/build
|
||||||
|
TARGET ?= loader
|
||||||
|
|
||||||
# include py core make definitions
|
# include py core make definitions
|
||||||
include vendor/micropython/py/mkenv.mk
|
include vendor/micropython/py/mkenv.mk
|
||||||
@ -134,15 +135,15 @@ LDFLAGS += --gc-sections
|
|||||||
# comp rules
|
# comp rules
|
||||||
# =====================================
|
# =====================================
|
||||||
|
|
||||||
all: $(BUILD)/loader.bin
|
all: $(BUILD)/$(TARGET).bin
|
||||||
|
|
||||||
$(BUILD)/loader.elf: $(OBJ)
|
$(BUILD)/$(TARGET).elf: $(OBJ)
|
||||||
$(ECHO) "LINK $@"
|
$(ECHO) "LINK $@"
|
||||||
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
$(Q)$(SIZE) $@
|
$(Q)$(SIZE) $@
|
||||||
|
|
||||||
$(BUILD)/loader.bin: $(BUILD)/loader.elf
|
$(BUILD)/$(TARGET).bin: $(BUILD)/$(TARGET).elf
|
||||||
$(Q)$(OBJCOPY) -O binary -j .flash -j .data $^ $(BUILD)/loader.bin
|
$(Q)$(OBJCOPY) -O binary -j .flash -j .data $^ $(BUILD)/$(TARGET).bin
|
||||||
|
|
||||||
$(BUILD)/%.o: %.S
|
$(BUILD)/%.o: %.S
|
||||||
$(ECHO) "CC $<"
|
$(ECHO) "CC $<"
|
||||||
@ -158,13 +159,12 @@ $(BUILD)/%.o: %.c
|
|||||||
|
|
||||||
OBJ_DIRS = $(sort $(dir $(OBJ)))
|
OBJ_DIRS = $(sort $(dir $(OBJ)))
|
||||||
$(OBJ): | $(OBJ_DIRS)
|
$(OBJ): | $(OBJ_DIRS)
|
||||||
$(OBJ_DIRS):
|
$(OBJ_DIRS) $(BUILD_HDR):
|
||||||
$(MKDIR) -p $@
|
$(MKDIR) -p $@
|
||||||
|
|
||||||
$(OBJ): | $(BUILD_HDR)/qstrdefs.generated.h
|
$(OBJ): | $(BUILD_HDR)/qstrdefs.generated.h
|
||||||
|
|
||||||
$(BUILD_HDR)/qstrdefs.generated.h:
|
$(BUILD_HDR)/qstrdefs.generated.h: | $(BUILD_HDR)
|
||||||
$(MKDIR) -p $(BUILD_HDR)
|
|
||||||
touch $(BUILD_HDR)/qstrdefs.generated.h
|
touch $(BUILD_HDR)/qstrdefs.generated.h
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
Loading…
Reference in New Issue
Block a user