AnsweredAssumed Answered

Function placed in RAM - assembler warnings

Question asked by alessandro carozzi on Feb 25, 2019
Latest reply on Mar 7, 2019 by alessandro carozzi

Hello everybody,

I'm using KDS 3.0.0 and the micro is Kinetis K10. I need to place a function in RAM (and of course run it from there!)

As suggested in the application notes "Relocating Code and Data Using the KDS GCC Linker File (.ld) for Kinetis" and AN4695 "Avoiding Read-While-Write Errors When Developing In-Software Flash Programming Applications for Kinetis and ColdFire+ MCUs", I declared my function as this:

 

void RAMFunc(void) __attribute__((section(".relocate_code"), long_call));

...

void __attribute__((section(".relocate_code"), long_call)) RAMFunc(void)
{
   // Do something
}

 

and I modified the linker file accordingly:

 

.data : AT(__DATA_ROM)
{
. = ALIGN(4);
__DATA_RAM = .;
__data_start__ = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
*(.relocate_code)
KEEP(*(.jcr*))
. = ALIGN(4);
__data_end__ = .; /* define a global symbol at data end */
} > m_data

 

The problem is, when I build the project I get these two warnings in the intermediate assembler files:

 

Warning: setting incorrect section type for .relocate_code
Warning: setting incorrect section attributes for .relocate_code

 

What should I do to fix them? Whether I specify long_call or not in the __attribute__ directive doesn't make any difference. The project actually works (i.e. the function gets placed in RAM and it works as aspected), but still I'd like to understand the reason of such warnings.

 

Any help is appreciated.

Alex

Outcomes