sudo apt install -y scons llvm-dev libclang-dev clang protobuf-compiler python3-pip python3-poetry
ln -s /usr/bin/python3 /usr/bin/python
pip3 install poetry trezor mako munch protobuf
sudo apt install -y scons libsdl2-dev libsdl2-image-dev llvm-dev libclang-dev clang
可选 poetry
Python虚拟环境和依赖管理的工具,poetry和pipenv类似,另外还提供了打包和发布的功能。
git submodule update --init --recursive --force
# poetry install
# poetry install --sync
# poetry shell
安装编译器
apt install -y gcc-arm-none-eabi libnewlib-arm-none-eabi openocd
在ubuntu20等早起版本,直接安装的gcc版本过低,需要下载配置特定版本 arm-gnu-toolchain
wget https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
sudo mkdir -p /opt/gcc-arm/
sudo tar xvf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz -C /opt/gcc-arm/
vim ~/.bashrc
PATH=$PATH:/opt/gcc-arm/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi/bin
安装工具 rustup
:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add thumbv7em-none-eabihf # for TT
rustup target add thumbv7m-none-eabi # for T1
rustup default nightly
rustup update
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
开始编译
cd core
make vendor build
For flashing firmware to blank device (without bootloader) use make flash
.
You need to have OpenOCD installed.
sudo openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg