Use of both UART's

View: New views
8 Messages — Rating Filter:   Alert me  

Use of both UART's

by Prasad.Nagapati :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello Everyone,

I am using the Borad version 1.3 H,

In this I want to use both the UART's in my application, but when I saw
UART application code I observed that it is using UART0 as the port, but
if I connect the UART0 to the COM1 of my host PC nothing is coming
(UART0 is also JTAG port in the board), but if I connect to the UART1 in
the board all messages are displayed in the host PC!! How this is
possible?

Please help me how to use both the UART's in my application.

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

Bootloader linker script and startup

by Hans Bacher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

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

I am developing with Atmel's AT91SAM7X256-EK and I flashed the bootloader to
the board. Two sample programs are provided with the bootloader itself. One
example uses interrupt vector table remapping(??), the other one doesn't.
The bootloader works fine with both programs. Unfortunately the bootloader
and the sample applications have been developed using IAR compiler, and the
fact that both only compile with IAR Workbench compiler version 4.4x is even
worse...

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.

Because IAR startup scripts and linker files differ quite a lot from their
Nut/OS correspondences, I do not know what to change within the
linker/startup script to get the Nut/OS application to run after being
flashed by the botloader. I have changed the rom start address in
at91sam7x256_rom.ld to 0x00008000, but apparently this doesn't suffice,
because the board freezes after exiting the bootloader trying to jump to the
Nut/OS application program.

Can anybody tell me what changes I have to make? Do I need this interrupt
vector remapping??

Thanks and regards,

Hans Bacher
 

__________ Hinweis von ESET Smart Security, Signaturdatenbank-Version 4108
(20090527) __________

E-Mail wurde gepruft mit ESET Smart Security.

http://www.eset.com
 

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

Re: Bootloader linker script and startup

by Ethernut :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Bootloader linker script and startup

by Dave Warren :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
To: "Ethernut User Chat (English)" <en-nut-discussion@...>
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

Re: Bootloader linker script and startup

by Hans Bacher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
[mailto:en-nut-discussion-bounces@...] 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@...>
To: "Ethernut User Chat (English)" <en-nut-discussion@...>
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

Re: Bootloader linker script and startup

by Dave Warren :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hans,

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

regards

Dave

----- Original Message -----
From: "Hans Bacher" <hans@...>
To: "'Ethernut User Chat (English)'" <en-nut-discussion@...>
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@...
[mailto:en-nut-discussion-bounces@...] 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@...>
To: "Ethernut User Chat (English)" <en-nut-discussion@...>
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

Re: Bootloader linker script and startup

by Ethernut :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Warren wrote:
> 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

You're right. I overlooked that internal RAM of the SAM devices can be
mapped to address zero in any case. Sorry for the confusion.

Harald

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

Parent Message unknown Re: Bootloader linker script and startup

by Hans Bacher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...)?? 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@...
[mailto:en-nut-discussion-bounces@...] 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@...>
To: "'Ethernut User Chat (English)'" <en-nut-discussion@...>
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@...
[mailto:en-nut-discussion-bounces@...] 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@...>
To: "Ethernut User Chat (English)" <en-nut-discussion@...>
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
 

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