Total Pageviews

Thursday 25 July 2013

The CPU comes out of reset and fetches it's first opcode at some address that is native to the CPU type. Whether the code at that address exists intentionally, makes sense, or is a bootloader, it will be executed. The writer of a bootloader (or any other code that is intended to execute from reset) must create code that is either location independent, or is linked to be executable at the reset vector address. The code must then be stored in some manner that causes it to be executable when the CPU comes out of reset. This may involve burning to some kind of PROM, storing in flash memory using something like a JTAG programmer, or may be mask programmed by the CPU manufacturer. As I understand it, the latter is common with some ARM processors these days.
In order for a bootloader to execute, all of these things must be assembled correctly (and I use the term 'assemble' intentionally to include all of the related meanings). The CPU doesn't 'know' about a bootloader; it just executes code. The programmer and system designer know about the bootloader and the CPU reset vector addressing.