Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 M_VECTOR_RAM_SIZE = 0x400;
lypinator 0:bb348c97df44 2
lypinator 0:bb348c97df44 3 /* With the RTOS in use, this does not affect the main stack size. The size of
lypinator 0:bb348c97df44 4 * the stack where main runs is determined via the RTOS. */
lypinator 0:bb348c97df44 5 STACK_SIZE = 0x400;
lypinator 0:bb348c97df44 6
lypinator 0:bb348c97df44 7 /* This is the guaranteed minimum available heap size for an application. When
lypinator 0:bb348c97df44 8 * uVisor is enabled, this is also the maximum available heap size. The
lypinator 0:bb348c97df44 9 * HEAP_SIZE value is set by uVisor porters to balance the size of the legacy
lypinator 0:bb348c97df44 10 * heap and the page heap in uVisor applications. */
lypinator 0:bb348c97df44 11 HEAP_SIZE = 0x6000;
lypinator 0:bb348c97df44 12
lypinator 0:bb348c97df44 13 #if !defined(MBED_APP_START)
lypinator 0:bb348c97df44 14 #define MBED_APP_START 0x08000000
lypinator 0:bb348c97df44 15 #endif
lypinator 0:bb348c97df44 16
lypinator 0:bb348c97df44 17 #if !defined(MBED_APP_SIZE)
lypinator 0:bb348c97df44 18 #define MBED_APP_SIZE 2048k
lypinator 0:bb348c97df44 19 #endif
lypinator 0:bb348c97df44 20
lypinator 0:bb348c97df44 21 /* Specify the memory areas */
lypinator 0:bb348c97df44 22 MEMORY
lypinator 0:bb348c97df44 23 {
lypinator 0:bb348c97df44 24 VECTORS (rx) : ORIGIN = MBED_APP_START, LENGTH = 0x400
lypinator 0:bb348c97df44 25 FLASH (rx) : ORIGIN = MBED_APP_START + 0x400, LENGTH = MBED_APP_SIZE - 0x400
lypinator 0:bb348c97df44 26 CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
lypinator 0:bb348c97df44 27 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 192k
lypinator 0:bb348c97df44 28 }
lypinator 0:bb348c97df44 29
lypinator 0:bb348c97df44 30 /* Linker script to place sections and symbol values. Should be used together
lypinator 0:bb348c97df44 31 * with other linker script that defines memory regions FLASH and RAM.
lypinator 0:bb348c97df44 32 * It references following symbols, which must be defined in code:
lypinator 0:bb348c97df44 33 * Reset_Handler : Entry of reset handler
lypinator 0:bb348c97df44 34 *
lypinator 0:bb348c97df44 35 * It defines following symbols, which code can use without definition:
lypinator 0:bb348c97df44 36 * __exidx_start
lypinator 0:bb348c97df44 37 * __exidx_end
lypinator 0:bb348c97df44 38 * __etext
lypinator 0:bb348c97df44 39 * __data_start__
lypinator 0:bb348c97df44 40 * __preinit_array_start
lypinator 0:bb348c97df44 41 * __preinit_array_end
lypinator 0:bb348c97df44 42 * __init_array_start
lypinator 0:bb348c97df44 43 * __init_array_end
lypinator 0:bb348c97df44 44 * __fini_array_start
lypinator 0:bb348c97df44 45 * __fini_array_end
lypinator 0:bb348c97df44 46 * __data_end__
lypinator 0:bb348c97df44 47 * __bss_start__
lypinator 0:bb348c97df44 48 * __bss_end__
lypinator 0:bb348c97df44 49 * __end__
lypinator 0:bb348c97df44 50 * end
lypinator 0:bb348c97df44 51 * __HeapLimit
lypinator 0:bb348c97df44 52 * __StackLimit
lypinator 0:bb348c97df44 53 * __StackTop
lypinator 0:bb348c97df44 54 * __stack
lypinator 0:bb348c97df44 55 * _estack
lypinator 0:bb348c97df44 56 */
lypinator 0:bb348c97df44 57 ENTRY(Reset_Handler)
lypinator 0:bb348c97df44 58
lypinator 0:bb348c97df44 59 SECTIONS
lypinator 0:bb348c97df44 60 {
lypinator 0:bb348c97df44 61 .isr_vector :
lypinator 0:bb348c97df44 62 {
lypinator 0:bb348c97df44 63 __vector_table = .;
lypinator 0:bb348c97df44 64 KEEP(*(.isr_vector))
lypinator 0:bb348c97df44 65 . = ALIGN(4);
lypinator 0:bb348c97df44 66 } > VECTORS
lypinator 0:bb348c97df44 67
lypinator 0:bb348c97df44 68 /* Note: The uVisor expects this section at a fixed location, as specified
lypinator 0:bb348c97df44 69 * by the porting process configuration parameter:
lypinator 0:bb348c97df44 70 * FLASH_OFFSET. */
lypinator 0:bb348c97df44 71 __UVISOR_FLASH_OFFSET = 0x400;
lypinator 0:bb348c97df44 72 __UVISOR_FLASH_START = ORIGIN(VECTORS) + __UVISOR_FLASH_OFFSET;
lypinator 0:bb348c97df44 73 .text __UVISOR_FLASH_START :
lypinator 0:bb348c97df44 74 {
lypinator 0:bb348c97df44 75 /* uVisor code and data */
lypinator 0:bb348c97df44 76 . = ALIGN(4);
lypinator 0:bb348c97df44 77 __uvisor_main_start = .;
lypinator 0:bb348c97df44 78 *(.uvisor.main)
lypinator 0:bb348c97df44 79 __uvisor_main_end = .;
lypinator 0:bb348c97df44 80
lypinator 0:bb348c97df44 81 *(.text*)
lypinator 0:bb348c97df44 82
lypinator 0:bb348c97df44 83 KEEP(*(.init))
lypinator 0:bb348c97df44 84 KEEP(*(.fini))
lypinator 0:bb348c97df44 85
lypinator 0:bb348c97df44 86 /* .ctors */
lypinator 0:bb348c97df44 87 *crtbegin.o(.ctors)
lypinator 0:bb348c97df44 88 *crtbegin?.o(.ctors)
lypinator 0:bb348c97df44 89 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
lypinator 0:bb348c97df44 90 *(SORT(.ctors.*))
lypinator 0:bb348c97df44 91 *(.ctors)
lypinator 0:bb348c97df44 92
lypinator 0:bb348c97df44 93 /* .dtors */
lypinator 0:bb348c97df44 94 *crtbegin.o(.dtors)
lypinator 0:bb348c97df44 95 *crtbegin?.o(.dtors)
lypinator 0:bb348c97df44 96 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
lypinator 0:bb348c97df44 97 *(SORT(.dtors.*))
lypinator 0:bb348c97df44 98 *(.dtors)
lypinator 0:bb348c97df44 99
lypinator 0:bb348c97df44 100 *(.rodata*)
lypinator 0:bb348c97df44 101
lypinator 0:bb348c97df44 102 KEEP(*(.eh_frame*))
lypinator 0:bb348c97df44 103 } > FLASH
lypinator 0:bb348c97df44 104
lypinator 0:bb348c97df44 105 .ARM.extab :
lypinator 0:bb348c97df44 106 {
lypinator 0:bb348c97df44 107 *(.ARM.extab* .gnu.linkonce.armextab.*)
lypinator 0:bb348c97df44 108 } > FLASH
lypinator 0:bb348c97df44 109
lypinator 0:bb348c97df44 110 __exidx_start = .;
lypinator 0:bb348c97df44 111
lypinator 0:bb348c97df44 112 .ARM.exidx :
lypinator 0:bb348c97df44 113 {
lypinator 0:bb348c97df44 114 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
lypinator 0:bb348c97df44 115 } > FLASH
lypinator 0:bb348c97df44 116 __exidx_end = .;
lypinator 0:bb348c97df44 117
lypinator 0:bb348c97df44 118 __etext = .;
lypinator 0:bb348c97df44 119 _sidata = .;
lypinator 0:bb348c97df44 120
lypinator 0:bb348c97df44 121 .interrupts_ram :
lypinator 0:bb348c97df44 122 {
lypinator 0:bb348c97df44 123 . = ALIGN(4);
lypinator 0:bb348c97df44 124 __VECTOR_RAM__ = .;
lypinator 0:bb348c97df44 125 __interrupts_ram_start__ = .; /* Create a global symbol at data start */
lypinator 0:bb348c97df44 126 *(.m_interrupts_ram) /* This is a user defined section */
lypinator 0:bb348c97df44 127 . += M_VECTOR_RAM_SIZE;
lypinator 0:bb348c97df44 128 . = ALIGN(4);
lypinator 0:bb348c97df44 129 __interrupts_ram_end__ = .; /* Define a global symbol at data end */
lypinator 0:bb348c97df44 130 } > RAM
lypinator 0:bb348c97df44 131
lypinator 0:bb348c97df44 132 /* uVisor own memory and private box memories
lypinator 0:bb348c97df44 133 /* Note: The uVisor expects this section at a fixed location, as specified
lypinator 0:bb348c97df44 134 by the porting process configuration parameter: SRAM_OFFSET. */
lypinator 0:bb348c97df44 135 __UVISOR_SRAM_OFFSET = 0x0;
lypinator 0:bb348c97df44 136 __UVISOR_SRAM_START = ORIGIN(CCM) + __UVISOR_SRAM_OFFSET;
lypinator 0:bb348c97df44 137 .uvisor.bss __UVISOR_SRAM_START (NOLOAD):
lypinator 0:bb348c97df44 138 {
lypinator 0:bb348c97df44 139 . = ALIGN(32);
lypinator 0:bb348c97df44 140 __uvisor_bss_start = .;
lypinator 0:bb348c97df44 141
lypinator 0:bb348c97df44 142 /* Protected uVisor own BSS section */
lypinator 0:bb348c97df44 143 . = ALIGN(32);
lypinator 0:bb348c97df44 144 __uvisor_bss_main_start = .;
lypinator 0:bb348c97df44 145 KEEP(*(.keep.uvisor.bss.main))
lypinator 0:bb348c97df44 146 . = ALIGN(32);
lypinator 0:bb348c97df44 147 __uvisor_bss_main_end = .;
lypinator 0:bb348c97df44 148
lypinator 0:bb348c97df44 149 /* Protected uVisor boxes' static memories */
lypinator 0:bb348c97df44 150 . = ALIGN(32);
lypinator 0:bb348c97df44 151 __uvisor_bss_boxes_start = .;
lypinator 0:bb348c97df44 152 KEEP(*(.keep.uvisor.bss.boxes))
lypinator 0:bb348c97df44 153 . = ALIGN(32);
lypinator 0:bb348c97df44 154 __uvisor_bss_boxes_end = .;
lypinator 0:bb348c97df44 155
lypinator 0:bb348c97df44 156 . = ALIGN(32);
lypinator 0:bb348c97df44 157 __uvisor_bss_end = .;
lypinator 0:bb348c97df44 158 } > CCM
lypinator 0:bb348c97df44 159
lypinator 0:bb348c97df44 160 /* Heap space for the page allocator
lypinator 0:bb348c97df44 161 /* If uVisor shares the SRAM with the OS/app, ensure that this section is
lypinator 0:bb348c97df44 162 * the first one after the uVisor BSS section. Otherwise, ensure it is the
lypinator 0:bb348c97df44 163 * first one after the VTOR relocation section. */
lypinator 0:bb348c97df44 164 .page_heap (NOLOAD) :
lypinator 0:bb348c97df44 165 {
lypinator 0:bb348c97df44 166 . = ALIGN(32);
lypinator 0:bb348c97df44 167 __uvisor_page_start = .;
lypinator 0:bb348c97df44 168 KEEP(*(.keep.uvisor.page_heap))
lypinator 0:bb348c97df44 169 . = ALIGN((1 << LOG2CEIL(LENGTH(RAM))) / 8);
lypinator 0:bb348c97df44 170 __uvisor_page_end = .;
lypinator 0:bb348c97df44 171 } > RAM
lypinator 0:bb348c97df44 172
lypinator 0:bb348c97df44 173 .data :
lypinator 0:bb348c97df44 174 {
lypinator 0:bb348c97df44 175 PROVIDE( __etext = LOADADDR(.data) );
lypinator 0:bb348c97df44 176
lypinator 0:bb348c97df44 177 __data_start__ = .;
lypinator 0:bb348c97df44 178 _sdata = .;
lypinator 0:bb348c97df44 179 *(vtable)
lypinator 0:bb348c97df44 180 *(.data*)
lypinator 0:bb348c97df44 181
lypinator 0:bb348c97df44 182 . = ALIGN(4);
lypinator 0:bb348c97df44 183 /* preinit data */
lypinator 0:bb348c97df44 184 PROVIDE_HIDDEN (__preinit_array_start = .);
lypinator 0:bb348c97df44 185 KEEP(*(.preinit_array))
lypinator 0:bb348c97df44 186 PROVIDE_HIDDEN (__preinit_array_end = .);
lypinator 0:bb348c97df44 187
lypinator 0:bb348c97df44 188 . = ALIGN(4);
lypinator 0:bb348c97df44 189 /* init data */
lypinator 0:bb348c97df44 190 PROVIDE_HIDDEN (__init_array_start = .);
lypinator 0:bb348c97df44 191 KEEP(*(SORT(.init_array.*)))
lypinator 0:bb348c97df44 192 KEEP(*(.init_array))
lypinator 0:bb348c97df44 193 PROVIDE_HIDDEN (__init_array_end = .);
lypinator 0:bb348c97df44 194
lypinator 0:bb348c97df44 195
lypinator 0:bb348c97df44 196 . = ALIGN(4);
lypinator 0:bb348c97df44 197 /* finit data */
lypinator 0:bb348c97df44 198 PROVIDE_HIDDEN (__fini_array_start = .);
lypinator 0:bb348c97df44 199 KEEP(*(SORT(.fini_array.*)))
lypinator 0:bb348c97df44 200 KEEP(*(.fini_array))
lypinator 0:bb348c97df44 201 PROVIDE_HIDDEN (__fini_array_end = .);
lypinator 0:bb348c97df44 202
lypinator 0:bb348c97df44 203 KEEP(*(.jcr*))
lypinator 0:bb348c97df44 204 . = ALIGN(4);
lypinator 0:bb348c97df44 205 /* All data end */
lypinator 0:bb348c97df44 206 __data_end__ = .;
lypinator 0:bb348c97df44 207 _edata = .;
lypinator 0:bb348c97df44 208
lypinator 0:bb348c97df44 209 } > RAM AT > FLASH
lypinator 0:bb348c97df44 210
lypinator 0:bb348c97df44 211 /* uVisor configuration section
lypinator 0:bb348c97df44 212 * This section must be located after all other flash regions. */
lypinator 0:bb348c97df44 213 .uvisor.secure :
lypinator 0:bb348c97df44 214 {
lypinator 0:bb348c97df44 215 . = ALIGN(32);
lypinator 0:bb348c97df44 216 __uvisor_secure_start = .;
lypinator 0:bb348c97df44 217
lypinator 0:bb348c97df44 218 /* uVisor secure boxes configuration tables */
lypinator 0:bb348c97df44 219 . = ALIGN(32);
lypinator 0:bb348c97df44 220 __uvisor_cfgtbl_start = .;
lypinator 0:bb348c97df44 221 KEEP(*(.keep.uvisor.cfgtbl))
lypinator 0:bb348c97df44 222 . = ALIGN(32);
lypinator 0:bb348c97df44 223 __uvisor_cfgtbl_end = .;
lypinator 0:bb348c97df44 224
lypinator 0:bb348c97df44 225 /* Pointers to the uVisor secure boxes configuration tables */
lypinator 0:bb348c97df44 226 /* Note: Do not add any further alignment here, as uVisor will need to
lypinator 0:bb348c97df44 227 * have access to the exact list of pointers. */
lypinator 0:bb348c97df44 228 __uvisor_cfgtbl_ptr_start = .;
lypinator 0:bb348c97df44 229 KEEP(*(.keep.uvisor.cfgtbl_ptr_first))
lypinator 0:bb348c97df44 230 KEEP(*(.keep.uvisor.cfgtbl_ptr))
lypinator 0:bb348c97df44 231 __uvisor_cfgtbl_ptr_end = .;
lypinator 0:bb348c97df44 232
lypinator 0:bb348c97df44 233 /* Pointers to all boxes register gateways. These are grouped here to
lypinator 0:bb348c97df44 234 allow discoverability and firmware verification. */
lypinator 0:bb348c97df44 235 __uvisor_register_gateway_ptr_start = .;
lypinator 0:bb348c97df44 236 KEEP(*(.keep.uvisor.register_gateway_ptr))
lypinator 0:bb348c97df44 237 __uvisor_register_gateway_ptr_end = .;
lypinator 0:bb348c97df44 238
lypinator 0:bb348c97df44 239 . = ALIGN(32);
lypinator 0:bb348c97df44 240 __uvisor_secure_end = .;
lypinator 0:bb348c97df44 241 } > FLASH
lypinator 0:bb348c97df44 242
lypinator 0:bb348c97df44 243 /* Uninitialized data section
lypinator 0:bb348c97df44 244 * This region is not initialized by the C/C++ library and can be used to
lypinator 0:bb348c97df44 245 * store state across soft reboots. */
lypinator 0:bb348c97df44 246 .uninitialized (NOLOAD):
lypinator 0:bb348c97df44 247 {
lypinator 0:bb348c97df44 248 . = ALIGN(32);
lypinator 0:bb348c97df44 249 __uninitialized_start = .;
lypinator 0:bb348c97df44 250 *(.uninitialized)
lypinator 0:bb348c97df44 251 KEEP(*(.keep.uninitialized))
lypinator 0:bb348c97df44 252 . = ALIGN(32);
lypinator 0:bb348c97df44 253 __uninitialized_end = .;
lypinator 0:bb348c97df44 254 } > RAM
lypinator 0:bb348c97df44 255
lypinator 0:bb348c97df44 256 .bss (NOLOAD):
lypinator 0:bb348c97df44 257 {
lypinator 0:bb348c97df44 258 . = ALIGN(4);
lypinator 0:bb348c97df44 259 __bss_start__ = .;
lypinator 0:bb348c97df44 260 _sbss = .;
lypinator 0:bb348c97df44 261 *(.bss*)
lypinator 0:bb348c97df44 262 *(COMMON)
lypinator 0:bb348c97df44 263 . = ALIGN(4);
lypinator 0:bb348c97df44 264 __bss_end__ = .;
lypinator 0:bb348c97df44 265 _ebss = .;
lypinator 0:bb348c97df44 266 } > RAM
lypinator 0:bb348c97df44 267
lypinator 0:bb348c97df44 268 .heap (NOLOAD):
lypinator 0:bb348c97df44 269 {
lypinator 0:bb348c97df44 270 __uvisor_heap_start = .;
lypinator 0:bb348c97df44 271 __end__ = .;
lypinator 0:bb348c97df44 272 end = __end__;
lypinator 0:bb348c97df44 273 . += HEAP_SIZE;
lypinator 0:bb348c97df44 274 __HeapLimit = .;
lypinator 0:bb348c97df44 275 __uvisor_heap_end = .;
lypinator 0:bb348c97df44 276 } > RAM
lypinator 0:bb348c97df44 277
lypinator 0:bb348c97df44 278 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
lypinator 0:bb348c97df44 279 __stack = __StackTop;
lypinator 0:bb348c97df44 280 __StackLimit = __StackTop - STACK_SIZE;
lypinator 0:bb348c97df44 281
lypinator 0:bb348c97df44 282 ASSERT(__StackLimit >= __HeapLimit, "Region RAM overflowed with stack and heap")
lypinator 0:bb348c97df44 283
lypinator 0:bb348c97df44 284 /* Provide physical memory boundaries for uVisor. */
lypinator 0:bb348c97df44 285 __uvisor_flash_start = ORIGIN(VECTORS);
lypinator 0:bb348c97df44 286 __uvisor_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
lypinator 0:bb348c97df44 287 __uvisor_sram_start = ORIGIN(CCM);
lypinator 0:bb348c97df44 288 __uvisor_sram_end = ORIGIN(CCM) + LENGTH(CCM);
lypinator 0:bb348c97df44 289 __uvisor_public_sram_start = ORIGIN(RAM);
lypinator 0:bb348c97df44 290 __uvisor_public_sram_end = ORIGIN(RAM) + LENGTH(RAM);
lypinator 0:bb348c97df44 291 }