[En-Nut-Discussion] Bootloader linker script and startup

Hans Bacher hans at wack-engineering.de
Wed May 27 17:11:13 CEST 2009


Hi Harald, hi Dave,

thank you for the hint. But doesn't remapping RAM to 0x00000000 also mean,
that I have to place all my executable code (segment .text) into RAM either?
This would be very restrictive to maximum application size...

Thanks and regards,

Hans

-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Dave Warren
Gesendet: Mittwoch, 27. Mai 2009 15:57
An: Ethernut User Chat (English)
Betreff: Re: [En-Nut-Discussion] Bootloader linker script and startup

Hi Harald & Hans,

You can make a bootloader for AT91SAM7X, I know, because I have one. As you 
say vecters must be copied to RAM then remapped to 0x0, use

  /* Copy exception vectors into Internal SRAM */
  mov r8, #0x00200000
  ldr r9, =_vectors
  ldmia r9!, {r0-r7}
  stmia r8!, {r0-r7}
  ldmia r9!, {r0-r6}
  stmia r8!, {r0-r6}

  /* Remap Internal SRAM to 0x00000000 */
  ldr r1, =MC_BASE
  ldr r0, =1
  strb r0, [r1, #MC_RCR_OFFSET]

Good luck

regards

Dave

----- Original Message ----- 
From: "Harald Kipp" <harald.kipp at egnite.de>
To: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
Sent: Wednesday, May 27, 2009 2:43 PM
Subject: Re: [En-Nut-Discussion] Bootloader linker script and startup


> Hans Bacher wrote:
>
>> I am trying to compile a Nut/OS project to work with Atmel's layer-based
>> bootloader: "Safe and Secure Bootloader Implementation" (application 
>> notes,
>> AT91SAM7X).
>
> ...
>
>> The bootloader is programmed to flash memory at start address 0x00100000
>> (0x00000000), thus it is executed first when powering the board. The
>> bootloader region is 0x8000 bytes long, therefore the application flashed

>> by
>> the bootloader starts at address 0x00108000.
>
> Hallo Hans,
>
> Most probably the problem is with the runtime initialization
> (crtat91sam7x256_rom.S, actually the included crtat91sam7sex_rom.S), not
> the linker script (at91sam7x256_rom.ld). The system assumes, that its
> interrupt and exception vectors are at 0x00000000. But this location is
> occupied by your boot loader.
>
> I do not the anything about this boot loader, but you need to find a way 
> to
>
> ...either get the vectors of the Nut/OS image to the beginning of the 
> Flash
>
> ...or adapt the Nut/OS interrupts to the boot loader code somehow.
>
> While following the discussions in this list, there had been several
> queries and attempts to create an Ethernet boot loader for the SAM7X.
> AFAIK, without any result. I won't say that it is impossible, but it is
> for sure tricky.
>
> The boot loading on Ethernut 3 was much easier to implement, because RAM
> can be mapped to 0x00000000. In this environment the runtime
> initialization simply copies the vectors from Flash to RAM. (Well, it is
> not that easy, because the code has to be relocatable.)
>
> Harald
>
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion 

_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list