AnsweredAssumed Answered

How can a bootloader and application share RAM-variables?

Question asked by arnold_w on Jun 18, 2015
Latest reply on Jun 18, 2015 by Clive One
I am working with the Discovery development board STM32F407 microcontroller and building using Eclipse/GNU. My project has a bootloader and an application and I would like to have a variable in RAM that both the bootloader and the application can access and pass information to each other. I tried to tell the linker that the RAM is smaller than it actually is and then store my variable in the "outside" area:

MEMORY
{
  /* Pretend that the RAM is only 127 kByte even though in reality it is 128 kByte */
  RAM (xrw)          : ORIGIN = 0x20000000, LENGTH = 127K
  CCMRAM (xrw)       : ORIGIN = 0x10000000, LENGTH = 64K
  .
  .
  .
}

// Store a variable in the RAM area the linker doesn't think exist
*((uint32_t*) (127 * 1024 + 16)) = 0xAABBCCDD;

However, it doesn't work, I seem to always read 0xFFFFFFFF, even if I store it in bootloader mode and immediately read it in bootloader mode again. Can anybody please help me?

Outcomes