1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00
trezor-firmware/Makefile

120 lines
4.3 KiB
Makefile
Raw Normal View History

2016-05-11 12:39:28 +00:00
.PHONY: vendor
2016-10-12 16:29:01 +00:00
JOBS=4
MAKE=make -j $(JOBS)
2017-04-10 17:11:44 +00:00
BOARDLOADER_BUILD_DIR=micropython/boardloader/build
2017-03-20 14:41:21 +00:00
LOADER_BUILD_DIR=micropython/loader/build
FIRMWARE_BUILD_DIR=micropython/firmware/build
2017-02-24 12:19:00 +00:00
TREZORHAL_PORT_OPTS=FROZEN_MPY_DIR=src DEBUG=1
UNIX_PORT_OPTS=MICROPY_FORCE_32BIT=1 MICROPY_PY_BTREE=0 MICROPY_PY_TERMIOS=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 MICROPY_SSL_AXTLS=0 DEBUG=1
2017-02-24 12:19:00 +00:00
CROSS_PORT_OPTS=MICROPY_FORCE_32BIT=1
2016-10-12 16:29:01 +00:00
2017-03-25 13:46:38 +00:00
## help commands:
help: ## show this help
2017-03-25 13:46:38 +00:00
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m make %-20s\033[0m %s\n", $$1, $$2} /^##(.*)/ {printf "\033[33m%s\n", substr($$0, 4)}' $(MAKEFILE_LIST)
## dependencies commands:
2016-05-11 12:39:28 +00:00
vendor: ## update git submodules
2017-03-28 13:25:40 +00:00
git submodule update --init
res: ## update resources
./tools/res_collect
2017-03-25 13:46:38 +00:00
## emulator commands:
2017-03-20 16:45:40 +00:00
run: ## run unix port
cd src ; ../vendor/micropython/unix/micropython
emu: ## run emulator
./emu.sh
2017-03-25 13:46:38 +00:00
## test commands:
2017-03-20 16:45:40 +00:00
test: ## run unit tests
cd tests ; ./run_tests.sh
testpy: ## run selected unit tests from python-trezor
cd tests ; ./run_tests_python_trezor.sh
2017-03-25 13:46:38 +00:00
## build commands:
2017-04-10 17:11:44 +00:00
build: build_boardloader build_loader build_firmware build_unix build_cross ## build all
2017-02-20 10:36:07 +00:00
2017-04-10 17:11:44 +00:00
build_boardloader: ## build boardloader
$(MAKE) -f Makefile.boardloader $(TREZORHAL_PORT_OPTS)
2017-03-18 11:02:39 +00:00
build_loader: ## build loader
2017-03-20 14:41:21 +00:00
$(MAKE) -f Makefile.loader $(TREZORHAL_PORT_OPTS)
./tools/binctl micropython/loader/build/loader.bin -s 1 4141414141414141414141414141414141414141414141414141414141414141
2017-03-20 14:41:21 +00:00
build_firmware: res build_cross ## build firmware with frozen modules
$(MAKE) -f Makefile.firmware $(TREZORHAL_PORT_OPTS)
./tools/binctl micropython/firmware/build/firmware.bin -s 1 4141414141414141414141414141414141414141414141414141414141414141
build_unix: ## build unix port
2017-03-07 16:50:55 +00:00
$(MAKE) -f ../../../micropython/unix/Makefile -C vendor/micropython/unix $(UNIX_PORT_OPTS)
build_cross: ## build mpy-cross port
2017-02-24 12:19:00 +00:00
$(MAKE) -C vendor/micropython/mpy-cross $(CROSS_PORT_OPTS)
2017-03-25 13:46:38 +00:00
## clean commands:
2017-04-10 17:11:44 +00:00
clean: clean_boardloader clean_loader clean_firmware clean_unix clean_cross ## clean all
2017-04-10 17:11:44 +00:00
clean_boardloader: ## clean boardloader build
$(MAKE) -f Makefile.boardloader clean $(TREZORHAL_PORT_OPTS)
2017-03-20 16:45:40 +00:00
clean_loader: ## clean loader build
$(MAKE) -f Makefile.loader clean $(TREZORHAL_PORT_OPTS)
clean_firmware: ## clean firmware build
$(MAKE) -f Makefile.firmware clean $(TREZORHAL_PORT_OPTS)
2016-04-11 15:55:10 +00:00
clean_unix: ## clean unix build
2017-03-07 16:50:55 +00:00
$(MAKE) -f ../../../micropython/unix/Makefile -C vendor/micropython/unix clean $(UNIX_PORT_OPTS)
2017-03-17 13:14:00 +00:00
# workaround for relative paths containing ../.. in unix Makefile
rm -rf vendor/micropython/micropython
2016-04-11 15:55:10 +00:00
clean_cross: ## clean mpy-cross build
2017-02-24 12:19:00 +00:00
$(MAKE) -C vendor/micropython/mpy-cross clean $(CROSS_PORT_OPTS)
2017-03-25 13:46:38 +00:00
## flash commands:
2017-04-10 17:11:44 +00:00
flash: flash_boardloader flash_loader flash_firmware ## flash everything using st-flash
2017-04-10 17:11:44 +00:00
flash_boardloader: ## flash boardloader using st-flash
st-flash write $(BOARDLOADER_BUILD_DIR)/boardloader.bin 0x08000000
2017-03-20 14:41:21 +00:00
flash_loader: ## flash loader using st-flash
st-flash write $(LOADER_BUILD_DIR)/loader.bin 0x08010000
flash_firmware: ## flash firmware using st-flash
st-flash write $(FIRMWARE_BUILD_DIR)/firmware.bin 0x08020000
2017-03-20 14:41:21 +00:00
2017-03-25 13:46:38 +00:00
## openocd debug commands:
openocd: ## start openocd which connects to the device
2016-04-27 16:45:00 +00:00
openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg
gdb: ## start remote gdb session which connects to the openocd
2017-03-20 14:41:21 +00:00
arm-none-eabi-gdb $(FIRMWARE_BUILD_DIR)/firmware.elf -ex 'target remote localhost:3333'
2017-04-10 14:40:41 +00:00
## misc commands:
vendorheader: ## construct default vendor header
./tools/build_vendorheader 'db995fe25169d141cab9bbba92baa01f9f2e1ece7df4cb2ac05190f37fcc1f9d:2152f8d19b791d24453242e15f2eab6cb7cffa7b6a5ed30097960e069881db12:22fc297792f0b6ffc0bfcfdb7edb0c0aa14e025a365ec0e342e86e3829cb74b6' 1 0.0 SatoshiLabs assets/satoshilabs_120.toif micropython/firmware/vendorheader.bin
./tools/binctl micropython/firmware/vendorheader.bin -s 1 4141414141414141414141414141414141414141414141414141414141414141
binctl: ## print info about binary files
./tools/binctl micropython/loader/build/loader.bin
./tools/binctl micropython/firmware/vendorheader.bin
./tools/binctl micropython/firmware/build/firmware.bin
bloaty: ## run bloaty size profiler
bloaty -d symbols -n 0 -s file micropython/firmware/build/firmware.elf | less
bloaty -d compileunits -n 0 -s file micropython/firmware/build/firmware.elf | less