2015-09-28 05:11 AM
Hello Forum members,
I am trying to implement a Function On RAM But i did not find any thing on st Refrences.
I found this example in freescale but spcstudio can not compile the code . __declspec(section ''.text_in_ram'') static void EnterStandbyFromSRAM(void) { /* Switch off the IRC fast */ ME.STANDBY0.B.IRCON = 0; /* keep flashes power off in DRUN */ ME.DRUN.B.DFLAON = 0b01; ME.DRUN.B.CFLAON = 0b01; /* configure fast wakeup from backup SRAM */ RGM.STDBY.R = 0x0080; ME.MCTL.R = 0xD0005AF0; /* Enter STANDBY0 Mode & Key */ ME.MCTL.R = 0xD000A50F; /* Enter STANDBY0 Mode & Inverted Key */ /* it is recommended to poll S_MTRANS after requesting */ /* STOP, HALT or STANDBY modes */ while(1 == ME.GS.B.S_MTRANS) { } } Thanks Best Regards Nazerian Vanima2015-10-01 08:30 AM
Hello Vanima ,
first declare your section attribute :__attribute__ ((section (
''.codeinram''
)))
void
function_in_ram()
{
.....
}
update your application.ld :
.codeinram : ONLY_IF_RO
{
KEEP(*(.codeinram))
} > ram
/* before heap_base *§
__heap_base__ = __bss_end__;
__heap_end__ = __ram_end__;
In my case , the function is well in RAM.
Best regards
Erwan
2015-10-02 10:29 PM
Hi Dear Erwan
Thanks So much For Solving about this issue . I saw application.ld and do know any refrence about this file ? Like what is this file and how can write my own application.ld . Best Regards Nazerian Vanima2015-10-02 10:56 PM
Hi Erwan
I compile the code but how can i find the code correctly is in ram ? Best Regards Nazerian Vanima2015-10-03 12:44 AM
Hi Erwan
I have Some Problems with using the code : 1.Compiling the code is very slow and when the compile is finish the out.bin file size is 1GB !!! 2.when the program want to run the function break detect in program. I attach my code and appliction.ld for you , if there is any thing wrong Please let me know about this .2015-10-05 01:02 AM
Hello Vanima ,
I have reproduced your issuethe binary file is 1GBi am checking why ? Best regards Erwan2015-10-05 03:24 AM
Hi Erwan
thanks so much i wait for your answer . could you see my code is there any thing wrong in my code for RAM function ? Please let me know about the standby mode i can not solve this issue yet . Best Regards Nazerian Vanima2015-10-06 02:10 AM
.data : AT(__romdata_start__)
{
. = ALIGN(4);
__data_start__ = .;
*(.codeinram)
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
__sdata_start__ = . + 0x8000;
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
__data_end__ = .;
} > ram
Remove :
.codeinram : ONLY_IF_RO
{
KEEP(*(.codeinram))
} > ram
your code stays valid.
warning ,
Update application.ld after generation the code make all Compiling hal.c In file included from ./components/portable_spc5_hal_component/lib/include/hal.h:32:0, from ./components/portable_spc5_hal_component/lib/src/hal.c:25: ./components/spc560bcxx_hal_drivers_component/lib/include/hal_lld.h:704:2: error: #error ''SPC5_FMPLL0_CLK outside acceptable range (0...SPC5_FMPLL0_CLK_MAX)'' make: *** [build/obj/hal.o] Error 1 Best regards Erwan