Wirepas SDK
SDK Environment setup

As a prerequisite for this guide, you must be able to successfully build one of the provided application example from the SDK.

This page contains following sections:

Installation of SDK Environment

This page contains following sections:

Windows installation using WSL

For Windows installation, we're using Windows Subsystem for Linux. There are other possible options, such as Cygwin or MinGW but they are not covered here.

First, install Windows Subsystem for Linux according to installation guidelines. Choose Ubuntu installation.

After done that and system is update, proceed following in bash:

Update the system:

sudo apt update && sudo apt upgrade && sudo apt dist-upgrade && sudo apt autoremove

This page contains following sections:

Compiler installation

Using GCC Arm toolchain version 7.2.1 (7-2017-q4-major) is recommended to be used. Download the toolchain (in some directory of your own choice):

wget -O gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2?revision=375265d4-e9b5-41c8-bf23-56cbe927e156?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2017-q4-major

And unpack the downloaded package:

tar xjf gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2

Now, there is a subfolder called gcc-arm-none-eabi-7-2017-q4-major containing necessary tools. You may move the folder to desired location. Modify PATH to contain bin subfolder, for example here .

After that, you can verify that compiler toolchain has installed by typing:

arm-none-eabi-gcc --version

which should produce following output:

arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Miscellaneous installation

Here are other software components that should be installed:

sudo apt install build-essential python python-pip

Install required Python libraries:

sudo pip install pycryptodome

Installation on Ubuntu Linux

For Ubuntu-based variants, follow guideline used in Windows installation using WSL.

Checking the installation validity

The custom_app application is a simple application that sends a periodically incrementing counter value over the Wirepas network.

The application can be built with the following command:

make app_name=custom_app target_board=<target_board>

After execution of this command, you should find the final_image_custom_app.hex under build/<target_board>/<app_name> folder.

Flashing devices

When using the board for the first time, the image named final_image_<app_name>.hex generated by the build process must be flashed. This image contains the Wirepas bootloader and a scratchpad composed by the Wirepas Mesh stack and the application. This step must be done on each new board.

On next boot, the stack and the application will be flashed from the scratchpad to their dedicated flash areas.

Using the flash mechanism is a convenient way to develop the application as long as the devices are accessible and not in high volumes. When updating a large network, using OTAP is more practical.

This page contains following sections:

Flashing Nordic nRF52 devices

For information on how to flash Nordic nRF52xxx devices, check out nRF5x Command Line Tools User Guide

Flashing Silicon Labs Devices

First, install Segger J-Link Software and Documentation Pack

For information how to use Segger Jlink command-line executable (named either JLink.exe or Jlinkexe according to your operating system), refer to J-Link Commander.

The following information should be used.

Device architectureRadio profileJLink device type
EFR32xG122.4 GHz/SubGhzEFR32FG12PxxxF1024

Note: usually interface is SWD but it depends on the hardware design. For example: Flex Gecko uses SWD.

Here, couple of example J-Link Commander Command files that can be used as a reference:

Programming EFR32xG12 device:

device EFR32FG12PxxxF1024
if SWD
speed 1000
connect
r
loadfile <path_to_hex_file>.hex
r
g
q

You may also need to recover the device when you need to:

  • Remove all the parameterization
  • Flash firmware again (with protected bootloader)

The recovery removes flash write protection mechanism and whole flash contents. Following command for recovering is issued when using JLink commander:

J-Link>unlock <enter>
Syntax: unlock <DeviceName>
---Supported devices---
LM3Sxxx [<Auto>]
Kinetis
EFM32Gxxx
LPC5460x
J-Link>unlock LM3Sxxx <enter>
Be sure that nRESET is LOW before continuing.
If you are working with an eval board,
please press the RESET button and keep it pressed.
Press enter to start unlock sequence...
Unlocking device...O.K.
Please power-cycle target hardware.

Resources on Nordic nRF52832 & nRF52840

The nRF52 chip version supported by Wirepas Mesh has minimum 512kB of flash and 64kB of RAM.

This page contains following sections:

Flash Memory available for application on nRF52

As stated in description of memory partitioning, the available flash memory for application is limited by size of the memory area that is used commonly for application and also scratchpad image. If application size is too large, there is possibility that large scratchpad image will override application image. The default maximum size of the application has been set so that it is always safe to use scratchpad image that will contain both firmware and application.

The recommended maximum size of flash memory for an application is 40kB.

RAM Memory available for application on nRF52

Allocated RAM memory for application by the processor is following:

ProcessorRAM memory
nRF52832Up to 16 kB (8 kB by default)
nRF52840188 kB

Peripherals accessible by stack only

Some peripherals are used by the Wirepas Mesh stack and cannot be used by the application.

PeripheralAssociated interrupt (from file mcu/nrf52/vendor/nrf52.h)
PowerPOWER_CLOCK_IRQn
RadioRADIO_IRQn
Timer0TIMER0_IRQn
WDTWDT_IRQn
Rtc1RTC1_IRQn
ECB (AES)ECB_IRQn
PPI (Channels 0, 1 and 2)None

All the internal interrupt of cortex M are handled by the stack directly (NMI, HardFault,...)

Peripherals Shared between the stack and the application

Some peripherals are used by the stack but can also be accessed by the application. There is a dedicated API to reserve these peripherals.

These peripherals must be reserved through the API before being used and the application must initialize them each time after reserving it. In fact, the stack may configure them differently.

It is also important to avoid long reservation of theses peripherals to let the stack use them for its own purpose.

PeripheralReservation ID (from app_lib_hardware_peripheral_e)
ADCAPP_LIB_HARDWARE_PERIPHERAL_ADC
TempAPP_LIB_HARDWARE_PERIPHERAL_TEMPERATURE

Peripherals available for the application

All the other peripherals not listed above are free to be used by the application.

Resources on EFR32xG12

Following chip variants (at 2.4 GHz only) are supported:

  • EFR32FG12P232F1024G L125/M48 [2.4 GHz only, 1024/128, BGA125/QFN48]
  • EFR32FG12P432F1024G L125/M48 [2.4 GHz only, 1024/256, BGA125/QFN48]
  • EFR32FG12P433F1024G L125/M48 [2.4 GHz & SubGHz, 1024/256, BGA125/QFN48]
  • EFR32MG12P232F1024G L125/M48 [2.4 GHz only, 1024/128, BGA125/QFN48]
  • EFR32MG12P332F1024G L125/M48 [2.4 GHz only, 1024/128, BGA125/QFN48]
  • EFR32MG12P432F1024G L125/M48 [2.4 GHz only, 1024/256, BGA125/QFN48]
  • EFR32MG12P433F1024G L125/M48 [2.4 GHz & SubGHz, 1024/256, BGA125/QFN48]
  • EFR32BG12P232F1024G L125/M48 [2.4 GHz only, 1024/128, BGA125/QFN48]
  • EFR32BG12P432F1024G L125/M48 [2.4 GHz only, 1024/256, BGA125/QFN48]
  • EFR32BG12P433F1024G L125/M48 [2.4 GHz & SubGHz, 1024/256, BGA125/QFN48]

This page contains following sections:

Flash Memory available for application on EFR32

As stated in description of memory partitioning, the available flash memory for application is limited by size of the memory area that is used commonly for application and also scratchpad image. If application size is too large, there is possibility that large scratchpad image will override application image. The default maximum size of the application has been set so that it is always safe to use scratchpad image that will contain both firmware and application.

The recommended maximum size of flash memory for an application, according to processor type is following:

ProcessorFlash memory
efr32xg12pxxxf1024256kB
efr32xg12pxxxf51240kB
efr32xg13pxxxf51240kB

RAM Memory available for application on EFR32

Allocated RAM memory for application, by the processor is following:

ProcessorRAM memory
efr32xg12pxxxf102472kB
efr32xg12pxxxf5128kB
efr32xg13pxxxf51216kB

Peripherals accessible by stack only

Some peripherals are used by the Wirepas Mesh stack and cannot be used by the application.

PeripheralAssociated interrupt (from chip vendor files)
TIMER0TIMER0_IRQn
RTCCRTCC_IRQn
WDOG0WDOG0_IRQn
CMUCMU_IRQn
CRYPTO0CRYPTO0_IRQn

All the internal interrupt of cortex M are handled by the stack directly (NMI, HardFault,...)

Peripherals Shared between the stack and the application

Some peripherals are used by the stack but can also be accessed by the application.

These peripherals must be reserved through the API before being used and the application must initialize them each time after reserving it. In fact, the stack may configure them differently.

It is also important to avoid long reservation of theses peripherals to let the stack use them for its own purpose.

PeripheralReservation ID (from app_lib_hardware_peripheral_e)
ADC0APP_LIB_HARDWARE_PERIPHERAL_ADC

Peripherals available for the application

All the other peripherals not listed above are free to be used by the application.

Related Material

[3] WP-RM-108 - OTAP Reference Manual

[4] https://github.com/wirepas/wm-sdk/blob/master/source/reference_apps/dualmcu_app/api/DualMcuAPI.md