How an mbed program starts up

This took a lot of forensics to figure it all out, may as well put where others might find it useful. It is possible that there are errors in this page. If you see something that is incorrect, please let me know.
The nRF51822 platforms is used as the example.

Top level view

The mbed online compiler is the same compiler that is part of the Keil MDK system. Mbed depends on the same run-time libraries. Most of the messy details (and extensive compiler options) are not available in the mbed compile environment, and for most mbed user needs, this is fine.

When looking for details of standard library functions (such as sin() , rand() ) or how data types are stored, the MDK documentation is the reference to turn to. I haven't seen this explicitly stated in any of the normal mbed documentation. Maybe I'm wrong about this.

Files involved in the startup process
(and a bit more)

  • nRF51822.sct
  • startup_nRF51822.s
  • sys.cpp
  • system_nrf51.c
  • retarget.cpp
  • PinNames.h
  • device.h
  • nrf51.h

Tasks to be performed

  • Load 0x00000003 into on-chip RAM power control registers RAMON and RAMONB . This enables power to the on-chip RAM when the processor is in System On mode.
  • Call SystemInit()
  • Jump to __main()

Release of the Reset signal

Explanation goes here

SystemInit()

Explanation goes here

__main()

Explanation goes here

How code can be inserted between the
end of startup and calling main()

Explanation goes here

The mystery of how printf() works

  • How is the UART initialized Explanation goes here
  • How is the generic printf() connected to hardware specific serial port Explanation goes here
  • How do I change the baud for the printf() UART

Memory Model

Description and diagrams that explain the Memory Model


Please log in to post comments.