2024-09-05 07:13 AM
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.
2024-09-05 07:18 AM - edited 2024-09-05 07:24 AM
@Chao wrote:
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.
Using __attribute . See this link: https://www.openstm32.org/Using%2BCCM%2BMemory
2024-09-05 07:40 AM
Maybe we require info how working status you mean... And most simple method to share is move start RAM +somethink for example 0x20000020 and use direct pointers to 0-1F arrea.
2024-09-05 07:54 AM - edited 2024-09-05 07:55 AM
Yes @MM..1 it could be also a solution.
#define COMMON_VAR_ADDRESS 0x2000XXXX /* Define a common RAM address */
uint32_t* common_var = (uint32_t*)COMMON_VAR_ADDRESS; /* Declare a pointer at that address */
*common_var = y; /* access to that address */