Function placed in RAM - assembler warnings

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Function placed in RAM - assembler warnings

1,672 Views
amprel
Contributor I

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

Labels (1)
0 Kudos
Reply
2 Replies

1,460 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Alessandro,

I've gone ahead and tried to replicate the behavior you are experiencing. I tried the different examples in the document you are referring to and I'm not achieving the same warnings that you are. I am currently using KDS v 3.2.0 and the TWR-K60D100M.

I attached the project I created so you can use it as reference and see if you get the warnings with it.

Let me know the results.

Sabina

0 Kudos
Reply

1,460 Views
amprel
Contributor I

Hello Sabina,

Sorry for my belated reply and thank you for your help.

It looks like that the two warnings are caused by the name of the section, i.e. .relocate_code. If I change it to something else, e.g. .special_code, the warnings disappear (as in your project, where the section is called .myRAM - I actually recompiled your code after changing .myRAM into .relocate_code and, bang, I got the warnings).

Is .relocate_code a reserved nome ?

Thank you

Alex

0 Kudos
Reply