Flash Target Example

A new user defined memory section .data2 needs to be created in the application using #pragma define_section.

#pragma define_section data2Section ".data2" far_abs RW

__declspec(data2Section) char buffer2[0xFF]={1234};

void foo(){}

A new memory segment m_data2 is created at 0x20000000 and the new memory section .data2 is placed is m_data2.

K70FN1M0_flash.lcf

# Default linker command file.

MEMORY {

m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000001E8

m_text (RX) : ORIGIN = 0x00000800, LENGTH = 0x00080000-0x00000800

m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000

m_data2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000 // The new memory segment created

m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010

}

...

...

...

___m_data2_ROMStart = ___m_data_ROMStart + SIZEOF(.app_data);

.app_data2 : AT(___m_data2_ROMStart)

{

. = ALIGN (0x4);

*(.data2) /* User defined section placed in the new memory segment*/

. = ALIGN (0x4);

} > m_data2