cancel
Showing results for 
Search instead for 
Did you mean: 

How to Use a Variable in SRAM to Communicate between Bootloader and Application

Chao
Senior

Hi,

I have a bootloader for my application, at the moment they exchange their working status by flash write. I think a better way is to declare a variable in RAM with the same address in both bootloader and application. Someone mentioned, in a post, that the linker script could be used for this, but didn't give an example.

Anybody could do me a favour and show me an example ? Thanks.

11 REPLIES 11

Using the first 4 bytes is a very nice solution. The last question is: does the SRAM start at 0x20000000 for all STM32 MCUs ?

For the SRAMs used for data they start at 0x20000000. This is basically linked to the ARM specification and performance: need to refer to Cortex-Mx TRMs.

Example from Cortex M3 trm:

SofLit_0-1725886845394.png

 

But some other SRAMs start at 0x0 for example ITCM (Tightly Coupled Memory) for F7 and H7 families. In any case, you need to check each STM32 part number datasheet. 

If your original question has been answered, please mark the solution the reply that answered your original question.

Thank you.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.