Skip to content

Commit 242e8f9

Browse files
committed
rtl8195am - cleanup gcc linker script
Signed-off-by: Tony Wu <[email protected]>
1 parent dfa19b0 commit 242e8f9

File tree

1 file changed

+12
-13
lines changed
  • targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/device/TOOLCHAIN_GCC_ARM

1 file changed

+12
-13
lines changed

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/device/TOOLCHAIN_GCC_ARM/rtl8195a.ld

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,20 @@ SECTIONS
107107
} > SRAM2
108108
__etext = .;
109109

110-
__data_start__ = .;
111-
112110
.data.sram1 :
113111
{
114-
. = ALIGN(8);
112+
. = ALIGN(4);
113+
__data_start__ = .;
115114
__sram_data_start__ = .;
116115
*rtl8195a_crypto*.o (.data*)
117116
*mbedtls*.o (.data*)
117+
__data_end__ = .;
118118
__sram_data_end__ = .;
119119
} > SRAM1
120120

121121
.data.sram2 :
122122
{
123-
__sdram_data_start__ = .;
123+
__dram_data_start__ = .;
124124
*(vtable)
125125
*(.data*)
126126
*(.sdram.data*)
@@ -145,12 +145,8 @@ SECTIONS
145145
KEEP(*(.fini_array))
146146
PROVIDE (__fini_array_end = .);
147147

148-
. = ALIGN(8);
149-
150-
__sdram_data_end__ = .;
151-
/* All data end */
148+
__dram_data_end__ = .;
152149
} > SRAM2
153-
__data_end__ = .;
154150
__image2_end__ = .;
155151

156152
.ARM.extab :
@@ -167,24 +163,24 @@ SECTIONS
167163

168164
.bss.sram1 (NOLOAD) :
169165
{
166+
__bss_start__ = .;
170167
__bss_sram_start__ = .;
171168
*rtl8195a_crypto*.o (.bss* COMMON)
172169
*mbedtls*.o (.bss* COMMON)
173170
*(.bss.thread_stack_main)
174171
*lib_peripheral_mbed_gcc.a: (.bss* COMMON)
175172
*mbed_boot*.o (.bss* COMMON)
176173
__bss_sram_end__ = .;
174+
__bss_end__ = .;
177175
} > SRAM1
178176

179177
.bss.sram2 (NOLOAD) :
180178
{
181-
__bss_start__ = .;
182179
__bss_dram_start__ = .;
183180
*(.bss*)
184181
*(COMMON)
185182
*(.bdsram.data*)
186183
__bss_dram_end__ = .;
187-
__bss_end__ = .;
188184
} > SRAM2
189185

190186
.bf_data :
@@ -199,7 +195,7 @@ SECTIONS
199195
__end__ = .;
200196
end = __end__;
201197
*(.heap*)
202-
. = ORIGIN(SRAM1) + LENGTH(SRAM1) - StackSize;
198+
. = ORIGIN(SRAM1) + LENGTH(SRAM1) - StackSize;
203199
__HeapLimit = .;
204200
} > SRAM1
205201

@@ -219,7 +215,7 @@ SECTIONS
219215
{
220216
__StackLimit = .;
221217
*(.stack)
222-
. += StackSize - (. - __StackLimit);
218+
. += StackSize - (. - __StackLimit);
223219
} > SRAM1
224220

225221
/* Set stack top to end of RAM, and stack limit move down by
@@ -228,6 +224,9 @@ SECTIONS
228224
__StackLimit = __StackTop - StackSize;
229225
PROVIDE(__stack = __StackTop);
230226

227+
/* Check if reserved stack size is too small */
228+
ASSERT(StackSize >= SIZEOF(.stack_dummy), "reserved stack size is too small")
229+
231230
/* Check if data + heap + stack exceeds RAM limit */
232231
ASSERT(__StackLimit >= __HeapLimit, "region RAM exceeds ram limit")
233232
}

0 commit comments

Comments
 (0)