whitedog
whitedog

Reputation: 95

keil arm - how to share variable between bootloader and user app

Keil ARM uVision4, Processor LPC1768 Is is possible to share a variable at a defined location in memory for bootloader and user app to set/view this variable?

Upvotes: 1

Views: 1267

Answers (1)

embedded_guy
embedded_guy

Reputation: 1977

It is possible, but you have to setup your memory space correctly.

One solution is to setup a section of memory in your Scatter-loading Description file so that the memory will not be initialized by going between the boot and the application. For example, you could setup a section called NoInit by setting aside a segment of memory -

RW_IRAM0 0x100000000 UNINIT 0x0000001F {
    *(NoInit)
}

Then in both your boot and application you could define a variable that resides in that space:

static unsigned long system_flags __attribute((section("NoInit"), zero_init));

Hope that helps to put you on the right track!

Upvotes: 1

Related Questions