|
|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
* @file gcc_arm.ld
|
|
|
|
|
* @brief GNU Linker Script for Cortex-M based device
|
|
|
|
|
* @version V2.0.0
|
|
|
|
|
* @date 21. May 2019
|
|
|
|
|
* @version V1.1.0
|
|
|
|
|
* @date 04. August 2020
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
|
|
|
|
|
* Copyright (c) 2009-2020 Arm Limited. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*
|
|
|
|
|
@ -21,17 +21,86 @@
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
#include "mem_ARMCM0.h"
|
|
|
|
|
|
|
|
|
|
__STACK_SIZE = 0x2000;
|
|
|
|
|
__HEAP_SIZE = 0x50000;
|
|
|
|
|
/*
|
|
|
|
|
*-------- <<< Use Configuration Wizard in Context Menu >>> -------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* memory regions are:
|
|
|
|
|
secure ROM: 0x10000000
|
|
|
|
|
non-secure ROM: 0x00000000
|
|
|
|
|
|
|
|
|
|
secure RAM: 0x30000000
|
|
|
|
|
non-secure RAM: 0x20000000
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*---------------------- Flash Configuration ----------------------------------
|
|
|
|
|
<h> Flash Configuration
|
|
|
|
|
<o0> Flash Base Address <0x0-0xFFFFFFFF:8>
|
|
|
|
|
<o1> Flash Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
|
|
|
|
</h>
|
|
|
|
|
-----------------------------------------------------------------------------*/
|
|
|
|
|
__ROM_BASE = 0x00000000;
|
|
|
|
|
__ROM_SIZE = 0x00110000;
|
|
|
|
|
|
|
|
|
|
/*--------------------- Embedded RAM Configuration ----------------------------
|
|
|
|
|
<h> RAM Configuration
|
|
|
|
|
<o0> RAM Base Address <0x0-0xFFFFFFFF:8>
|
|
|
|
|
<o1> RAM Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
|
|
|
|
</h>
|
|
|
|
|
-----------------------------------------------------------------------------*/
|
|
|
|
|
__RAM_BASE = 0x20000000;
|
|
|
|
|
__RAM_SIZE = 0x00100000;
|
|
|
|
|
|
|
|
|
|
/*--------------------- Stack / Heap Configuration ----------------------------
|
|
|
|
|
<h> Stack / Heap Configuration
|
|
|
|
|
<o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
|
|
|
|
<o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
|
|
|
|
</h>
|
|
|
|
|
-----------------------------------------------------------------------------*/
|
|
|
|
|
__STACK_SIZE = 0x00002000;
|
|
|
|
|
__HEAP_SIZE = 0x00050000;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*-------------------- <<< end of configuration section >>> -------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
MEMORY
|
|
|
|
|
{
|
|
|
|
|
ITCM (rx) : ORIGIN = 0x00000000, LENGTH = 512K
|
|
|
|
|
DTCM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
|
|
|
|
DTCM2 (xrw) : ORIGIN = 0x20020000, LENGTH = 384K
|
|
|
|
|
FLASH (rx) : ORIGIN = __ROM_BASE, LENGTH = __ROM_SIZE
|
|
|
|
|
RAM (rwx) : ORIGIN = __RAM_BASE, LENGTH = __RAM_SIZE
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Linker script to place sections and symbol values. Should be used together
|
|
|
|
|
* with other linker script that defines memory regions FLASH and RAM.
|
|
|
|
|
* It references following symbols, which must be defined in code:
|
|
|
|
|
* Reset_Handler : Entry of reset handler
|
|
|
|
|
*
|
|
|
|
|
* It defines following symbols, which code can use without definition:
|
|
|
|
|
* __exidx_start
|
|
|
|
|
* __exidx_end
|
|
|
|
|
* __copy_table_start__
|
|
|
|
|
* __copy_table_end__
|
|
|
|
|
* __zero_table_start__
|
|
|
|
|
* __zero_table_end__
|
|
|
|
|
* __etext
|
|
|
|
|
* __data_start__
|
|
|
|
|
* __preinit_array_start
|
|
|
|
|
* __preinit_array_end
|
|
|
|
|
* __init_array_start
|
|
|
|
|
* __init_array_end
|
|
|
|
|
* __fini_array_start
|
|
|
|
|
* __fini_array_end
|
|
|
|
|
* __data_end__
|
|
|
|
|
* __bss_start__
|
|
|
|
|
* __bss_end__
|
|
|
|
|
* __end__
|
|
|
|
|
* end
|
|
|
|
|
* __HeapLimit
|
|
|
|
|
* __StackLimit
|
|
|
|
|
* __StackTop
|
|
|
|
|
* __stack
|
|
|
|
|
*/
|
|
|
|
|
ENTRY(Reset_Handler)
|
|
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
|
@ -61,7 +130,7 @@ SECTIONS
|
|
|
|
|
*(.rodata*)
|
|
|
|
|
|
|
|
|
|
KEEP(*(.eh_frame*))
|
|
|
|
|
} > ITCM
|
|
|
|
|
} > FLASH
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* SG veneers:
|
|
|
|
|
@ -78,30 +147,32 @@ SECTIONS
|
|
|
|
|
.ARM.extab :
|
|
|
|
|
{
|
|
|
|
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
|
|
|
|
} > ITCM
|
|
|
|
|
} > FLASH
|
|
|
|
|
|
|
|
|
|
__exidx_start = .;
|
|
|
|
|
.ARM.exidx :
|
|
|
|
|
{
|
|
|
|
|
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
|
|
|
|
} > ITCM
|
|
|
|
|
} > FLASH
|
|
|
|
|
__exidx_end = .;
|
|
|
|
|
|
|
|
|
|
.copy.table :
|
|
|
|
|
{
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
|
__copy_table_start__ = .;
|
|
|
|
|
|
|
|
|
|
LONG (__etext)
|
|
|
|
|
LONG (__data_start__)
|
|
|
|
|
LONG (__data_end__ - __data_start__)
|
|
|
|
|
LONG ((__data_end__ - __data_start__) / 4)
|
|
|
|
|
|
|
|
|
|
/* Add each additional data section here */
|
|
|
|
|
/*
|
|
|
|
|
LONG (__etext2)
|
|
|
|
|
LONG (__data2_start__)
|
|
|
|
|
LONG (__data2_end__ - __data2_start__)
|
|
|
|
|
LONG ((__data2_end__ - __data2_start__) / 4)
|
|
|
|
|
*/
|
|
|
|
|
__copy_table_end__ = .;
|
|
|
|
|
} > ITCM
|
|
|
|
|
} > FLASH
|
|
|
|
|
|
|
|
|
|
.zero.table :
|
|
|
|
|
{
|
|
|
|
|
@ -110,18 +181,19 @@ SECTIONS
|
|
|
|
|
/* Add each additional bss section here */
|
|
|
|
|
/*
|
|
|
|
|
LONG (__bss2_start__)
|
|
|
|
|
LONG (__bss2_end__ - __bss2_start__)
|
|
|
|
|
LONG ((__bss2_end__ - __bss2_start__) / 4)
|
|
|
|
|
*/
|
|
|
|
|
__zero_table_end__ = .;
|
|
|
|
|
} > DTCM
|
|
|
|
|
} > FLASH
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Location counter can end up 2byte aligned with narrow Thumb code but
|
|
|
|
|
* __etext is assumed by startup code to be the LMA of a section in RAM
|
|
|
|
|
* which must be 4byte aligned
|
|
|
|
|
* which must be 4byte aligned
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
.data :
|
|
|
|
|
__etext = ALIGN (4);
|
|
|
|
|
|
|
|
|
|
.data : AT (__etext)
|
|
|
|
|
{
|
|
|
|
|
__data_start__ = .;
|
|
|
|
|
*(vtable)
|
|
|
|
|
@ -141,7 +213,6 @@ SECTIONS
|
|
|
|
|
KEEP(*(.init_array))
|
|
|
|
|
PROVIDE_HIDDEN (__init_array_end = .);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
|
/* finit data */
|
|
|
|
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
|
|
|
|
@ -154,9 +225,7 @@ SECTIONS
|
|
|
|
|
/* All data end */
|
|
|
|
|
__data_end__ = .;
|
|
|
|
|
|
|
|
|
|
} > ITCM AT > DTCM
|
|
|
|
|
|
|
|
|
|
__etext = ADDR(.data);
|
|
|
|
|
} > RAM
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Secondary data section, optional
|
|
|
|
|
@ -189,7 +258,7 @@ SECTIONS
|
|
|
|
|
*(COMMON)
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
|
__bss_end__ = .;
|
|
|
|
|
} > DTCM2
|
|
|
|
|
} > RAM AT > RAM
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Secondary bss section, optional
|
|
|
|
|
@ -218,21 +287,19 @@ SECTIONS
|
|
|
|
|
. = . + __HEAP_SIZE;
|
|
|
|
|
. = ALIGN(8);
|
|
|
|
|
__HeapLimit = .;
|
|
|
|
|
} > DTCM2
|
|
|
|
|
} > RAM
|
|
|
|
|
PROVIDE(__HeapBase = __end__);
|
|
|
|
|
|
|
|
|
|
.stack (ORIGIN(DTCM2) + LENGTH(DTCM2) - __STACK_SIZE) (COPY) :
|
|
|
|
|
.stack (ORIGIN(RAM) + LENGTH(RAM) - __STACK_SIZE) (COPY) :
|
|
|
|
|
{
|
|
|
|
|
. = ALIGN(8);
|
|
|
|
|
__StackLimit = .;
|
|
|
|
|
. = . + __STACK_SIZE;
|
|
|
|
|
. = ALIGN(8);
|
|
|
|
|
__StackTop = .;
|
|
|
|
|
} > DTCM2
|
|
|
|
|
} > RAM
|
|
|
|
|
PROVIDE(__stack = __StackTop);
|
|
|
|
|
|
|
|
|
|
/* Check if data + heap + stack exceeds DTCM2 limit */
|
|
|
|
|
ASSERT(__StackLimit >= __HeapLimit, "region DTCM2 overflowed with stack")
|
|
|
|
|
/* Check if data + heap + stack exceeds RAM limit */
|
|
|
|
|
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|