1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00
trezor-firmware/core/docs/build/embedded.md
2019-08-08 11:12:17 +02:00

1.9 KiB

Build instructions for Embedded (ARM port)

First clone, initialize submodules and install Pipenv as defined here.

Requirements

You will need the GCC ARM toolchain for building and OpenOCD for flashing to a device. You will also need Python dependencies for signing.

Debian/Ubuntu

sudo apt-get install scons gcc-arm-none-eabi libnewlib-arm-none-eabi

OS X

  1. Download gcc-arm-none-eabi
  2. Follow the install instructions
  3. To install OpenOCD, run brew install open-ocd
  4. Run pipenv run make vendor build_boardloader build_bootloader build_firmware

Building

pipenv run make vendor build_boardloader build_bootloader build_firmware

Uploading

Use make upload to upload the firmware to a production device. Do not forget to enter bootloader on the device beforehand.

Flashing

For flashing firmware to blank device (without bootloader) use make flash, or make flash STLINK_VER=v2-1 if using a ST-LINK/V2.1 interface. You need to have OpenOCD installed.

Building in debug mode

You can also build firmware in debug mode to see log output or run tests. To avoid building firmware in debug mode accidentally, we do not provide a make target. You need to rewrite PYOPT variable to 0 in SConscript.firmware file and then build the same way. The change is intentionally not gitignored.

sed -i "s/^PYOPT = '1'$/PYOPT = '0'/" SConscript.firmware
pipenv run make build_firmware

You can then use screen to enter the device's console. Do not forget to add your user to the dialout group or use sudo. Note that both the group and the tty name can differ, use ls -l to find out proper names on your machine.

screen /dev/ttyACM0