Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Steps to install PineTime build tools on PineBook Pro, the Arm64-based notebook
# Remove folders ~/pinetime-rust-mynewt and ~/openocd-spi (if they exist)
rm -rf ~/pinetime-rust-mynewt
rm -rf ~/openocd-spi
# Download and extract "pinetime-rust-mynewt" folder containing our prebuilt firmware, source files and flashing scripts
sudo apt install -y wget p7zip-full
cd ~
wget https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v2.0.5/pinetime-rust-mynewt.7z
7z x pinetime-rust-mynewt.7z
rm pinetime-rust-mynewt.7z
# Install build tools for PineTime: VSCode, Rust, gcc, gdb, openocd-spi, newt
cd ~/pinetime-rust-mynewt
git pull
# When prompted to install rustup, press Enter to select default option
scripts/install-pinebook.sh
# Congrats! Your PineBook Pro is now ready to build the Rust+Mynewt Application and create the Application Firmware Image for PineTime
# cd ~/pinetime-rust-mynewt
# scripts/build-app.sh
# If you see "undefined reference to main", build again and it should be OK...
# scripts/build-app.sh
# scripts/nrf52/image-app.sh
# If install-pinebook.sh failed to install arm-none-eabi-gcc, install manually using these instructions...
# Build Arm Embedded Toolchain as 32-bit Linux (instead of default 64-bit). From https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads
# Warning: Building the toolchain takes 7 hours or more! To prevent overheating and shutting down, elevate the PineBook to keep the underside clear. Build in a well-ventilated cool room. Throttling the CPU speed to 1.42 GHz or less also helps (though it extends the build time).
# cd ~
# wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-src.tar.bz2
# tar -xf gcc-arm-none-eabi-*-src.tar.bz2
# rm gcc-arm-none-eabi-*-src.tar.bz2
# cd gcc-arm-none-eabi-*
# sudo apt install -y build-essential autoconf autogen bison dejagnu flex flip gawk git gperf gzip nsis openssh-client p7zip-full perl python-dev libisl-dev scons tcl texinfo tofrodos wget zip texlive texlive-extra-utils libncurses5-dev
# ./install-sources.sh --skip_steps=mingw32
# linux32 ./build-prerequisites.sh --skip_steps=mingw32
# linux32 ./build-toolchain.sh --skip_steps=mingw32
# Install Arm Embedded Toolchain into /opt/gcc-arm-none-eabi
# cd ~/gcc-arm-none-eabi-*
# sudo rm -rf /opt/gcc-arm-none-eabi
# sudo mkdir -p /opt/gcc-arm-none-eabi
# sudo mv install-native/* /opt/gcc-arm-none-eabi/
# gccpath=`ls -d /opt/gcc-arm-none-eabi/bin`
# echo export PATH=$gccpath:\$PATH >> ~/.bashrc
# echo export PATH=$gccpath:\$PATH >> ~/.profile
# export PATH=$gccpath:$PATH
# arm-none-eabi-gcc --version # Should show "9.2.1 20191025" or later.
# cd ~/pinetime-rust-mynewt ; scripts/install-pinebook.sh
# If you can't wait 7 hours...
# (1) Let the build run for 1 hour and pause (Ctrl-S)
# (2) The gcc executables (32-bit) should be generated in ~/gcc.../install-native/bin
# (3) Download the 64-bit gcc toolchain from https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-aarch64-linux.tar.bz2
# (4) Expand the 64-bit archive, copy all folders inside into /opt/gcc-arm-none-eabi/: arm-none-eabi, bin, lib, share
# (5) Copy the partial build (32-bit) from ~/gcc.../install-native/ to /opt/gcc-arm-none-eabi/, overwriting the 64-bit folders: arm-none-eabi, bin, lib, share
# (6) cd ~/pinetime-rust-mynewt ; scripts/install-pinebook.sh
# You may refer to my Arm Embedded Toolchain binaries (gcc-arm-none-eabi.tar.bz2):
# https://github.com/lupyuen/pinetime-rust-mynewt/releases/tag/v1.0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment