West Build and Flash

Applications for the Atmosic EVK boards can be built, flashed, and debugged using the familiar west build and west flash.

It is recommended to set the environment variables ZEPHYR_TOOLCHAIN_VARIANT to zephyr and ZEPHYR_SDK_INSTALL_DIR to the directory where Zephyr SDK is installed. For example, assuming the installed SDK version is 0.16.4 in the home directory, for reference, it will be like this in a bash shell environment: (use setenv in a C shell environment, or set for Windows):

export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=$HOME/zephyr-sdk-0.16.4

Atmosic boards can be built with a single application image using the supplied board files. For advanced security requirements, applications can optionally be built with separate SPE (Secure Processing Environment) and NSPE (Non-Secure Processing Environment) images. See SPE/NSPE Architecture and Advanced Build Options for details on SPE/NSPE builds.

In the remainder of this document, substitute for <ZEPHYR_TOOLCHAIN_VARIANT>, <ZEPHYR_SDK_INSTALL_DIR>, <WEST_TOPDIR>, <APP>, <MCUBOOT>, <BOARD>, and <DEVICE_ID> appropriately. For example:

<ZEPHYR_TOOLCHAIN_VARIANT>: zephyr
<ZEPHYR_SDK_INSTALL_DIR>: /absolute/path/to/zephyrSDK
<WEST_TOPDIR>: /absolute/path/to/zephyrproject
<APP>: zephyr/samples/bluetooth/peripheral
<MCUBOOT>: bootloader/mcuboot/boot/zephyr
<BOARD>: ATMEVK-3430e-YQN-5
<DEVICE_ID>: 000900036960
  • <DEVICE_ID> is the unique ID from the J-Link device used to program. For FTDI, the format will be ATRDIXXXX.

Building and Flashing

Applications can be built with MCUboot or without the MCUboot option. If a device firmware update (DFU) is not needed, you can choose the option without MCUboot. If you require DFU, then the MCUboot option is required.

A. Non-MCUboot Option

  1. Build the Application

Example:

west build -p -s <APP> -b <BOARD> -d build/<APP>
  1. Flashing the Application

Atmosic provides a mechanism to decrease the legacy programming time called FAST LOAD. Apply the option --fast_load to enable the FAST LOAD.

Example:

west flash --device <DEVICE_ID> --jlink --fast_load --verify -d build/<APP>
Notes:
  • -p option specifies pristine build, similar to make clean option. Flags passed after the -- instructs west to treat them as C Pre processor flags passed to Make subsystem.

  • Additional BLE stack configuration options can be supplied. Refer to Atmosic BLE Stack

B. MCUboot Option

Attention

Zephyr sysbuild is the preferred method to build a system that has one or more applications. MCUboot is an additional application that can provide secure boot and firmware upgrade services. It must be configured, built and flashed along with the appliction. The steps in this document are provided for historical reference and advanced build configurations should use sysbuild. See Sysbuild and Flash

  1. Build the MCUboot application

To build with MCUboot, first build MCUboot:

west build -p -s <MCUBOOT> -b <BOARD>@mcuboot_bl -d build/<MCUBOOT>

Attention

For ATM33xx platforms please refer to Atmosic BLE Stack on additional device tree flags when using fixed wireless stacks.

Note that the use of the @mcuboot_bl variant will configure MCUboot application system resources.

  1. Build the Application with MCUboot:

Build the application with an MCUboot configuration as follows:

west build -p -s <APP> -b <BOARD>@mcuboot -d build/<APP> -- -DCONFIG_BOOTLOADER_MCUBOOT=y -DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE=\"bootloader/mcuboot/root-ec-p256.pem\" -DEXTRA_CONF_FILE="<WEST_TOPDIR>/openair/doc/dfu/overlay-bt-dfu.conf"

Note that the use of the @mcuboot variant will configure board resources to support image upgrades managed by the MCUboot secure bootloader.

When passing -DCONFIG_BOOTLOADER_MCUBOOT=y on the application build command line, west automatically creates a signed image (zephyr.signed.{bin,hex}), which is ultimately used by west flash to program the device.

  1. Flashing the MCUboot and the Application:

Flash MCUboot:

Atmosic provides a mechanism to decrease the legacy programming time called FAST LOAD. Apply the option --fast_load to enable the FAST LOAD:

west flash --verify --device <DEVICE_ID> --jlink --fast_load -d build/<MCUBOOT> --noreset

Note that adding --erase_flash is an option to erase Flash if needed.

Flash the signed application image:

west flash --verify --device <DEVICE_ID> --jlink --fast_load -d build/<APP>/zephyr/<zephyr.signed.{bin,hex}>