EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Bootloader - main apllication shared variables

Started by John van Beurden October 29, 2008
Hi,

I'm working with an LPC2131 in the Keil compiler.
I've made two projects, a bootloader project and a main application.
I want to make use of a shared variables to have the two apps
communicate with each other.
I'm able to create a variable on a fixed address using the following
code:

TE_SHARED shared __attribute__((section(".ARM.__at_0x40000000")));

So both applications read and write to the same address for the
variable. But for some reason the variable is always cleared during
initialisation. The map file states that it is NOT part of ZI.
I've tried the NOINIT flag in the configuration menu but this has no
effect.
I think I'm missing something.

greetings
John

An Engineer's Guide to the LPC2100 Series

Hi, John.

I do the same communication between bootloader and application.
I also tried to use NOINIT attribute, but it didnt work, I dont
know why.

Anyway, I actually use the last 32 bytes from RAM for my LPC2368,
that are "reserved" for IAP functions stack, AFAIK. As I dont use IAP
from the moment bootloader puts a message in RAM and application gets
it, I thought I could reuse this memory. In Target configuration, for
me, it is:

IRAM1: Start 0x40000000; Size 0x7FE0(instead of 0x8000)

By the way, I use two U32 for a bitflag message. One is the
complement of the other, so I can check if its not just garbage in RAM.

Best regards,
_____________________________
Ivan Amancio


--- In l..., "John van Beurden"
wrote:
>
> Hi,
>
> I'm working with an LPC2131 in the Keil compiler.
> I've made two projects, a bootloader project and a main application.
> I want to make use of a shared variables to have the two apps
> communicate with each other.
> I'm able to create a variable on a fixed address using the following
> code:
>
> TE_SHARED shared __attribute__((section(".ARM.__at_0x40000000")));
>
> So both applications read and write to the same address for the
> variable. But for some reason the variable is always cleared during
> initialisation. The map file states that it is NOT part of ZI.
> I've tried the NOINIT flag in the configuration menu but this has no
> effect.
> I think I'm missing something.
>
> greetings
> John
>

Ivan,

I actual almost did the same.
I created a variable in a separate file:

__attribute__((zero_init)) TE_SHARED shared __attribute__((section
(".ARM.__at_0x40001F00")));

using the memory configuration a created two sections
default 0x40000000 size: 0x1F00
0x40001F00 size: 0x0100 (NO_INIT)

This seems to work for me.

Best regards,
John van Beurden

--- In l..., "mxfxluder28" wrote:
>
> Hi, John.
>
> I do the same communication between bootloader and application.
> I also tried to use NOINIT attribute, but it didnt work, I dont
> know why.
>
> Anyway, I actually use the last 32 bytes from RAM for my LPC2368,
> that are "reserved" for IAP functions stack, AFAIK. As I dont use
IAP
> from the moment bootloader puts a message in RAM and application
gets
> it, I thought I could reuse this memory. In Target configuration,
for
> me, it is:
>
> IRAM1: Start 0x40000000; Size 0x7FE0(instead of 0x8000)
>
> By the way, I use two U32 for a bitflag message. One is the
> complement of the other, so I can check if its not just garbage in
RAM.
>
> Best regards,
>
>
> _____________________________
> Ivan Amancio
>
>
> --- In l..., "John van Beurden"
> wrote:
> >
> > Hi,
> >
> > I'm working with an LPC2131 in the Keil compiler.
> > I've made two projects, a bootloader project and a main
application.
> > I want to make use of a shared variables to have the two apps
> > communicate with each other.
> > I'm able to create a variable on a fixed address using the
following
> > code:
> >
> > TE_SHARED shared __attribute__((section(".ARM.__at_0x40000000")));
> >
> > So both applications read and write to the same address for the
> > variable. But for some reason the variable is always cleared
during
> > initialisation. The map file states that it is NOT part of ZI.
> > I've tried the NOINIT flag in the configuration menu but this has
no
> > effect.
> > I think I'm missing something.
> >
> > greetings
> > John
>

The 2024 Embedded Online Conference