cancel
Showing results for 
Search instead for 
Did you mean: 

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

RRama.8
Associate II
 
1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee

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

View solution in original post

2 REPLIES 2

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Erwan YVIN
ST Employee

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