cd~# Download the packagewget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2
# Extracttar-jxvfgcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2# Rename the directory to ~\gnuarmembmvgcc-arm-none-eabi-9-2020-q2-updategnuarmemb
cd ~
# Download the package
wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-mac.tar.bz2
# Extract
tar -jxvf gcc-arm-none-eabi-9-2020-q2-update-mac.tar.bz2
# Rename the directory to ~\gnuarmemb
mv gcc-arm-none-eabi-9-2020-q2-update gnuarmemb
set required environment variables
# Create ~/.zephyrrc for easy env variables managementecho'export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb'>>~/.zephyrrcecho'export GNUARMEMB_TOOLCHAIN_PATH="~/gnuarmemb"'>>~/.zephyrrc
Install the Nordic SDK
the Nordic SDK is managed by the westtool, so we first need to install west: open a terminal and type
# Install westpip3install--user-Uwest# Make sure the `west`executable is in front of your PATH:echo'export PATH=~/.local/bin:"$PATH"'>>~/.bashrcsource~/.bashrc# Check that west is correctly installedwest--version
In your home directory, create a folder named ncs: we will install the SDK there:
mkdir~/ncscd~/ncs# Initialize the folderwestinit-mhttps://github.com/nrfconnect/sdk-nrf--mrv1.3.0# Download all required repositorieswestupdate# Export a Zephyr CMake package. This allows CMake to automatically load the boilerplate code required for building nRF Connect SDK applications:
westzephyr-export
Before we can build the firmware we need to replace the default board definition from the nordic SDK with the one for Pebble:
# Delete the default board definitionrm-rf~/ncs/nrf/boards/arm/thingy91_nrf9160# Replace with the one from pebble-firmwarecp-rv~/pebble-firmware-legacy/nrf/boards/arm/thingy91_nrf9160ncs/nrf/boards/arm/
Before trying to build the project you must set the required environment variables for Zephyr, to do so you can run:
# Load environment variables for the Zephyr SDKsource~/ncs/zephyr/zephyr-env.sh
Among other things, this will also source your ~/.zephyrrc where the arm toolchain environment variables are set: you can use this file to add any customization to the environment.
Please notice that the environment variables will be lost if you close your terminal window: run source ~/ncs/zephyr/zephyr-env.sh again to get them back
The project can then be compiled with the following commands:
cd~# Make sure to remove any previously created build directoryrm-rfbuild/# Start the build processwestbuild-bthingy91_nrf9160ns~/pebble-firmware-legacy/nrf/applications/asset_tracker/
After the project is compiled successfully, you can flash the new Pebble firmware that is available at ~/build/zephyr/app_signed.hex.