mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 20:11:00 +00:00
chore(core): improve makefile
This commit is contained in:
parent
be75e359a2
commit
1ca7cf5609
@ -27,6 +27,7 @@ TREZOR_MODEL ?= T
|
|||||||
TREZOR_MEMPERF ?= 0
|
TREZOR_MEMPERF ?= 0
|
||||||
ADDRESS_SANITIZER ?= 0
|
ADDRESS_SANITIZER ?= 0
|
||||||
CMAKELISTS ?= 0
|
CMAKELISTS ?= 0
|
||||||
|
PYTEST_TIMEOUT ?= 400
|
||||||
|
|
||||||
# OpenOCD interface default. Alternative: ftdi/olimex-arm-usb-tiny-h
|
# OpenOCD interface default. Alternative: ftdi/olimex-arm-usb-tiny-h
|
||||||
OPENOCD_INTERFACE ?= stlink
|
OPENOCD_INTERFACE ?= stlink
|
||||||
@ -88,13 +89,16 @@ test: ## run unit tests
|
|||||||
cd tests ; ./run_tests.sh $(TESTOPTS)
|
cd tests ; ./run_tests.sh $(TESTOPTS)
|
||||||
|
|
||||||
test_rust: ## run rs unit tests
|
test_rust: ## run rs unit tests
|
||||||
cd embed/rust ; cargo test --target=$(RUST_TARGET) --no-default-features --features model_t$(shell echo $(TREZOR_MODEL) | tr "TR" "tr"),test -- --test-threads=1
|
cd embed/rust ; cargo test $(TESTOPTS) --target=$(RUST_TARGET) \
|
||||||
|
--no-default-features --features model_t$(shell echo $(TREZOR_MODEL) | tr "TR" "tr"),test \
|
||||||
|
-- --test-threads=1 --nocapture
|
||||||
|
|
||||||
test_emu: ## run selected device tests from python-trezor
|
test_emu: ## run selected device tests from python-trezor
|
||||||
$(EMU_TEST) $(PYTEST) $(TESTPATH)/device_tests $(TESTOPTS)
|
$(EMU_TEST) $(PYTEST) $(TESTPATH)/device_tests $(TESTOPTS)
|
||||||
|
|
||||||
test_emu_multicore: ## run device tests using multiple cores
|
test_emu_multicore: ## run device tests using multiple cores
|
||||||
$(PYTEST) -n $(MULTICORE) $(TESTPATH)/device_tests $(TESTOPTS) --control-emulators --model=core --random-order-seed=$(shell echo $$RANDOM)
|
$(PYTEST) -n $(MULTICORE) $(TESTPATH)/device_tests $(TESTOPTS) --timeout $(PYTEST_TIMEOUT) \
|
||||||
|
--control-emulators --model=core --random-order-seed=$(shell echo $$RANDOM)
|
||||||
|
|
||||||
test_emu_monero: ## run selected monero device tests from monero-agent
|
test_emu_monero: ## run selected monero device tests from monero-agent
|
||||||
cd tests ; $(EMU_TEST) ./run_tests_device_emu_monero.sh $(TESTOPTS)
|
cd tests ; $(EMU_TEST) ./run_tests_device_emu_monero.sh $(TESTOPTS)
|
||||||
@ -124,7 +128,7 @@ test_emu_ui: ## run ui integration tests
|
|||||||
--ui=test --ui-check-missing --record-text-layout
|
--ui=test --ui-check-missing --record-text-layout
|
||||||
|
|
||||||
test_emu_ui_multicore: ## run ui integration tests using multiple cores
|
test_emu_ui_multicore: ## run ui integration tests using multiple cores
|
||||||
$(PYTEST) -n $(MULTICORE) $(TESTPATH)/device_tests $(TESTOPTS) \
|
$(PYTEST) -n $(MULTICORE) $(TESTPATH)/device_tests $(TESTOPTS) --timeout $(PYTEST_TIMEOUT) \
|
||||||
--ui=test --ui-check-missing --record-text-layout \
|
--ui=test --ui-check-missing --record-text-layout \
|
||||||
--control-emulators --model=core --random-order-seed=$(shell echo $$RANDOM)
|
--control-emulators --model=core --random-order-seed=$(shell echo $$RANDOM)
|
||||||
|
|
||||||
@ -134,10 +138,7 @@ test_emu_ui_record: ## record and hash screens for ui integration tests
|
|||||||
|
|
||||||
test_emu_ui_record_multicore: ## quickly record all screens
|
test_emu_ui_record_multicore: ## quickly record all screens
|
||||||
make test_emu_ui_multicore || echo "All errors are recorded in fixtures.json"
|
make test_emu_ui_multicore || echo "All errors are recorded in fixtures.json"
|
||||||
make test_emu_accept_fixtures
|
../tests/update_fixtures.py -r
|
||||||
|
|
||||||
test_emu_accept_fixtures: # accept UI fixtures from the last run of UI tests
|
|
||||||
../tests/update_fixtures.py
|
|
||||||
|
|
||||||
pylint: ## run pylint on application sources and tests
|
pylint: ## run pylint on application sources and tests
|
||||||
pylint -E $(shell find src tests -name *.py)
|
pylint -E $(shell find src tests -name *.py)
|
||||||
@ -169,36 +170,51 @@ build: build_boardloader build_bootloader build_firmware build_prodtest build_un
|
|||||||
build_embed: build_boardloader build_bootloader build_firmware # build boardloader, bootloader, firmware
|
build_embed: build_boardloader build_bootloader build_firmware # build boardloader, bootloader, firmware
|
||||||
|
|
||||||
build_boardloader: ## build boardloader
|
build_boardloader: ## build boardloader
|
||||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" $(BOARDLOADER_BUILD_DIR)/boardloader.bin
|
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
|
||||||
|
CMAKELISTS="$(CMAKELISTS)" $(BOARDLOADER_BUILD_DIR)/boardloader.bin
|
||||||
|
|
||||||
build_bootloader: ## build bootloader
|
build_bootloader: ## build bootloader
|
||||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" BOOTLOADER_QA="$(BOOTLOADER_QA)" $(BOOTLOADER_BUILD_DIR)/bootloader.bin
|
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
|
||||||
|
CMAKELISTS="$(CMAKELISTS)" BOOTLOADER_QA="$(BOOTLOADER_QA)" $(BOOTLOADER_BUILD_DIR)/bootloader.bin
|
||||||
|
|
||||||
build_bootloader_ci: ## build CI device testing bootloader
|
build_bootloader_ci: ## build CI device testing bootloader
|
||||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" $(BOOTLOADER_CI_BUILD_DIR)/bootloader.bin
|
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
|
||||||
|
CMAKELISTS="$(CMAKELISTS)" $(BOOTLOADER_CI_BUILD_DIR)/bootloader.bin
|
||||||
|
|
||||||
build_bootloader_emu: ## build the unix bootloader emulator
|
build_bootloader_emu: ## build the unix bootloader emulator
|
||||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" $(BOOTLOADER_EMU_BUILD_DIR)/bootloader.elf
|
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" $(BOOTLOADER_EMU_BUILD_DIR)/bootloader.elf
|
||||||
|
|
||||||
build_prodtest: ## build production test firmware
|
build_prodtest: ## build production test firmware
|
||||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" $(PRODTEST_BUILD_DIR)/prodtest.bin
|
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
|
||||||
|
CMAKELISTS="$(CMAKELISTS)" $(PRODTEST_BUILD_DIR)/prodtest.bin
|
||||||
|
|
||||||
build_reflash: ## build reflash firmware + reflash image
|
build_reflash: ## build reflash firmware + reflash image
|
||||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" $(REFLASH_BUILD_DIR)/reflash.bin
|
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" \
|
||||||
|
CMAKELISTS="$(CMAKELISTS)" $(REFLASH_BUILD_DIR)/reflash.bin
|
||||||
dd if=build/boardloader/boardloader.bin of=$(REFLASH_BUILD_DIR)/sdimage.bin bs=1 seek=0
|
dd if=build/boardloader/boardloader.bin of=$(REFLASH_BUILD_DIR)/sdimage.bin bs=1 seek=0
|
||||||
dd if=build/bootloader/bootloader.bin of=$(REFLASH_BUILD_DIR)/sdimage.bin bs=1 seek=49152
|
dd if=build/bootloader/bootloader.bin of=$(REFLASH_BUILD_DIR)/sdimage.bin bs=1 seek=49152
|
||||||
|
|
||||||
build_firmware: templates build_cross ## build firmware with frozen modules
|
build_firmware: templates build_cross ## build firmware with frozen modules
|
||||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" PYOPT="$(PYOPT)" BITCOIN_ONLY="$(BITCOIN_ONLY)" BOOTLOADER_QA="$(BOOTLOADER_QA)" $(FIRMWARE_BUILD_DIR)/firmware.bin
|
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" \
|
||||||
|
TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" \
|
||||||
|
PYOPT="$(PYOPT)" BITCOIN_ONLY="$(BITCOIN_ONLY)" \
|
||||||
|
BOOTLOADER_QA="$(BOOTLOADER_QA)" $(FIRMWARE_BUILD_DIR)/firmware.bin
|
||||||
|
|
||||||
build_unix: templates ## build unix port
|
build_unix: templates ## build unix port
|
||||||
$(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" PYOPT="0" BITCOIN_ONLY="$(BITCOIN_ONLY)" TREZOR_EMULATOR_ASAN="$(ADDRESS_SANITIZER)"
|
$(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) \
|
||||||
|
TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" \
|
||||||
|
PYOPT="0" BITCOIN_ONLY="$(BITCOIN_ONLY)" TREZOR_EMULATOR_ASAN="$(ADDRESS_SANITIZER)"
|
||||||
|
|
||||||
build_unix_frozen: templates build_cross ## build unix port with frozen modules
|
build_unix_frozen: templates build_cross ## build unix port with frozen modules
|
||||||
$(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" PYOPT="$(PYOPT)" BITCOIN_ONLY="$(BITCOIN_ONLY)" TREZOR_EMULATOR_ASAN="$(ADDRESS_SANITIZER)" TREZOR_MEMPERF="$(TREZOR_MEMPERF)" TREZOR_EMULATOR_FROZEN=1
|
$(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) \
|
||||||
|
TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" \
|
||||||
|
PYOPT="$(PYOPT)" BITCOIN_ONLY="$(BITCOIN_ONLY)" TREZOR_EMULATOR_ASAN="$(ADDRESS_SANITIZER)" \
|
||||||
|
TREZOR_MEMPERF="$(TREZOR_MEMPERF)" TREZOR_EMULATOR_FROZEN=1
|
||||||
|
|
||||||
build_unix_debug: templates ## build unix port
|
build_unix_debug: templates ## build unix port
|
||||||
$(SCONS) --max-drift=1 CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" BITCOIN_ONLY="$(BITCOIN_ONLY)" TREZOR_EMULATOR_ASAN=1 TREZOR_EMULATOR_DEBUGGABLE=1
|
$(SCONS) --max-drift=1 CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/trezor-emu-core $(UNIX_PORT_OPTS) \
|
||||||
|
TREZOR_MODEL="$(TREZOR_MODEL)" CMAKELISTS="$(CMAKELISTS)" \
|
||||||
|
BITCOIN_ONLY="$(BITCOIN_ONLY)" TREZOR_EMULATOR_ASAN=1 TREZOR_EMULATOR_DEBUGGABLE=1
|
||||||
|
|
||||||
build_cross: ## build mpy-cross port
|
build_cross: ## build mpy-cross port
|
||||||
$(MAKE) -C vendor/micropython/mpy-cross $(CROSS_PORT_OPTS)
|
$(MAKE) -C vendor/micropython/mpy-cross $(CROSS_PORT_OPTS)
|
||||||
@ -337,3 +353,4 @@ coverage: ## generate coverage report
|
|||||||
|
|
||||||
unused: ## find unused micropython code
|
unused: ## find unused micropython code
|
||||||
vulture src src/_vulture_ignore.txt --exclude "messages.py,*/enums/*"
|
vulture src src/_vulture_ignore.txt --exclude "messages.py,*/enums/*"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user