cancel
Showing results for 
Search instead for 
Did you mean: 

Run code from RAM

alessandro2
Associate III
Posted on May 26, 2017 at 10:21

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 #spc56
1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee
Posted on May 30, 2017 at 15:06

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

View solution in original post

7 REPLIES 7
Erwan YVIN
ST Employee
Posted on May 30, 2017 at 15:06

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

Posted on May 30, 2017 at 22:54

Hello Erwan,

thank you for your reply.

Perhaps I'm missing something...

I have SPC5Studio v5.3.1 (just updated)

0690X00000607BAQAY.png

I looked among the exaples avilable for SPC56DXX but I couldn't find the one you mentioned (the pciture below shows what I get)

0690X00000607CIQAY.png

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__ = .;

} > ram

Am I doing something wrong?

Thank you.

Regards

Alessandro

Erwan YVIN
ST Employee
Posted on May 31, 2017 at 10:38

Hello Alessandro ,

Could you install HAL components from the Official Update Site ?

Help ==> Install new Software

  Best regards

                 Erwan

Posted on June 07, 2017 at 18:10

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6sT&d=%2Fa%2F0X0000000bx7%2FXqV.o_YESEolCylsH0SAxFT.ugHvT1GMrwHb3mTEK.4&asPdf=false
Posted on June 07, 2017 at 19:25

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 status

Can 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

Posted on June 08, 2017 at 09:41

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

Posted on June 08, 2017 at 15:10

Hello Alessandro ,

for the jump issue in free-gcc,

use -mlongcall option in Common options

   Best Regards

      Erwan