trezor-core/Makefile

107 lines
3.5 KiB
Makefile
Raw Normal View History

2016-05-11 05:39:28 -07:00
.PHONY: vendor
STMHAL_BUILD_DIR=vendor/micropython/stmhal/build-TREZORV2
2016-10-12 09:29:01 -07:00
JOBS=4
MAKE=make -j $(JOBS)
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
git submodule update --init
res: ## update resources
2016-10-03 08:23:21 -07:00
./tools/res_collect.py
build: build_stmhal build_unix build_cross ## build stmhal, unix and mpy-cross micropython ports
2016-03-30 09:30:22 -07:00
2016-10-03 08:23:21 -07:00
build_stmhal: vendor ## build stmhal port
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/stmhal
2016-03-30 09:30:22 -07:00
2016-10-03 08:23:21 -07:00
build_stmhal_debug: vendor ## build stmhal port with debug symbols
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/stmhal
2016-09-13 07:45:42 -07:00
build_stmhal_frozen: vendor res build_cross ## build stmhal port with frozen modules (from /src)
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/stmhal FROZEN_MPY_DIR=../../../src
2016-10-03 08:23:21 -07:00
build_unix: vendor ## build unix port
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/unix MICROPY_FORCE_32BIT=1
2016-10-03 08:23:21 -07:00
build_unix_debug: vendor ## build unix port with debug symbols
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/unix MICROPY_FORCE_32BIT=1 DEBUG=1
2016-09-13 07:45:42 -07:00
build_unix_frozen: vendor res build_cross ## build unix port with frozen modules (from /src)
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/unix MICROPY_FORCE_32BIT=1 FROZEN_MPY_DIR=../../../src
2016-10-03 08:23:21 -07:00
build_cross: vendor ## build mpy-cross port
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/mpy-cross MICROPY_FORCE_32BIT=1
build_bootloader: vendor ## build bootloader
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/stmhal -f Makefile.bootloader
run: ## run unix port
2016-04-11 02:10:43 -07:00
cd src ; ../vendor/micropython/unix/micropython
emu: ## run emulator
./emu.sh
clean: clean_stmhal clean_unix clean_cross ## clean all builds
2016-04-11 08:55:10 -07:00
clean_stmhal: ## clean stmhal build
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/stmhal clean
2016-04-11 08:55:10 -07:00
clean_unix: ## clean unix build
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/unix clean
2016-04-11 08:55:10 -07:00
clean_cross: ## clean mpy-cross build
2016-10-12 09:29:01 -07:00
$(MAKE) -C vendor/micropython/mpy-cross clean
2016-04-12 09:09:23 -07:00
test: ## run unit tests
cd src/tests ; ./run_tests.sh
flash: ## flash firmware using st-flash
st-flash write $(STMHAL_BUILD_DIR)/firmware0.bin 0x8000000
sleep 0.1
st-flash write $(STMHAL_BUILD_DIR)/firmware1.bin 0x8020000
2016-10-03 08:23:21 -07:00
flash_bl: vendor ## flash bootloader using st-flash
st-flash write $(STMHAL_BUILD_DIR)/bootloader0.bin 0x8000000
sleep 0.1
st-flash write $(STMHAL_BUILD_DIR)/bootloader1.bin 0x8020000
2016-10-03 08:23:21 -07:00
openocd_flash: $(STMHAL_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" \
2016-10-03 08:23:21 -07:00
-c "flash write_image $(STMHAL_BUILD_DIR)/firmware.hex" \
2016-09-29 04:30:23 -07:00
-c "reset" \
-c "shutdown"
2016-10-03 08:23:21 -07:00
openocd_flash_bl: $(STMHAL_BUILD_DIR)/bootloader.hex ## flash bootloader 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" \
2016-10-03 08:23:21 -07:00
-c "flash write_image $(STMHAL_BUILD_DIR)/bootloader.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
2016-09-29 05:38:31 -07:00
arm-none-eabi-gdb $(STMHAL_BUILD_DIR)/firmware.elf -ex 'target remote localhost:3333'
2016-03-31 07:48:57 -07:00
2016-10-03 08:23:21 -07:00
gdb_bl: ## start remote gdb session which connects to the openocd
2016-09-29 05:38:31 -07:00
arm-none-eabi-gdb $(STMHAL_BUILD_DIR)/bootloader.elf -ex 'target remote localhost:3333'
2016-09-29 04:22:31 -07:00
2016-04-03 16:46:46 -07:00
load: ## load contents of src into mass storage of trezor
2016-03-31 07:48:57 -07:00
rm -rf /run/media/${USER}/PYBFLASH/*
cp -a src/apps /run/media/${USER}/PYBFLASH/
2016-04-27 13:44:37 -07:00
cp -a src/lib /run/media/${USER}/PYBFLASH/
cp -a src/trezor /run/media/${USER}/PYBFLASH/
cp -a src/*.py /run/media/${USER}/PYBFLASH/
2016-04-04 04:58:21 -07:00
sync