Specific notes for Nordic Semiconductor's chips¶
nRF5 SDK¶
Mira is built with nRF5 SDK v17.0.2
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.
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.