I am trying to locate code partially in flash and partially in RAM.
I found AN4329 which explains how to do it.
There are two ways to do it:
- #pragma section xxx begin / end
I copied the code examples from AN4329 into main.c and into the lcf-file of an empty bareboard project.
With the __declspec() I get a compiler error "illegal type qualifier(s)", both in the function prototype and in the function itself.
Interestingly, in the kinetis_sysinit.c, __declspec() is used to tie the exception table to the vectortable section.
I can compile kinetis_sysinit.c without problems.
This is contary to AN4329, as it says that it is not possible to use __declspec() to relocate data (page 9).
When I tried the #pragma version, I was able to compile and link. But the code is placed into the .text section as usual, ignoring my section directive. I can see this in the xmap file. The function which I want to relocate is where it would normally be, and in the memory map I see that the section which should hold the function is empty (size=0).