trezor-core/Makefile

78 lines
2.5 KiB
Makefile
Raw Normal View History

2016-05-11 05:39:28 -07:00
.PHONY: vendor
2016-10-12 09:29:01 -07:00
JOBS=4
MAKE=make -j $(JOBS)
2017-03-06 08:33:42 -08:00
TREZORHAL_BUILD_DIR=micropython/firmware/build
2017-02-24 04:19:00 -08:00
2017-03-06 08:33:42 -08:00
TREZORHAL_PORT_OPTS=FROZEN_MPY_DIR=src
2017-02-24 04:19:00 -08:00
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
CROSS_PORT_OPTS=MICROPY_FORCE_32BIT=1
2016-10-12 09:29:01 -07:00
help: ## show this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36mmake %-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
2016-05-11 05:39:28 -07:00
vendor: ## update git submodules
2017-03-06 08:33:42 -08:00
# git submodule update --init
res: ## update resources
./tools/res_collect
2017-02-24 04:19:00 -08:00
build: build_trezorhal build_unix build_cross ## build trezorhal, unix and mpy-cross micropython ports
2017-02-24 04:19:00 -08:00
build_trezorhal: vendor res build_cross ## build trezorhal port with frozen modules
2017-03-06 08:33:42 -08:00
$(MAKE) -f Makefile.firmware $(TREZORHAL_PORT_OPTS)
2017-02-20 02:36:07 -08:00
2017-02-24 04:19:00 -08:00
build_trezorhal_debug: vendor res build_cross ## build trezorhal port with frozen modules and debug symbols
2017-03-06 08:33:42 -08:00
$(MAKE) -f Makefile.firmware $(TREZORHAL_PORT_OPTS) DEBUG=1
2016-10-03 08:23:21 -07:00
build_unix: vendor ## build unix port
2017-02-24 04:19:00 -08:00
$(MAKE) -C vendor/micropython/unix $(UNIX_PORT_OPTS)
2016-10-03 08:23:21 -07:00
build_unix_debug: vendor ## build unix port with debug symbols
2017-02-24 04:19:00 -08:00
$(MAKE) -C vendor/micropython/unix $(UNIX_PORT_OPTS) DEBUG=1
2016-10-03 08:23:21 -07:00
build_cross: vendor ## build mpy-cross port
2017-02-24 04:19:00 -08:00
$(MAKE) -C vendor/micropython/mpy-cross $(CROSS_PORT_OPTS)
run: ## run unix port
2016-04-11 02:10:43 -07:00
cd src ; ../vendor/micropython/unix/micropython
emu: ## run emulator
./emu.sh
2017-02-24 04:19:00 -08:00
clean: clean_trezorhal clean_unix clean_cross ## clean all builds
2016-04-11 08:55:10 -07:00
2017-02-20 02:36:07 -08:00
clean_trezorhal: ## clean trezorhal build
2017-03-06 08:33:42 -08:00
$(MAKE) -f Makefile.firmware clean $(TREZORHAL_PORT_OPTS)
2016-04-11 08:55:10 -07:00
clean_unix: ## clean unix build
2017-02-24 04:19:00 -08:00
$(MAKE) -C vendor/micropython/unix clean $(UNIX_PORT_OPTS)
2016-04-11 08:55:10 -07:00
clean_cross: ## clean mpy-cross build
2017-02-24 04:19:00 -08:00
$(MAKE) -C vendor/micropython/mpy-cross clean $(CROSS_PORT_OPTS)
flash: ## flash firmware using st-flash
2017-02-24 04:19:00 -08:00
st-flash write $(TREZORHAL_BUILD_DIR)/firmware.bin 0x8000000
2017-02-24 04:19:00 -08:00
flash_openocd: $(TREZORHAL_BUILD_DIR)/firmware.hex ## flash firmware using openocd
2016-09-29 04:30:23 -07:00
openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg \
-c "init" \
-c "reset init" \
-c "stm32f4x mass_erase 0" \
2017-02-24 04:19:00 -08:00
-c "flash write_image $(TREZORHAL_BUILD_DIR)/firmware.hex" \
2016-09-29 04:30:23 -07:00
-c "reset" \
-c "shutdown"
openocd: ## start openocd which connects to the device
2016-04-27 09:45:00 -07:00
openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg
gdb: ## start remote gdb session which connects to the openocd
2017-02-24 04:19:00 -08:00
arm-none-eabi-gdb $(TREZORHAL_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