This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Information Retained in RAM Over Reboot



Hello,

I am attempting to pass information between two separate applications that run on my T28035 micro (and we also do the same on a T28027). There is a bootloader and a main application installed on the micro, in different flash sectors. The bootloader runs at startup, and is responsible for launching and/or upgrading the main application. When the user requests to upgrade, the application writes information into RAM and then resets. When the bootloader runs after startup, it will read that information and know that it must do an upgrade instead of just launching the currently installed application.

We define a special place in RAM to store this information, in the F28035.cmd file. Here is the code from the cmd file:

BL_DATA : origin = 0x008000, length = 0x0A /* data to exchange with the bootloader */
BL_DATA_CRC : origin = 0x00800A, length = 0x01

BootloaderData : > BL_DATA, PAGE = 1
BootloaderDataCRC : > BL_DATA_CRC, PAGE = 1


In the code itself we define the data like this:

// global data exchanged with the application
#pragma DATA_SECTION(nodeIdFromApplication, "BootloaderData")
uchar nodeIdFromApplication;
#pragma DATA_SECTION(applicationPassword, "BootloaderData")
uchar applicationPassword[9];
#pragma DATA_SECTION(bootloaderDataCRC, "BootloaderDataCRC")
Uint16 bootloaderDataCRC;

In my testing this works fine. I notice that other areas of RAM are cleared after reboot, but this specially defined section seems to be retained. My question is, can we depend on the information being available after the reset, or is this a dangerous thing to rely on? If it is not reliable, is there any other recommended way to store information over reset?

Thanks for any advice.

Janice

  • Well I believe this cannot be relied on. Other variables that are cleared are because a c compiler generally creates code to clear off variables when the processor boots.

    A controller during a rest goes through reset states, the buses rest and so does the internal registers. It is sort of indeterminate state that finally ends up in to a stable known state e.g. all GPIOs are loaded with a default value and so are rest of the registers. In case the RAM is external one can take rely on its data, but if the RAM is inside the controller, I would say there are many unknowns, the data path, the control path etc.

    Usually an external eeprom is used for such data storage, real time clocks (RTCs) that provide calender and date and time also have a small battery back storage.

    I have used scratch pad flash inside an arm processor for the purpose. So it is up to you to decide what suits u