CodeWarrior Linker Command File (LCF) for Kinetis - Freescale ...
CodeWarrior Linker Command File (LCF) for Kinetis - Freescale ...
CodeWarrior Linker Command File (LCF) for Kinetis - Freescale ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Creating an <strong>LCF</strong> <strong>for</strong> a Sample ROM Project<br />
* (.data)<br />
.= ALIGN(0x4) ;<br />
*(.ARM.extab)<br />
.= ALIGN(0x4) ;<br />
__exception_table_start__ = .;<br />
EXCEPTION<br />
__exception_table_end__ = .;<br />
.= ALIGN(0x4) ;<br />
__sinit__ = .;<br />
STATICINIT<br />
.= ALIGN(0x8) ;<br />
} > m_data<br />
The first line contains the instruction AT with the label ___ROM_AT as parameter. This means that the<br />
content of section .app_data is going to be resident in the flash address pointed by label ___ROM_AT.<br />
Then, the startup code per<strong>for</strong>ms a routine to copy this data from Flash to RAM using the in<strong>for</strong>mation<br />
provided in section .romp. This routine can be found in the startup.c file.<br />
The uninitialized data placed in RAM following the m_data.<br />
Listing 5. Section .bss<br />
.bss :<br />
{<br />
.= ALIGN(0x4) ;<br />
__START_BSS = .;<br />
* (.bss)<br />
__END_BSS = .;<br />
.= ALIGN(0x8) ;<br />
} >> m_data<br />
Listing 6. Section .app_data<br />
_romp_at = ___ROM_AT + SIZEOF(.app_data);<br />
.romp : AT(_romp_at)<br />
{<br />
__S_romp = _romp_at; /* structure address used to copy ROM to RAM, if 0 there is no ROM<br />
to RAM copy */<br />
WRITEW(___ROM_AT); /* start address of .app_data in ROM */<br />
WRITEW(ADDR(.app_data)); /*Address of .app_data in RAM, where the data need to be copied */<br />
WRITEW(SIZEOF(.app_data));<br />
WRITEW(0);<br />
WRITEW(0);<br />
WRITEW(0);<br />
}<br />
NOTE The section details are provided in MCU_<strong>Kinetis</strong>_Compiler.pdf.<br />
The sections are allocated to segments in the order given in SECTIONS block of lcf file.<br />
Variables are added in <strong>LCF</strong> and these can be used in application as well as internally in linker tool <strong>for</strong><br />
computation.<br />
<strong>CodeWarrior</strong> <strong>Linker</strong> <strong>Command</strong> <strong>File</strong> (<strong>LCF</strong>) <strong>for</strong> <strong>Kinetis</strong> Application Note<br />
4 <strong>Freescale</strong> Semiconductor