Skip to content

Specific notes for Nordic Semiconductor's chips

nRF5 SDK

Mira is built with nRF5 SDK v17.1.0

CTRL-AP and revision 3 chips

Starting with revision 3 chips, the CTRL-AP access is partially disabled when the MCU starts. It has to be chip erased (for example via nrfjprog --recover) to be unlocked for programming and the port will be locked again after pin reset, power cycled etc.

To keep the CTRL-AP access enabled for debugging, reprogramming etc, MiraOS can be configured to unlock it during startup. Add:

APPROTECT_DISABLED=yes

to the make file to enable debugging/programming of the device. If it is not defined, or defined as something else, MiraOS will properly lock the CTRL-AP port with APPROTECT according to Nordic Semiconductor's errata 249.

This only works with the provided make files. With custom make files, set MIRA_NRF_APPROTECT_DISABLE to 1 before compiling isr_vector.c.

SoftDevice

Mira is available in variants with and without SoftDevice. The version used is 7.2.0

The variants of MiraOS with SoftDevice handle the start of SoftDevice, as well as all radio events. BLE events are provided by a MiraOS API, see concurrent Bluetooth.

Access other events through the Nordic Semiconductor's SDK, see nrf_sdh_soc.h file.

With MiraMesh, the firmware should start SoftDevice before MiraMesh and route SoftDevice events to MiraMesh, see here.

MiraOS Example

    #include "nrf_sdh_soc.h"

    static void evt_receiver(uint32_t evt_id, void *p_context)
    {
        // Handle events here
    }

    NRF_SDH_SOC_OBSERVER(m_sd_evt_receiver, 0, evt_receiver, &ctx);

Build without SoftDevice image

Firmware files include the SoftDevice image by default when building for a SoftDevice target of the form “nrf52*ble-os”. To remove the SoftDevice from the generated firmware file, add a file called nrf_mbr_sd.c with the following content:

__attribute__((section(".nrf_mbr_sd")))
int nrf_mbr_sd[0];

This is useful to speed up flashing during development and to reduce the image needed to transfer with FOTA for updates. Please note that future versions of MiraOS might depend on different Softdevice versions (or none) so any FOTA mechanism also need to support for a way to update the Softdevice.

ABI

  • Mira < 2.4.0 uses the ARM VFP ABI (-mfloat-abi=hard).
  • Mira 2.4.x uses the ARM EABI ABI (-mfloat-abi=soft).
  • Mira >= 2.5.0 will use the VFP ABI again.

For MiraOS 2.4.x, the FPU is turned off by default.

To use hardware floating point, use the -mfloat-abi=softfp flag to gcc and turn on the FPU during startup:

    SCB->CPACR |= (3UL << 20) | (3UL << 22);

Please read ARM's documentation about the CPACR register.

Note that GCC has had bugs when mixing soft and softfp flags in a project so not all versions work.