Skip to main content
RRama.8
Associate II
June 27, 2019
Solved

how to compile code on a particular address.i have to write the application for that or i can use some tools for that.

  • June 27, 2019
  • 2 replies
  • 935 views

..

    This topic has been closed for replies.
    Best answer by Erwan YVIN

    Hello ,

    You can create your own linker file (user.ld) and use __attribute__

    __attribute__ ((section (".codeinram"))) void gotoStandbyMode(void) {
     
    	WKUP.WISR.R = 0x00000008;		//Clear interrupt flag
     
    	if ((ME.GS.B.S_CURRENTMODE < SPC5_RUNMODE_RUN3)
    	 || (ME.GS.B.S_CURRENTMODE > SPC5_RUNMODE_RUN0)) {
    	 if (OSAL_FAILED == halSPCSetRunMode(SPC5_RUNMODE_STANDBY)) {
    	 SPC5_CLOCK_FAILURE_HOOK();
    	 }
    	 }
    }
     
    __attribute__ ((section (".codeinram"))) void gotoRunMode(void)
    {
    	 if (OSAL_FAILED == halSPCSetRunMode(SPC5_RUNMODE_DRUN)) {
    	 SPC5_CLOCK_FAILURE_HOOK();
    	 }
    }

    Best Regards

    Erwan

    2 replies

    Tesla DeLorean
    Guru
    June 27, 2019

    That's usually the function of the LINKER

    A Linker Script would define memory regions and names of sections

    The compiler would use attribute or #pragma to flag to the linker the section names the user has provided.

    Where the tools lack I've built linkers and object file manipulation/translation apps.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Erwan YVIN
    Erwan YVINBest answer
    ST Employee
    June 28, 2019

    Hello ,

    You can create your own linker file (user.ld) and use __attribute__

    __attribute__ ((section (".codeinram"))) void gotoStandbyMode(void) {
     
    	WKUP.WISR.R = 0x00000008;		//Clear interrupt flag
     
    	if ((ME.GS.B.S_CURRENTMODE < SPC5_RUNMODE_RUN3)
    	 || (ME.GS.B.S_CURRENTMODE > SPC5_RUNMODE_RUN0)) {
    	 if (OSAL_FAILED == halSPCSetRunMode(SPC5_RUNMODE_STANDBY)) {
    	 SPC5_CLOCK_FAILURE_HOOK();
    	 }
    	 }
    }
     
    __attribute__ ((section (".codeinram"))) void gotoRunMode(void)
    {
    	 if (OSAL_FAILED == halSPCSetRunMode(SPC5_RUNMODE_DRUN)) {
    	 SPC5_CLOCK_FAILURE_HOOK();
    	 }
    }

    Best Regards

    Erwan