6.3. Program description

Program execution begins in Startup.s. The processor loads its stack pointer and vectors from the __Vectors table, which starts at address 0. Execution branches to __main in the C library, which sets up the stack, and initializes global variables. When these program initializations are complete, program execution branches to the main() function in Blinky.c.

In main(), there is only one call, that is, os_sys_init (init). This initializes the RTX operating system and then branches to the init() task, which is also located in Blinky.c.

init() creates the blinking() task, waits for 500 ticks then sets a flag, normal_mode. The normal_mode flag is a signal to the blinking() task to create the lights() task. The blinking() task executes for 500 ticks, after which lights() is executed forever.

blinking() blinks the lights as follows:

lights() iterates through the following states:

Copyright © 2008 ARM Limited. All rights reserved.ARM DUI 0430A