Ich benutze Em::Blocks als IDE und möchte einen Quellcode für STM32L151CCT6 erstellen. Beim Assistenten für neue Projekte habe ich STM32L1xx als Vorlage ausgewählt und ein leeres Projekt erzeugt. Mir ist jedoch aufgefallen das der Speicher nicht korrekt ist: STM32L151CCT6 Flash = 256 KB RAM = 32 KB EEPROM = 8 KB Bakeup Register = 128 bytes Ich denke mal ich müßte jetzt das/die Linker-Scripts anpassen, habe ich aber noch nie machen müssen und bin mir deshalb nicht ganz sicher wo ich was eintragen muss. Es gibt zwei *.ld Dateien im Projektordner. Kann mir da jemand weiterhelfen, und mir sagen wo ich da die Speicher Größen eintragen muss? stm32l100c6_flash.ld
1 | /* ---------------------------------------------------------------------------- */ |
2 | /* Em::Blocks embedded development Support */ |
3 | /* ---------------------------------------------------------------------------- */ |
4 | /* Copyright (c) 2014, EmBlocks */ |
5 | /* */ |
6 | /* All rights reserved. */ |
7 | /* */ |
8 | /* Redistribution and use in source and binary forms, with or without */ |
9 | /* modification, are permitted provided that the following condition is met: */ |
10 | /* */ |
11 | /* - Redistributions of source code must retain the above copyright notice, */ |
12 | /* this list of conditions and the disclaimer below. */ |
13 | /* */ |
14 | /* EmBlocks's name may not be used to endorse or promote products derived from */ |
15 | /* this software without specific prior written permission. */ |
16 | /* */ |
17 | /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY EBLOCKS "AS IS" AND ANY EXPRESS OR */ |
18 | /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ |
19 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ |
20 | /* DISCLAIMED. IN NO EVENT SHALL EMBLOCKS BE LIABLE FOR ANY DIRECT, INDIRECT, */ |
21 | /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ |
22 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ |
23 | /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ |
24 | /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ |
25 | /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ |
26 | /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
27 | /* ---------------------------------------------------------------------------- */ |
28 | |
29 | /*------------------------------------------------------------------------------ |
30 | * Linker script for running in internal FLASH on the STM32L100C6 |
31 | *----------------------------------------------------------------------------*/ |
32 | |
33 | OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
34 | OUTPUT_ARCH(arm) |
35 | SEARCH_DIR(.) |
36 | |
37 | /* Memory Spaces Definitions */ |
38 | MEMORY |
39 | {
|
40 | ROM (rx) : ORIGIN = 0x08000000, LENGTH = 32K |
41 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 4K |
42 | } |
43 | |
44 | /* Linker script to place sections and symbol values. Should be used together |
45 | * with other linker script that defines memory regions FLASH and RAM. |
46 | * It references following symbols, which must be defined in code: |
47 | * Reset_Handler : Entry of reset handler |
48 | * |
49 | * It defines following symbols, which code can use without definition: |
50 | * __exidx_start |
51 | * __exidx_end |
52 | * __etext |
53 | * __data_start__ |
54 | * __preinit_array_start |
55 | * __preinit_array_end |
56 | * __init_array_start |
57 | * __init_array_end |
58 | * __fini_array_start |
59 | * __fini_array_end |
60 | * __data_end__ |
61 | * __bss_start__ |
62 | * __bss_end__ |
63 | * __end__ |
64 | * end |
65 | * __HeapLimit |
66 | * __StackLimit |
67 | * __StackTop |
68 | * __stack |
69 | */ |
70 | |
71 | |
72 | SECTIONS |
73 | {
|
74 | .text : |
75 | {
|
76 | KEEP(*(.isr_vector)) |
77 | *(.text*) |
78 | |
79 | KEEP(*(.init)) |
80 | KEEP(*(.fini)) |
81 | |
82 | /* .ctors */ |
83 | *crtbegin.o(.ctors) |
84 | *crtbegin?.o(.ctors) |
85 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
86 | *(SORT(.ctors.*)) |
87 | *(.ctors) |
88 | |
89 | /* .dtors */ |
90 | *crtbegin.o(.dtors) |
91 | *crtbegin?.o(.dtors) |
92 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
93 | *(SORT(.dtors.*)) |
94 | *(.dtors) |
95 | |
96 | *(.rodata*) |
97 | |
98 | KEEP(*(.eh_frame*)) |
99 | } > ROM |
100 | |
101 | .ARM.extab : |
102 | {
|
103 | *(.ARM.extab* .gnu.linkonce.armextab.*) |
104 | } > ROM |
105 | |
106 | __exidx_start = .; |
107 | .ARM.exidx : |
108 | {
|
109 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
110 | } > ROM |
111 | __exidx_end = .; |
112 | |
113 | __etext = .; |
114 | |
115 | .data : AT (__etext) |
116 | {
|
117 | __data_start__ = .; |
118 | *(vtable) |
119 | *(.data*) |
120 | |
121 | . = ALIGN(4); |
122 | /* preinit data */ |
123 | PROVIDE_HIDDEN (__preinit_array_start = .); |
124 | KEEP(*(.preinit_array)) |
125 | PROVIDE_HIDDEN (__preinit_array_end = .); |
126 | |
127 | . = ALIGN(4); |
128 | /* init data */ |
129 | PROVIDE_HIDDEN (__init_array_start = .); |
130 | KEEP(*(SORT(.init_array.*))) |
131 | KEEP(*(.init_array)) |
132 | PROVIDE_HIDDEN (__init_array_end = .); |
133 | |
134 | |
135 | . = ALIGN(4); |
136 | /* finit data */ |
137 | PROVIDE_HIDDEN (__fini_array_start = .); |
138 | KEEP(*(SORT(.fini_array.*))) |
139 | KEEP(*(.fini_array)) |
140 | PROVIDE_HIDDEN (__fini_array_end = .); |
141 | |
142 | . = ALIGN(4); |
143 | /* All data end */ |
144 | __data_end__ = .; |
145 | |
146 | } > RAM |
147 | |
148 | .bss (NOLOAD): |
149 | {
|
150 | __bss_start__ = .; |
151 | *(.bss*) |
152 | *(COMMON) |
153 | __bss_end__ = .; |
154 | } > RAM |
155 | |
156 | .heap (NOLOAD): |
157 | {
|
158 | __end__ = .; |
159 | end = __end__; |
160 | *(.heap*) |
161 | __HeapLimit = .; |
162 | } > RAM |
163 | |
164 | /* .stack_dummy section doesn't contains any symbols. It is only |
165 | * used for linker to calculate size of stack sections, and assign |
166 | * values to stack symbols later */ |
167 | .stack_dummy (NOLOAD): |
168 | {
|
169 | *(.stack) |
170 | } > RAM |
171 | |
172 | /* Set stack top to end of RAM, and stack limit move down by |
173 | * size of stack_dummy section */ |
174 | __StackTop = ORIGIN(RAM) + LENGTH(RAM); |
175 | __StackLimit = __StackTop - SIZEOF(.stack_dummy); |
176 | PROVIDE(__stack = __StackTop); |
177 | |
178 | /* Check if data + heap + stack exceeds RAM limit */ |
179 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") |
180 | } |
stm32l100c6_sram.ld
1 | /* ---------------------------------------------------------------------------- */ |
2 | /* Em::Blocks embedded development Support */ |
3 | /* ---------------------------------------------------------------------------- */ |
4 | /* Copyright (c) 2014, EmBlocks */ |
5 | /* */ |
6 | /* All rights reserved. */ |
7 | /* */ |
8 | /* Redistribution and use in source and binary forms, with or without */ |
9 | /* modification, are permitted provided that the following condition is met: */ |
10 | /* */ |
11 | /* - Redistributions of source code must retain the above copyright notice, */ |
12 | /* this list of conditions and the disclaimer below. */ |
13 | /* */ |
14 | /* EmBlocks's name may not be used to endorse or promote products derived from */ |
15 | /* this software without specific prior written permission. */ |
16 | /* */ |
17 | /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY EBLOCKS "AS IS" AND ANY EXPRESS OR */ |
18 | /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ |
19 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ |
20 | /* DISCLAIMED. IN NO EVENT SHALL EMBLOCKS BE LIABLE FOR ANY DIRECT, INDIRECT, */ |
21 | /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ |
22 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ |
23 | /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ |
24 | /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ |
25 | /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ |
26 | /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
27 | /* ---------------------------------------------------------------------------- */ |
28 | |
29 | /*------------------------------------------------------------------------------ |
30 | * Linker script for running in internal SRAM on the STM32L100C6 |
31 | *----------------------------------------------------------------------------*/ |
32 | |
33 | OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
34 | OUTPUT_ARCH(arm) |
35 | SEARCH_DIR(.) |
36 | |
37 | /* Memory Spaces Definitions */ |
38 | MEMORY |
39 | {
|
40 | ROM (rx) : ORIGIN = 0x08000000, LENGTH = 32K |
41 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 4K |
42 | } |
43 | |
44 | /* Linker script to place sections and symbol values. Should be used together |
45 | * with other linker script that defines memory regions FLASH and RAM. |
46 | * It references following symbols, which must be defined in code: |
47 | * Reset_Handler : Entry of reset handler |
48 | * |
49 | * It defines following symbols, which code can use without definition: |
50 | * __exidx_start |
51 | * __exidx_end |
52 | * __etext |
53 | * __data_start__ |
54 | * __preinit_array_start |
55 | * __preinit_array_end |
56 | * __init_array_start |
57 | * __init_array_end |
58 | * __fini_array_start |
59 | * __fini_array_end |
60 | * __data_end__ |
61 | * __bss_start__ |
62 | * __bss_end__ |
63 | * __end__ |
64 | * end |
65 | * __HeapLimit |
66 | * __StackLimit |
67 | * __StackTop |
68 | * __stack |
69 | */ |
70 | |
71 | |
72 | SECTIONS |
73 | {
|
74 | .text : |
75 | {
|
76 | KEEP(*(.isr_vector)) |
77 | *(.text*) |
78 | |
79 | KEEP(*(.init)) |
80 | KEEP(*(.fini)) |
81 | |
82 | /* .ctors */ |
83 | *crtbegin.o(.ctors) |
84 | *crtbegin?.o(.ctors) |
85 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
86 | *(SORT(.ctors.*)) |
87 | *(.ctors) |
88 | |
89 | /* .dtors */ |
90 | *crtbegin.o(.dtors) |
91 | *crtbegin?.o(.dtors) |
92 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
93 | *(SORT(.dtors.*)) |
94 | *(.dtors) |
95 | |
96 | *(.rodata*) |
97 | |
98 | KEEP(*(.eh_frame*)) |
99 | } > RAM |
100 | |
101 | .ARM.extab : |
102 | {
|
103 | *(.ARM.extab* .gnu.linkonce.armextab.*) |
104 | } > RAM |
105 | |
106 | __exidx_start = .; |
107 | .ARM.exidx : |
108 | {
|
109 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
110 | } > RAM |
111 | __exidx_end = .; |
112 | |
113 | __etext = .; |
114 | |
115 | .data : AT (__etext) |
116 | {
|
117 | __data_start__ = .; |
118 | *(vtable) |
119 | *(.data*) |
120 | |
121 | . = ALIGN(4); |
122 | /* preinit data */ |
123 | PROVIDE_HIDDEN (__preinit_array_start = .); |
124 | KEEP(*(.preinit_array)) |
125 | PROVIDE_HIDDEN (__preinit_array_end = .); |
126 | |
127 | . = ALIGN(4); |
128 | /* init data */ |
129 | PROVIDE_HIDDEN (__init_array_start = .); |
130 | KEEP(*(SORT(.init_array.*))) |
131 | KEEP(*(.init_array)) |
132 | PROVIDE_HIDDEN (__init_array_end = .); |
133 | |
134 | |
135 | . = ALIGN(4); |
136 | /* finit data */ |
137 | PROVIDE_HIDDEN (__fini_array_start = .); |
138 | KEEP(*(SORT(.fini_array.*))) |
139 | KEEP(*(.fini_array)) |
140 | PROVIDE_HIDDEN (__fini_array_end = .); |
141 | |
142 | . = ALIGN(4); |
143 | /* All data end */ |
144 | __data_end__ = .; |
145 | |
146 | } > RAM |
147 | |
148 | .bss (NOLOAD): |
149 | {
|
150 | __bss_start__ = .; |
151 | *(.bss*) |
152 | *(COMMON) |
153 | __bss_end__ = .; |
154 | } > RAM |
155 | |
156 | .heap (NOLOAD): |
157 | {
|
158 | __end__ = .; |
159 | end = __end__; |
160 | *(.heap*) |
161 | __HeapLimit = .; |
162 | } > RAM |
163 | |
164 | /* .stack_dummy section doesn't contains any symbols. It is only |
165 | * used for linker to calculate size of stack sections, and assign |
166 | * values to stack symbols later */ |
167 | .stack_dummy (NOLOAD): |
168 | {
|
169 | . = ALIGN(8); |
170 | *(.stack) |
171 | } > RAM |
172 | |
173 | /* Set stack top to end of RAM, and stack limit move down by |
174 | * size of stack_dummy section */ |
175 | __StackTop = ORIGIN(RAM) + LENGTH(RAM); |
176 | __StackLimit = __StackTop - SIZEOF(.stack_dummy); |
177 | PROVIDE(__stack = __StackTop); |
178 | |
179 | /* Check if data + heap + stack exceeds RAM limit */ |
180 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") |
181 | } |