2017-05-26 01:21 AM
Hello I'm working with SPC56EL60L3, and SPC5STUDIO v5.0.
I need to have a section of code running from RAM, a function more specifically.
How do I do this in SPC5Studio? I guess I need to add a directive like:
__attribute__ ((section ('.ram_code')))
before the function declaration, where ram_code is the defined in the linker script.
Could you, please, provide an example?
Thank you.
Regards
Alessandro
#spc5studio #ram #code #spc56Solved! Go to Solution.
2017-05-30 06:06 AM
Hello Alessandro ,
Yes , we have some example in SPC5Studio
you have to customize application.ld by creating your own linker file : user.ld
An example has been provided in Application Wizard for SPC560Dxx family
SPC560Dxx OS-Less STANDBY SRAM Test Application for Discovery
Best regards
Erwan
2017-05-30 06:06 AM
Hello Alessandro ,
Yes , we have some example in SPC5Studio
you have to customize application.ld by creating your own linker file : user.ld
An example has been provided in Application Wizard for SPC560Dxx family
SPC560Dxx OS-Less STANDBY SRAM Test Application for Discovery
Best regards
Erwan
2017-05-30 03:54 PM
Hello Erwan,
thank you for your reply.
Perhaps I'm missing something...
I have SPC5Studio v5.3.1 (just updated)
I looked among the exaples avilable for SPC56DXX but I couldn't find the one you mentioned (the pciture below shows what I get)
Anyway, supposing my function is called myFun, think I need to have something like:
__attribute__ ((section (''.ram_code''))) void myFun( void )
{
/* code here */
}
where ram_code is a section defined somewhere in the linker file, doing something like:
.ram_code 0xADDRESSHERE : ALIGN(16) SUBALIGN(16)
{ __ram_code__ = .; *(.ram_code) *(.ram_code.*) KEEP(*(.ram_code)) __ram_code_end__ = .; } > ramAm I doing something wrong?
Thank you.
Regards
Alessandro
2017-05-31 01:38 AM
Hello Alessandro ,
Could you install HAL components from the Official Update Site ?
Help ==> Install new Software
Best regards
Erwan
2017-06-07 11:10 AM
2017-06-07 12:25 PM
In the meanwhile I tried to something like example, in my code.
I got a function declared like this:
__attribute__ ((section ('.ramcode'))) static int32_t CoreFlashIntegrityTest( void )
The section 'ramcode' is defined in the linker file, as per the spc5Studio example.
When I build the project I get this error message, from the linker:
core_test.c:(.text_vle.CorePost+0x30):error: relocation truncated to fit: R_PPC_VLE_REL24 against `.ramcode'
collect2: ld returned 1 exit statusCan anyone tell me what's going on, here?
I've done a litlle web-search and it looks like it's not able to fullfil my request of placing the code to RAM, since the section address does not fit in the number fof bits reserved for address displacement (24, in this case..)
I have no clues on how to fix this, anyway..
Thank you.
Regards
Alessandro
2017-06-08 02:41 AM
Hello Alessandro ,
It is just a compiler installation issue.
There is process_begin: CreateProcess(NULL, ppc-vle-gcc .. FAILED)
because you are trying to use hightec compiler not installed on your SPC5Studio
you can reswitch to ppc-free-vle. (free gcc)
Best Regards
Erwan
2017-06-08 08:10 AM
Hello Alessandro ,
for the jump issue in free-gcc,
use -mlongcall option in Common options
Best Regards
Erwan