Hi Alice,
I've created a very simple project to test the ram function but still failed, see attached. It was created by CW10.7.
Changes are made according to the article https://community.nxp.com/docs/DOC-101433
(Due to company policy I cannot send you our project, sorry for this.)
Also, I just paste codes here for easy discussion, it's very simple.
********* my code *******************************************
word Value;
void RAM_Func(word * val);
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
Value=0;
for(;;){
RAM_Func(&Value);
}
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END main */
__attribute__ ((section(".ramfunc"))) void RAM_Func(word * val) //The RAM function
{
(* val)++;
return;
}
********* Changes in linker setting file ProcessorExpert.ld *******************************************
/* Initialized data sections goes into RAM, load LMA copy after code */
.data : AT(___ROM_AT)
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
*(.ramfunc) /* My newly defined RAM function area */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} > m_data
Thanks.