/*
|
*****************************************************************************
|
**
|
** File : xl6600x_flash.ld
|
**
|
** Abstract : Linker script for xl6600x Device with
|
** 256KByte FLASH, 24KByte DRAM
|
**
|
** Set heap size, stack size and stack location according
|
** to application requirements.
|
**
|
** Set memory bank area and size if external memory is used.
|
**
|
** Target : CHIPWAYS xl6600
|
**
|
** Environment : Chipways Code Editor(R)
|
**
|
** Distribution: The file is distributed as is, without any warranty
|
** of any kind.
|
**
|
** (c)Copyright Chipways.
|
** You may use this file as-is or modify it according to the needs of your
|
** project. Distribution of this file (unmodified or modified) is not
|
** permitted. Chipways permit registered Chipways Code Editor(R) users the
|
** rights to distribute the assembled, compiled & linked contents of this
|
** file as part of an application binary file, provided that it is built
|
** using the Chipways Code Editor(R) toolchain.
|
**
|
*****************************************************************************
|
*/
|
|
|
/* Entry Point */
|
ENTRY(Reset_Handler)
|
|
/* Generate a link error if heap and stack don't fit into DRAM */
|
_Min_Heap_Size = DEFINED(__heap_size__) ? __heap_size__ : 0x00000200; /* required amount of heap */
|
_Min_Stack_Size = DEFINED(__stack_size__) ? __stack_size__ : 0x00000400; /* required amount of stack */
|
|
/* Specify the memory areas */
|
MEMORY
|
{
|
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K
|
CRAM (xrw) : ORIGIN = 0x1FFFE800, LENGTH = 6K
|
DRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 18K-0x200
|
FALSH_DRIVER_RAM (xrw):ORIGIN = 0x20004600, LENGTH = 0x100
|
BOOTFLAG (xrw) : ORIGIN = 0x20004700, LENGTH = 0x100
|
|
FLASH_BOOT (rx) : ORIGIN = 0x0000000, LENGTH = 48K
|
FLASH_APP (rx) : ORIGIN = 0x000C100, LENGTH = 256K -48K -8K-0x100
|
FLASH_EEP (rx) : ORIGIN = 0x003E000, LENGTH = 8K /* FALSH EE */
|
|
FLASH_APPL_CRC (rx) : ORIGIN = 0x000C000, LENGTH = 0x100
|
}
|
|
/* Define output sections */
|
SECTIONS
|
{
|
/* no init ram data */
|
.RAMNoInitSector (NOLOAD):
|
{
|
. = ALIGN(8);
|
KEEP(*(.noinit_bootReqFlag)) /* Startup code */
|
. = ALIGN(8);
|
} >BOOTFLAG
|
|
.flashdriver_ram (NOLOAD) : {KEEP(*(.flashdriver_ram))} > FALSH_DRIVER_RAM
|
|
|
/* file define */
|
.filedefine_rom :
|
{
|
. = ALIGN(8);
|
KEEP(*(.filedefine_rom)) /* Startup code */
|
. = ALIGN(8);
|
} >FLASH_APPL_CRC
|
|
/* The startup code goes first into FLASH */
|
.isr_vector :
|
{
|
. = ALIGN(8);
|
KEEP(*(.isr_vector)) /* Startup code */
|
. = ALIGN(8);
|
} >FLASH
|
|
. = ALIGN(8);
|
_falsh_sidata = .;
|
|
/* _falsh_sidata is load memory address*/
|
.flash_ram : AT(_falsh_sidata)
|
{
|
. = ALIGN(8);
|
_flash_start = .;
|
KEEP(*(.flash_ram)) /* flash operation code */
|
. = ALIGN(8);
|
} >DRAM
|
|
/*SIZEOF(.flash_ram) return the size in bytes of flash_ram*/
|
_flash_end1 = SIZEOF(.flash_ram);
|
_flash_end = _flash_start + _flash_end1;
|
|
|
/* The program code and other data goes into FLASH */
|
.text (_falsh_sidata + _flash_end1):
|
{
|
. = ALIGN(8);
|
*(.text) /* .text sections (code) */
|
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
*(.glue_7) /* glue arm to thumb code */
|
*(.glue_7t) /* glue thumb to arm code */
|
|
KEEP (*(.init))
|
KEEP (*(.fini))
|
|
. = ALIGN(8);
|
_etext = .; /* define a global symbols at end of code */
|
} >FLASH_BOOT
|
. = ALIGN(8);
|
.ARM.extab : {
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
. = ALIGN(8);
|
} >FLASH_BOOT
|
|
.ARM : {
|
__exidx_start = .;
|
*(.ARM.exidx*)
|
__exidx_end = .;
|
. = ALIGN(8);
|
} >FLASH_BOOT
|
|
. = ALIGN(8);
|
.ARM.attributes : {
|
*(.ARM.attributes)
|
. = ALIGN(8);
|
} > FLASH_BOOT
|
|
. = ALIGN(8);
|
.preinit_array :
|
{
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
KEEP (*(.preinit_array*))
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
. = ALIGN(8);
|
} >FLASH_BOOT
|
. = ALIGN(8);
|
.init_array :
|
{
|
PROVIDE_HIDDEN (__init_array_start = .);
|
KEEP (*(SORT(.init_array.*)))
|
KEEP (*(.init_array*))
|
PROVIDE_HIDDEN (__init_array_end = .);
|
. = ALIGN(8);
|
} >FLASH_BOOT
|
. = ALIGN(8);
|
.fini_array :
|
{
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
KEEP (*(.fini_array*))
|
KEEP (*(SORT(.fini_array.*)))
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
. = ALIGN(8);
|
} >FLASH_BOOT
|
|
|
|
/* used by the startup to initialize data */
|
. = ALIGN(8);
|
_sidata = .;
|
|
/* Initialized data sections goes into DRAM, load LMA copy after code */
|
.data : AT ( _sidata )
|
{
|
. = ALIGN(8);
|
_sdata = .; /* create a global symbol at data start */
|
*(.data) /* .data sections */
|
*(.data*) /* .data* sections */
|
. = ALIGN(8);
|
_edata = .; /* define a global symbol at data end */
|
} >DRAM
|
/* Uninitialized data section */
|
. = ALIGN(8);
|
.bss :
|
{
|
/* This is used by the startup in order to initialize the .bss secion */
|
_sbss = .; /* define a global symbol at bss start */
|
__bss_start__ = _sbss;
|
*(.bss)
|
*(.bss*)
|
*(COMMON)
|
|
. = ALIGN(8);
|
_ebss = .; /* define a global symbol at bss end */
|
__bss_end__ = _ebss;
|
} >DRAM
|
|
PROVIDE ( end = _ebss );
|
PROVIDE ( _end = _ebss );
|
|
/* User_heap_stack section, used to check that there is enough DRAM left */
|
._user_heap :
|
{
|
. = ALIGN(8);
|
. = . + _Min_Heap_Size;
|
. = ALIGN(8);
|
__HeapLimit = .;
|
} >DRAM
|
|
/* Initializes stack on the end of block */
|
_estack = ORIGIN(DRAM) + LENGTH(DRAM);
|
__StackLimit = _estack - _Min_Stack_Size;
|
__RAM_END = _estack;
|
|
._user_stack __StackLimit :
|
{
|
. = ALIGN(8);
|
__stack_start__ = .;
|
. += _Min_Stack_Size;
|
. = ALIGN(8);
|
__stack_end__ = .;
|
} >DRAM
|
|
ASSERT(__StackLimit >= __HeapLimit, "region DRAM overflowed with stack and heap")
|
|
/* Remove information from the standard libraries */
|
/DISCARD/ :
|
{
|
libc.a ( * )
|
libm.a ( * )
|
libgcc.a ( * )
|
}
|
}
|