I'm analysing the TI X-Loader code to get a deeper understanding about the omap cortex boot sequence.
I started with the start.S file in the /cpu/omap3 folder. The first lines are as follow:
#include <config.h>
#include <asm/arch/cpu.h>
.globl _start
_start:
b reset
ldr pc, _hang
ldr pc, _hang
ldr pc, _hang
ldr pc, _hang
ldr pc, _hang
ldr pc, _hang
ldr pc, _hang
_hang:
.word do_hang
.word 0x12345678
.word 0x12345678
.word 0x12345678
.word 0x12345678
.word 0x12345678
.word 0x12345678
.word 0x12345678 /* now 16*4=64 */l
.global _end_vect
_end_vect:
The exception vectors (except the Reset Vector) will jump to the address "_hang". But there is no op-code there, but only the address of the label do_hang (found later in the code and which is a dead loop function). My understanding of .word is that it copies the value (in our case the address of do_hang) into that specific location in the binary, in our case at the address "_hang". When the PC is loaded with _hang, program execution jumps to address _hang and there it doesn't finds an op-code but a value which is an address (do_hang).
My questions:
Thanks in advance for your help.
Martin
Ok! I have got it,
the command is LDR PC _hang! It doesn't jumps to _hang but it loads the value in _hang into PC. The value in _hang is the address of the dead loop function do_hang.
One question still remains: why not simply "b do_hang" in each vector? Well, I guess we will never know.
Regards
Martin