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

Hans Bacher info at hb-webdesign.de
Thu May 28 10:52:09 CEST 2009


Hello Dave,

I tried the following: I left the sections .vectors, .init0, ..., .init5 in
rom and I tried to add an exception vector "place holder" section into ram
at address 0x200000 before the default .data section. I added your code to
copy the exception vectors from rom to ram (thanks for that) into the place
holder at address 0x200000, into .init1 section right after the '_start'
label. After copying the vector table I immediately remap the sram to 0x0.

The result after compiling & linking is a binary of about 2MB size, but it
should only be about 26K.
I have tried several modifications to the linker script file and the section
definitions within the past hours, but none of it worked. I really would
like to know, what I am doing wrong.

Dave, would it be possible somehow to send me your working linker script and
startup file (to hans at wack-engineering.de)?? It would really be great,
because slowly but surely I don't have got any more ideas what modification
to try...

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 17:54
An: Ethernut User Chat (English)
Betreff: Re: [En-Nut-Discussion] Bootloader linker script and startup

Hans,

Link executable to flash, only vectors have to be in RAM.

regards

Dave

----- Original Message ----- 
From: "Hans Bacher" <hans at wack-engineering.de>
To: "'Ethernut User Chat (English)'" <en-nut-discussion at egnite.de>
Sent: Wednesday, May 27, 2009 4:11 PM
Subject: Re: [En-Nut-Discussion] Bootloader linker script and startup


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

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

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



__________ Hinweis von ESET Smart Security, Signaturdatenbank-Version 4110
(20090528) __________

E-Mail wurde geprüft mit ESET Smart Security.

http://www.eset.com


 

__________ Hinweis von ESET Smart Security, Signaturdatenbank-Version 4111
(20090528) __________

E-Mail wurde geprüft mit ESET Smart Security.

http://www.eset.com
 




More information about the En-Nut-Discussion mailing list