Hi,
I'm using the AT91SAM7X-EK with a AT91SAM7X256.
I made some tests with the "safe and secure" bootloader from the Atmel page, which works fine under IAR 4.4x.
Now i'm trying to migrate the bootloader to IAR 5x.
I modified the *.xcl Linkerfile to *.icf of the Bootloader to put it in appropriate range.
This works fine by looking at the memory.
My problem is to modify the cstartup file that it jumps to the right address.
cstartup.s79 of IAR 4x:
Code:
?jump_to_main:
LDR r0, =main
MOV lr, pc
__main:
BX r0
;-- Check that the memory has not been remapped (if debugging in RAM)
;-- Try to modify the first dword in RAM, see if value @ 0x0 changes too
int_ram_start EQU SFB(INTRAMSTART_NOREMAP)
LDR r1, =int_ram_start
LDR r2, =0
LDR r3, [r2]
ADD r4, r3, #1
STR r4, [r1]
LDR r5, [r2]
STR r3, [r1]
CMP r4, r5
BNE __jump
;-- Readjust PC and undo remap
ADD r1, pc, r1
BX r1
LDR r1, =AT91C_BASE_MC
LDR r2, =AT91C_MC_RCB
STR r2, [r1, #MC_RCR]
;-- Jump to application (starting address should be in r0, returned by main)
__jump:
BX r0
New Basic CStartup file is the File of the getting-started-project.
Code:
/* Branch to main() */
LDR r0, =?main
MOV lr, pc
BX r0
/* BX r0*/ <---- ??
How do I have to modify it, that it accepts the returning address of the Application Main()?
Code:
return (unsigned int) 0x108000; //Jump to Application Address
Has someone already modified this bootloader for my Board configuration or has a own bootloader solution?
I would be very thankful.
Chris