Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Wed Mar 03, 2010 12:04 pm 
Offline

Joined: Mon Jul 27, 2009 2:56 pm
Posts: 7
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


Top
 Profile  
 
 Post subject: Re: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Fri Mar 05, 2010 12:37 pm 
Offline

Joined: Mon Jul 27, 2009 2:56 pm
Posts: 7
nobdy experience with bootloaders for sam7 ?


Top
 Profile  
 
 Post subject: Re: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Fri Mar 05, 2010 7:26 pm 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
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


Top
 Profile  
 
 Post subject: Re: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Mon Mar 08, 2010 10:49 am 
Offline

Joined: Mon Jul 27, 2009 2:56 pm
Posts: 7
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))
-->0x108000

My 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.


Top
 Profile  
 
 Post subject: Re: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Mon Mar 08, 2010 10:23 pm 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
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))
-->0x108000

My 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


Top
 Profile  
 
 Post subject: Re: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Tue Mar 09, 2010 12:48 pm 
Offline

Joined: Mon Jul 27, 2009 2:56 pm
Posts: 7
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


Attachments:
File comment: Bootloader Files IAR 5
Bootloader IAR 5.zip [10.07 KiB]
Downloaded 24 times
File comment: Bootloader Files IAR 4
Bootloader IAR4.zip [6.31 KiB]
Downloaded 20 times
File comment: Getting started Project from IAR 5
getting-started-project-at91sam7x-ek.zip [943.09 KiB]
Downloaded 16 times
Top
 Profile  
 
 Post subject: Re: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Fri Mar 12, 2010 10:52 am 
Offline

Joined: Mon Jul 27, 2009 2:56 pm
Posts: 7
No one experiences with Bootloaders and all theses linker & remap settings?


Top
 Profile  
 
 Post subject: Re: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Fri Mar 12, 2010 1:41 pm 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
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


Top
 Profile  
 
 Post subject: Re: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Mon Mar 15, 2010 4:46 pm 
Offline

Joined: Mon Jul 27, 2009 2:56 pm
Posts: 7
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


Attachments:
File comment: Migration Project, not working
Bootloader IAR 5.zip [712.08 KiB]
Downloaded 29 times
File comment: Working Bootloader for IAR V4.42
Kopie von Bootloader IAR 442.zip [716.89 KiB]
Downloaded 14 times
File comment: Getting Started Project
getting-started-project-at91sam7x-ek.zip [927.25 KiB]
Downloaded 17 times
Top
 Profile  
 
 Post subject: Re: Safe and Secure Bootloader Migration to IAR 5
PostPosted: Mon Jan 23, 2012 3:37 pm 
Offline

Joined: Mon Mar 10, 2008 12:48 pm
Posts: 5
Same problem here.
Did you find a solution!?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron