1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-16 04:29:08 +00:00
trezor-firmware/docs/core/build/embedded.md
obrusvit a47ae5da1a docs: minor fix of build emu
[no changelog]
2024-04-16 10:31:09 +02:00

2.6 KiB

Build instructions for Embedded (ARM port)

First clone, initialize submodules and install Poetry as defined here. Do not forget you need to be in a poetry shell environment!

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 llvm-dev libclang-dev clang

NixOS

There is a shell.nix file in the root of the project. Just run the following before entering the core directory:

nix-shell

OS X

Consider using Nix. With Nix all you need to do is nix-shell.

For other users:

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

Protobuf Compiler

The protocol buffer compiler protoc is needed to (unsurprisingly) compile protocol buffer files. Follow the installation instructions for your system.

Rust

Install the appropriate target with rustup:

rustup target add thumbv7em-none-eabihf  # for TT
rustup target add thumbv7m-none-eabi     # for T1

Building

make vendor build_boardloader build_bootloader build_firmware

Uploading

Use make upload to upload the firmware to a production device.

  • For TT: Do not forget to enter bootloader on the device beforehand.
  • For TS3: You will have to unlock bootloader first. Make sure to read the link in completeness for potentially unwanted effects.

Flashing

For flashing firmware to blank device (without bootloader) use make flash. 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.

PYOPT=0 make build_firmware

To get a full debug build, use:

make build_firmware BITCOIN_ONLY=0 PYOPT=0

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 /dev/tty* or ls /dev/tty* | grep usb to find out proper names on your machine.

screen /dev/ttyACM0