cv | links | blog | quotes | ascii | tgtimes | gopher | mail | rss

Nordic nRF51822

Microcontroller implementing ARM Cortex-M0+ ISA, used by the micro:bit.

Nordic nRF51822 in micro:bit v1.5

SoftDevice S110

Nordic provides compiled code with drivers and MBR+bootloader to put at addresses specified in the .hex file.

It mostly provide the Bluetooth and radio stack, along with some common low-level code for passing execution to the Application.

The specification is mostly about Bluetooth, see Chapter 10, 11 and Appendix A for how SoftDevice works.

The SoftDevice is optional as it is built on top of CMSIS which might be used directly instead.

Interrupts and booting

The execution flow is entirely driven by interrupts, including for starting the first bytes of the Application (aka, Operating System) from bootup.

Each interrupt is caught by the System Vector Table at 0x00000000, which eventually forward it to the Bootloader or SoftDevice, which eventually forward it to the Application.

Forwarding goes through loading the address stored at the Interrupt's position of the Vector Table, then branching at that address.

Booting means having the Reset Handler interrupt triggered, chaining execution up to the application code ISR.

Memory Addresses

See the reference manual (link at the top) for complete overview.

As usual everything is exposed on the same memory address space:

All with some protection mode available for reading and/or writing. The Serial Wire Debugger (SWD) always has access to everything.

0x00000000 - 0x200000000 - Code Memory

0x00000000 - Master Boot Record (MBR) and its Vector Table

Receives interrupts from the hardware.

The MBR only update the bootloader and forward interrupts. It is not changed by upgrades making the MPU safe from bricking.

Interrupts are either caught by the MBR, forwarded to the Bootloader or forwarded to the SoftDevice.

0x00001000 - SoftDevice and its Vector Table

Receives interrupts from the MBR.

The SoftDevice may transfer execution to the application code at if setup with sd_softdevice_vector_table_base_set(APP_CODE_BASE).

Interrupts are either caught or forwarded to the Application.

BOOTLOADERADDR - Bootloader and its Vector Table

Receives interrupts from the MBR or SoftDeivce.

It may be absent, in which case interrupts are only sent to the SoftDeivce.

Interrupts are either caught or forwarded to the Application.

0x00018000 - APP_CODE_BASE - Application and its Vector Table

Receives interrupts from the Bootloader or SoftDevice.

"Application" means operating system here, as it is higher level than hardware and SoftDevice.

The address 0x00018000 is the one showing in the SoftDevice specification#Ch11.2.

0x10000000 - Factory Information Configuration (FICR)

Registers with various internal states and information about this MCU.

0x10001000 - User Information Configuration (UICR)

Registers for controlling various states of this MCU.

Programming the nRF81522

Two APIs are available:

--- #draft