Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | /* |
| 2 | ***************************************************************************** |
||
| 3 | ** |
||
| 4 | ** File : stm32_flash.ld |
||
| 5 | ** |
||
| 6 | ** Abstract : Linker script for STM32F103CB Device with |
||
| 7 | ** 128KByte FLASH, 20KByte RAM |
||
| 8 | ** |
||
| 9 | ** Set heap size, stack size and stack location according |
||
| 10 | ** to application requirements. |
||
| 11 | ** |
||
| 12 | ** Set memory bank area and size if external memory is used. |
||
| 13 | ** |
||
| 14 | ** Target : STMicroelectronics STM32 |
||
| 15 | ** |
||
| 16 | ** Environment : Atollic TrueSTUDIO(R) |
||
| 17 | ** |
||
| 18 | ** Distribution: The file is distributed “as is,” without any warranty |
||
| 19 | ** of any kind. |
||
| 20 | ** |
||
| 21 | ** (c)Copyright Atollic AB. |
||
| 22 | ** You may use this file as-is or modify it according to the needs of your |
||
| 23 | ** project. This file may only be built (assembled or compiled and linked) |
||
| 24 | ** using the Atollic TrueSTUDIO(R) product. The use of this file together |
||
| 25 | ** with other tools than Atollic TrueSTUDIO(R) is not permitted. |
||
| 26 | ** |
||
| 27 | ***************************************************************************** |
||
| 28 | */ |
||
| 29 | |||
| 30 | /* Entry Point */ |
||
| 31 | ENTRY(Reset_Handler) |
||
| 32 | |||
| 33 | /* Highest address of the user mode stack */ |
||
| 34 | _estack = 0x20005000; /* end of RAM */ |
||
| 35 | |||
| 36 | /* Generate a link error if heap and stack don't fit into RAM */ |
||
| 37 | _Min_Heap_Size = 0x400; /* required amount of heap */ |
||
| 38 | _Min_Stack_Size = 0x400; /* required amount of stack */ |
||
| 39 | |||
| 40 | /* Specify the memory areas */ |
||
| 41 | MEMORY |
||
| 42 | { |
||
| 43 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K |
||
| 44 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K |
||
| 45 | } |
||
| 46 | |||
| 47 | /* Define output sections */ |
||
| 48 | SECTIONS |
||
| 49 | { |
||
| 50 | /* The startup code goes first into FLASH */ |
||
| 51 | .isr_vector : |
||
| 52 | { |
||
| 53 | . = ALIGN(4); |
||
| 54 | KEEP(*(.isr_vector)) /* Startup code */ |
||
| 55 | . = ALIGN(4); |
||
| 56 | } >FLASH |
||
| 57 | |||
| 58 | /* The program code and other data goes into FLASH */ |
||
| 59 | .text : |
||
| 60 | { |
||
| 61 | . = ALIGN(4); |
||
| 62 | *(.text) /* .text sections (code) */ |
||
| 63 | *(.text*) /* .text* sections (code) */ |
||
| 64 | *(.glue_7) /* glue arm to thumb code */ |
||
| 65 | *(.glue_7t) /* glue thumb to arm code */ |
||
| 66 | *(.eh_frame) |
||
| 67 | |||
| 68 | KEEP (*(.init)) |
||
| 69 | KEEP (*(.fini)) |
||
| 70 | |||
| 71 | . = ALIGN(4); |
||
| 72 | _etext = .; /* define a global symbols at end of code */ |
||
| 73 | } >FLASH |
||
| 74 | |||
| 75 | /* Constant data goes into FLASH */ |
||
| 76 | .rodata : |
||
| 77 | { |
||
| 78 | . = ALIGN(4); |
||
| 79 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ |
||
| 80 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ |
||
| 81 | . = ALIGN(4); |
||
| 82 | } >FLASH |
||
| 83 | |||
| 84 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH |
||
| 85 | .ARM : { |
||
| 86 | __exidx_start = .; |
||
| 87 | *(.ARM.exidx*) |
||
| 88 | __exidx_end = .; |
||
| 89 | } >FLASH |
||
| 90 | |||
| 91 | .preinit_array : |
||
| 92 | { |
||
| 93 | PROVIDE_HIDDEN (__preinit_array_start = .); |
||
| 94 | KEEP (*(.preinit_array*)) |
||
| 95 | PROVIDE_HIDDEN (__preinit_array_end = .); |
||
| 96 | } >FLASH |
||
| 97 | .init_array : |
||
| 98 | { |
||
| 99 | PROVIDE_HIDDEN (__init_array_start = .); |
||
| 100 | KEEP (*(SORT(.init_array.*))) |
||
| 101 | KEEP (*(.init_array*)) |
||
| 102 | PROVIDE_HIDDEN (__init_array_end = .); |
||
| 103 | } >FLASH |
||
| 104 | .fini_array : |
||
| 105 | { |
||
| 106 | PROVIDE_HIDDEN (__fini_array_start = .); |
||
| 107 | KEEP (*(SORT(.fini_array.*))) |
||
| 108 | KEEP (*(.fini_array*)) |
||
| 109 | PROVIDE_HIDDEN (__fini_array_end = .); |
||
| 110 | } >FLASH |
||
| 111 | |||
| 112 | /* used by the startup to initialize data */ |
||
| 113 | _sidata = LOADADDR(.data); |
||
| 114 | |||
| 115 | /* Initialized data sections goes into RAM, load LMA copy after code */ |
||
| 116 | .data : |
||
| 117 | { |
||
| 118 | . = ALIGN(4); |
||
| 119 | _sdata = .; /* create a global symbol at data start */ |
||
| 120 | *(.data) /* .data sections */ |
||
| 121 | *(.data*) /* .data* sections */ |
||
| 122 | |||
| 123 | . = ALIGN(4); |
||
| 124 | _edata = .; /* define a global symbol at data end */ |
||
| 125 | } >RAM AT> FLASH |
||
| 126 | |||
| 16 | mjames | 127 | |
| 128 | |||
| 129 | /* NVRAM image section : nothing gets stored here but the addresses are set up */ |
||
| 130 | .eeprom_data (NOLOAD) : |
||
| 131 | { |
||
| 132 | . = ALIGN(1024) ; |
||
| 133 | _eeprom_base = .; |
||
| 134 | KEEP ( *(.EEPROM_Data)) /* any __attribute__((section(".EEPROM_Data"))) section info to be put in here */ |
||
| 135 | } >FLASH |
||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | |||
| 141 | |||
| 142 | |||
| 2 | mjames | 143 | |
| 144 | /* Uninitialized data section */ |
||
| 145 | . = ALIGN(4); |
||
| 146 | .bss : |
||
| 147 | { |
||
| 148 | /* This is used by the startup in order to initialize the .bss secion */ |
||
| 149 | _sbss = .; /* define a global symbol at bss start */ |
||
| 150 | __bss_start__ = _sbss; |
||
| 151 | *(.bss) |
||
| 152 | *(.bss*) |
||
| 153 | *(COMMON) |
||
| 154 | |||
| 155 | . = ALIGN(4); |
||
| 156 | _ebss = .; /* define a global symbol at bss end */ |
||
| 157 | __bss_end__ = _ebss; |
||
| 158 | } >RAM |
||
| 159 | |||
| 160 | /* User_heap_stack section, used to check that there is enough RAM left */ |
||
| 161 | ._user_heap_stack : |
||
| 162 | { |
||
| 163 | . = ALIGN(4); |
||
| 164 | PROVIDE ( end = . ); |
||
| 165 | PROVIDE ( _end = . ); |
||
| 166 | . = . + _Min_Heap_Size; |
||
| 167 | . = . + _Min_Stack_Size; |
||
| 168 | . = ALIGN(4); |
||
| 169 | } >RAM |
||
| 170 | |||
| 171 | |||
| 172 | |||
| 173 | /* Remove information from the standard libraries */ |
||
| 174 | /DISCARD/ : |
||
| 175 | { |
||
| 176 | libc.a ( * ) |
||
| 177 | libm.a ( * ) |
||
| 178 | libgcc.a ( * ) |
||
| 179 | } |
||
| 180 | |||
| 181 | .ARM.attributes 0 : { *(.ARM.attributes) } |
||
| 16 | mjames | 182 | |
| 183 | |||
| 184 | |||
| 185 | |||
| 186 | |||
| 187 | |||
| 2 | mjames | 188 | } |