Home
General Guide
Register File
Boot Sequence
BLDC Motor FOC
Serial Comm Driver
Flash Driver
NVRAM Driver
RVDT Driver
Renesas
Microchip
Texas Instruments
Analog Devices
Mobile Devices
.NET Tips
Miscellaneous
Contact Us
Forum
Embedded Program Boot Sequence 

The diagram below shows a typical boot sequence of embedded programs.


                              

 

Usually, CPU starts from address 0, fewer CPUs start from the bottom of their program memory. No matter where it starts, the first instruction must be the reset vector address that points to the start of the entire program. Either the C/C++ compiler provides a bootup (aka startup) routine, or you need to create your own bootup routine, the contents of a bootup routine shall be similar to the table shown above.

One thing worth mentioning is the vector table, which lists all of the interrupt vectors of a CPU that supports. The number of vectors ranges from a few to more than 100 depending on the complexity of the CPU. The interrupt vector is the start address of its respective interrupt service routine (ISR). When an interrupt occurs, the current program counter (PC) register value will be pushed to the stack, and the respective interrupt vector will be loaded to the PC register, which means the next execution will be at the beginning of the ISR. The vector table is possibly relocatable to other area of the program memory. When would you need to relocate the vector table? The reason could be various. One of the cases is that you want to have a bootloader programmed into the memory so that application code can be downloaded via a serial port or USB port in field. To do so the vector base register must be initialized to the start address of the relocated vector table area and the vector table must be copied there, right at the step 1 of the boot sequence.

Second thing is the RAM self test. A real project usually requires RAM self test to check if any defective area exists. If any defective RAM is found, the application shall indicate an error. The RAM self test shall be executed before it is used. Therefore, the best place to do so is at the beginning of step 4 of the boot sequence before the RAM is used, rather than doing so in a C function after main() is called, because some RAM locations might have been used in main(). Click here to see an example of RAM self test routine, which was executed at the beginning of step 4, i.e., before data initialization, in the boot sequence in a real world application.