Skip to content

Configuration areas

MiraOS features memory areas for configuring application and hardware. Userconfig, sysconfig, and certificate are such memory areas.

These memory areas share a common format.

Area types

Userconfig

Use the userconfig area to store application specific data in non-volatile memory. The application may use this area through the configuration API.

The production line may also flash user data into this memory area.

The linker script area CONFIG1 sets the location of the userconfig in memory.

Sysconfig

The sysconfig area stores hardware related configuration.

Location

Chip Location Size
nrf52832_XXAA NRFUICR->CUSTOMER[0..31] (0x10001080) 128 bytes
nrf52840_XXAA NRFUICR->CUSTOMER[0..31] (0x10001080) 128 bytes
mkw41z512 Not implemented

Resilience

Updates of application firmware versions in flash should typically not overwrite the sysconfig area. Modify the content of the sysconfig area only when modifying the hardware.

Certificate

The certificate area stores the unit's license to run MiraOS.

Format

The configuration areas share a common format:

data fields type version CRC
variable size 16 bits 16 bits 32 bits

Fields are stored as little endian.

Data fields

Userconfig

Format of the fields in userconfig are at the discretion of the user.

Sysconfig

The only currently supported setting is module ID, in the first uint32_t of the sysconfig area.

Module ID
value module name
0 unknown
1 Bare nRF52832_XXAA
2 Bare nRF52840_XXAA
3 Bare mkw41z512
4 LumenRadio MLE N2
5 LumenRadio MWA N2
0x4000 Custom 0
0x4001 Custom 1
0x4002 Custom 2
0x4003 Custom 3

Unrecognized values such as 0xffffffff load the "unknown" configuration by default.

Certificate

The format of the certificate memory area is not public. Unused area must be padded with 0xff.

Type

The second to last uint32_t of the format stores the configuration type in its least significant uint16_t.

value Area type
0 undefined
1 userconfig
2 sysconfig
3 certificate

Version

The second to last uint32_t of the format stores the format version in its most significant uint16_t. Versioning the format is important in order to read older configurations with new firmware.

CRC

The last uint32_t of the area stores the IEEE 802.3 CRC32 of the preceding area.

Content example

As an example, the content of the sysconfig area for a unit configured as a custom module 0 is:

0x10001080: 00 40 00 00 FF FF FF FF FF FF FF FF FF FF FF FF
0x10001090: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x100010A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x100010B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x100010C0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x100010D0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x100010E0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x100010F0: FF FF FF FF FF FF FF FF 02 00 00 00 1B D1 73 D9

00 40 00 00 is the module type for custom module 0 (0x00004000 in little endian).

02 00 is the configuration area type (2 is sysconfig).

00 00 is the configuration format version.

The last four bytes 1B D1 73 D9 are the CRC-32.