Hi,
You can reference the code in this post. Note that if the function running in RAM calls softdevice functions or other functions located in flash inside, you will not save much current by running code from RAM, as these functions will still be executed from flash.
Best regards,
Jørgen
This error seems to occur because the RAM function does calls to functions in flash. See this answer from RK. Like I said, you will not gain much in terms of current consumption when doing this with short functions that does call to existing SDK/Softdevice functions. It only makes sense if you have standalone functions doing heavy calculation, keeping the CPU running for long periods of time.
can we run soft device form ram instead of flash?
and i am trying to run our code from ram instead of flash in nrf52840. in linker file we create one section like this
MEMORY
{
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xda000
RAM (rwx) : ORIGIN = 0x20003bb8, LENGTH = 0x9000
NO_INIT (rwx) : ORIGIN = 0x20009000, LENGTH = 0x2400000
}
SECTIONS
{
}
SECTIONS
{
.no_init (NOLOAD):
{
PROVIDE(__start_no_init_data = .);
KEEP(*(SORT(.no_init*)))
PROVIDE(__stop_no_init_data = .);
} > NO_INIT
}
__attribute__((used, long_call, section(".no_init"))) void main(void)
{
ble_init();
}
code is succesfully build but in jlink we dont see any print msg and nrf connect dont see my device name . can u suggest me how can i run our main fxn in ram instead of flash
No, the softdevice comes as a precompiled binary, it is not linked in the application, and it is built to be located in flash.
ok thanks
can the application run from ram and linked with soft device ? because soft device run from ram so i am confused. can those be linked
can the application run from ram and linked with soft device ? because soft device run from ram so i am confused. can those be linked
sorry soft device run from flash.