I am using CW10.3 for MK20xx.
I have created a library where in specific code is to be placed in RAM.
Before creating the library I had a test program created using PE and have used the code as follows
Header file contents
#pragma define_section relocate_code ".relocate_code" ".relocate_code" ".relocate_code" far_abs RW
#define __relocate_code__ __declspec(relocate_code)
File.C
__relocate_code__
UINT32 FlashCommandSequence (PFLASH_SSD_CONFIG PSSDConfig, \
UINT8 index, \
UINT8* pCommandArray)
{
. . . .
}
and the linker file ProcessorExpert.Lcf contains
KEEP_SECTION { .vectortable }
KEEP_SECTION { .cfmconfig }
KEEP_SECTION { .relocate_code }
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00004000, LENGTH = 0x000001E0
m_text (RX) : ORIGIN = 0x00004400, LENGTH = 0x0003AC00
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_programbuff (RW) : ORIGIN = 0x14000000, LENGTH = 0x00001000
}
|
|
.relocate_code :
{
* (.relocate_code)
. = ALIGN (0x4);
} > m_programbuff
This worked perfectly all right for me.
After testing is done I created library (*.a) where this "FlashCommandSequence" function is used internally by a library function.
As there is no LCF file in the library project. I am wondering how to place the code in RAM so that when this library is linked to another project by me end user the code is placed in RAM.
Rgds
Uday