Hi,
I'm having trouble running code from NAND. I've used Eclipse and
CodeSourcery as my SDK.
I've looked at the 2440init.s file supplied with the mini2440 board.
So I've adapted the code and taken the following steps to load and run from
NAND:
- set handlers
- switch off wtd, interrupts
- configure clock
- configure memory controls
- initialise stacks
- copy code from NAND
The following code however I don't understand:
adr r0, ResetEntry
ldr r2, BaseOfROM
cmp r0, r2
ldreq r0, TopOfROM
beq InitRam
ldr r3, TopOfROM
0
ldmia r0!, {r4-r7}
stmia r2!, {r4-r7}
cmp r2, r3
bcc %B0
sub r2, r2, r3
sub r0, r0, r2
InitRam
ldr r2, BaseOfBSS
ldr r3, BaseOfZero
0
cmp r2, r3
ldrcc r1, [r0], #4
strcc r1, [r2], #4
bcc %B0
mov r0, #0
ldr r3, EndOfBSS
1
cmp r2, r3
strcc r0, [r2], #4
bcc %B1
ldr pc, =%F2 ;goto compiler address
I'm assuming this remaps to RAM? The baseofROM values equate to
|Image$$RO$$Base|, how would this work out in GNU Arm assembler?
I tried putting in direct values:
adr r0, _reset
ldr r2,0x0 @baseofROM/RObase
cmp r0, r2
ldreq r0, 0x30000000 @topofROM/ROlimit
beq InitRam
ldr r3, 0x30000000 @topofROM
but it throws up errors:
bad immediate value for offset (805305776)
or
internal_relocation (type: OFFSET_IMM) not fixed up
Any suggestions would be great at this point!
Thanks!

