1/*
2 * FreeRTOS V202212.00
3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 * this software and associated documentation files (the "Software"), to deal in
7 * the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * https://www.FreeRTOS.org
23 * https://github.com/FreeRTOS
24 *
25 */
26
27MEMORY
28{
29    FLASH (xr) : ORIGIN = 0x00000000, LENGTH = 4M /* to 0x00003FFF = 0x007FFFFF*/
30    RAM (xrw)  : ORIGIN = 0x20000000, LENGTH = 4M /* to 0x21FFFFFF = 0xFFFFFF */
31}
32ENTRY(Reset_Handler)
33
34_Min_Heap_Size = 0x40000 ;        /* Required amount of heap. */
35_Min_Stack_Size = 0x4000 ;       /* Required amount of stack. */
36M_VECTOR_RAM_SIZE = (16 + 48) * 4;
37_estack = ORIGIN(RAM) + LENGTH(RAM);
38
39SECTIONS
40{
41
42    .isr_vector :
43    {
44        __vector_table = .;
45        KEEP(*(.isr_vector))
46        . = ALIGN(4);
47    } > FLASH
48
49    .text :
50    {
51        . = ALIGN(4);
52        *(.text*)
53        KEEP (*(.init))
54        KEEP (*(.fini))
55        KEEP(*(.eh_frame))
56        *(.rodata*)
57        . = ALIGN(4);
58        _etext = .;
59    } > FLASH
60
61	.ARM.extab :
62	{
63		. = ALIGN(4);
64		*(.ARM.extab* .gnu.linkonce.armextab.*)
65		. = ALIGN(4);
66	} >FLASH
67
68	.ARM :
69	{
70		. = ALIGN(4);
71		__exidx_start = .;
72		*(.ARM.exidx* .gnu.linkonce.armexidx.*)
73		__exidx_end = .;
74		. = ALIGN(4);
75	} >FLASH
76
77    .interrupts_ram :
78    {
79        . = ALIGN(4);
80        __VECTOR_RAM__ = .;
81        __interrupts_ram_start__ = .;
82        . += M_VECTOR_RAM_SIZE;
83        . = ALIGN(4);
84        __interrupts_ram_end = .;
85
86    } > RAM
87
88    _sidata = LOADADDR(.data);
89
90    .data : /* AT ( _sidata ) */
91    {
92        . = ALIGN(4);
93        _sdata = .;
94        *(.data*)
95        . = ALIGN(4);
96        _edata = .;
97    } > RAM AT > FLASH
98
99    .uninitialized (NOLOAD):
100    {
101        . = ALIGN(32);
102        __uninitialized_start = .;
103        *(.uninitialized)
104        KEEP(*(.keep.uninitialized))
105        . = ALIGN(32);
106        __uninitialized_end = .;
107    } > RAM
108
109    .bss :
110    {
111        . = ALIGN(4);
112        _sbss = .;
113        __bss_start__ = _sbss;
114        *(.bss*)
115        *(COMMON)
116        . = ALIGN(4);
117        _ebss = .;
118        __bss_end__ = _ebss;
119    } >RAM
120
121    .heap :
122    {
123        . = ALIGN(8);
124        PROVIDE ( end = . );
125        PROVIDE ( _end = . );
126        _heap_bottom = .;
127        __heap_start = .;
128        . = . + _Min_Heap_Size;
129        _heap_top = .;
130        __heap_end = .;
131        . = . + _Min_Stack_Size;
132        . = ALIGN(8);
133    } >RAM
134
135   /* Set stack top to end of RAM, and stack limit move down by
136    * size of stack_dummy section */
137   __StackTop = ORIGIN(RAM) + LENGTH(RAM);
138   __StackLimit = __StackTop - _Min_Stack_Size;
139   PROVIDE(__stack = __StackTop);
140
141  /* Check if data + heap + stack exceeds RAM limit */
142  ASSERT(__StackLimit >= _heap_top, "region RAM overflowed with stack")
143}
144
145