2020-01-07 10:44 AM
Hello,
I am trying to add s RAM section at the end of the RAM to save
some data (states) between warm reboots, when the watchdog kicks due some
wiring problems (i2c).
I changed the ld file as:
/* LD file ... */
/* _estack = 0x20028000; -- taken out */
_estack = 0x20027800; /* new stack - 2K */
//...
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 158K /* was 160 now is - 2K */
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
AUXRAM (rx) : ORIGIN = 0x1FFFF800, LENGTH = 0x800 /* use 2 K */
}
/// then later on at the end.
.my_ram : {
KEEP(*(.my_ram))
} > AUXRAM
/* Remove information from the standard libraries */
The program wont start.
I hangs in the startup file here:
The start hang here. Anything else I am missing.
The intend is to access it in C like
uint32_t ram_end __attribute__((section (".my_ram"))) ;
static void* __attribute__((optimize("O0"))) _ram_storage(void)
{
void* ptr = (void*)&ram_end;
return ptr;
}
Thank you,
... addon
sometime this pops up from atolic
Solved! Go to Solution.
2020-01-07 11:46 AM
something like
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x200 ; /* required amount of heap */
_Min_Stack_Size = 0x400 ; /* required amount of stack */
AUXLEN = 2K;
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 160K-AUXLEN
AUX (xrw) : ORIGIN = ORIGIN(RAM) + LENGTH(RAM) LENGTH = AUXLEN
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
}
2020-01-07 10:49 AM
The AUXRAM can't be below 0x20000000, you're recovering from the END of memory
The Stack moves downward, so the base for both stack and auxram should be 0x20027800
2020-01-07 11:46 AM
something like
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x200 ; /* required amount of heap */
_Min_Stack_Size = 0x400 ; /* required amount of stack */
AUXLEN = 2K;
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 160K-AUXLEN
AUX (xrw) : ORIGIN = ORIGIN(RAM) + LENGTH(RAM) LENGTH = AUXLEN
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
}
2020-01-07 11:53 AM
RESOLVED !
Many thanks.
This solved my problem.
... and the elegance of the provided code. Thank you again.