| Welcome to AT91SAM Community Forum http://www.at91.com/samphpbb/ |
|
| Safe and Secure Bootloader Migration to IAR 5 http://www.at91.com/samphpbb/viewtopic.php?f=26&t=19028 |
Page 1 of 1 |
| Author: | chrigus [ Wed Mar 03, 2010 12:04 pm ] |
| Post subject: | Safe and Secure Bootloader Migration to IAR 5 |
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 |
|
| Author: | chrigus [ Fri Mar 05, 2010 12:37 pm ] |
| Post subject: | Re: Safe and Secure Bootloader Migration to IAR 5 |
nobdy experience with bootloaders for sam7 ? |
|
| Author: | gerhardf [ Fri Mar 05, 2010 7:26 pm ] |
| Post subject: | Re: Safe and Secure Bootloader Migration to IAR 5 |
hello both startup files do the same, jumping to main() of the bootloader. at main() of the bootloader there is a jump to startup-code of the application. so where is your problem? regards gerhard |
|
| Author: | chrigus [ Mon Mar 08, 2010 10:49 am ] |
| Post subject: | Re: Safe and Secure Bootloader Migration to IAR 5 |
My problem is the following: At the end of the Bootloader I return the following: Code: return (unsigned int) APP_START_ADDRESS; with the following definition: Code: #define APP_START_ADDRESS ((void *)((unsigned int) 0x8000 + (unsigned int) AT91C_IFLASH)) -->0x108000My testapp ist linked to this address: define symbol __ICFEDIT_region_ROM_start__ = 0x108000; But it never jumps to this location. The testapp will not start. |
|
| Author: | gerhardf [ Mon Mar 08, 2010 10:23 pm ] |
| Post subject: | Re: Safe and Secure Bootloader Migration to IAR 5 |
chrigus wrote: My problem is the following: At the end of the Bootloader I return the following: Code: return (unsigned int) APP_START_ADDRESS; with the following definition: Code: #define APP_START_ADDRESS ((void *)((unsigned int) 0x8000 + (unsigned int) AT91C_IFLASH)) -->0x108000My testapp ist linked to this address: define symbol __ICFEDIT_region_ROM_start__ = 0x108000; But it never jumps to this location. The testapp will not start. did you ever check the compiler list file what assembler code is produced for this line? did you ever try to debug this piece of code? regards gerhard |
|
| Author: | chrigus [ Tue Mar 09, 2010 12:48 pm ] | ||||
| Post subject: | Re: Safe and Secure Bootloader Migration to IAR 5 | ||||
Hi Gerhard thanks for you replies. I already debugged the Project. I also saw the returning value of 0x18000 in the register r0 after leaving main() and jumping back to cstartup.s. But the programm never arrived there, instead it jumped into the __exit() assembler part. I tried to load the getting_started_project with the old bootloader. But it was not starting, so there must be a problem too. I don't know if it has something to do with de remap and the interrupt verctors? In the end everything should work between the different versions. In the attachement are all the relevant files. Perhaps you want to know what's this all for: I need possibility to make in-field updates over Ethernet. For this we have a Ethernet-SPI chip on our Hardware (Wiznet) So if the Basic bootloader stuff will work, I can start to adapt it to SPI. Thanks for your help Chris
|
|||||
| Author: | chrigus [ Fri Mar 12, 2010 10:52 am ] |
| Post subject: | Re: Safe and Secure Bootloader Migration to IAR 5 |
No one experiences with Bootloaders and all theses linker & remap settings? |
|
| Author: | gerhardf [ Fri Mar 12, 2010 1:41 pm ] |
| Post subject: | Re: Safe and Secure Bootloader Migration to IAR 5 |
hello, if you could post a whole project we would be able to help you. "Bootloader IAR 5.zip" and "Bootloader IAR4.zip" doesn't contain all of the workbench file. getting-started-project-at91sam7x-ek.zip has some strange directories included (esp. for thr .icf file). regards gerhard |
|
| Author: | chrigus [ Mon Mar 15, 2010 4:46 pm ] | ||||
| Post subject: | Re: Safe and Secure Bootloader Migration to IAR 5 | ||||
Hy I saw, there were some strange Pathes. IAR seems to have problems with absolute and relative Pathes, by drag an drop Files against adding them over Add..-> Files. Hope I fixed now theses Problems. Here are the 3 full Projects for comparing. I'm not really too deep in the lowlevel initialisations and Assembler stuff. Thanks Chris
|
|||||
| Author: | sig [ Mon Jan 23, 2012 3:37 pm ] |
| Post subject: | Re: Safe and Secure Bootloader Migration to IAR 5 |
Same problem here. Did you find a solution!? |
|
| Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|



Forum