@@ -93,6 +93,11 @@ SECTIONS {
9393
9494#include < zephyr/linker/common-rom.ld>
9595#include < zephyr/linker/thread-local-storage.ld>
96+ #ifdef __MWDT_LINKER_CMD__
97+ /* TODO: add mwdt specific ROM C++ sections */
98+ #else
99+ #include < zephyr/linker/cplusplus-rom.ld>
100+ #endif /* __MWDT_LINKER_CMD__ */
96101
97102 SECTION_PROLOGUE (_RODATA_SECTION_NAME,,) {
98103 *(" .rodata" )
@@ -103,7 +108,6 @@ SECTIONS {
103108 * zephyr_linker_sources() Cmake function.
104109 */
105110#include < snippets-rodata.ld>
106-
107111#include < zephyr/linker/kobject-rom.ld>
108112
109113#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_CPP_STATIC_INIT_GNU) && defined(__MWDT_LINKER_CMD__)
@@ -112,15 +116,12 @@ SECTIONS {
112116 KEEP (*(.ctors *))
113117 _ectors = .;
114118#endif /* CONFIG_CPLUSPLUS && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
115- } GROUP_LINK_IN (ROMABLE_REGION)
116119
117- #ifdef __MWDT_LINKER_CMD__
118- /* TODO: add mwdt specific ROM C++ sections */
119- #else
120- #include < zephyr/linker/cplusplus-rom.ld>
121- #endif /* __MWDT_LINKER_CMD__ */
120+ MPU_ALIGN (ABSOLUTE (.) - __rom_region_start);
121+ } GROUP_LINK_IN (ROMABLE_REGION)
122122
123123 __rodata_region_end = .;
124+
124125 MPU_ALIGN (__rodata_region_end - __rom_region_start);
125126 __rom_region_end = .;
126127 __rom_region_size = __rom_region_end - __rom_region_start;
@@ -129,6 +130,10 @@ SECTIONS {
129130
130131 GROUP_START (RAMABLE_REGION)
131132
133+ MPU_MIN_SIZE_ALIGN
134+
135+ _image_ram_start = .;
136+
132137#include < app_data_alignment.ld>
133138
134139/* Located in generated directory. This file is populated by the
@@ -141,8 +146,6 @@ SECTIONS {
141146#define SMEM_PARTITION_ALIGN MPU_ALIGN
142147
143148#include < app_smem.ld>
144-
145- _image_ram_start = _app_smem_start;
146149 _app_smem_size = _app_smem_end - _app_smem_start;
147150 _app_smem_rom_start = LOADADDR (_APP_SMEM_SECTION_NAME);
148151#endif /* CONFIG_USERSPACE */
@@ -155,7 +158,6 @@ SECTIONS {
155158 */
156159 . = ALIGN (4 );
157160 __bss_start = .;
158- _image_ram_start = .;
159161 __kernel_ram_start = .;
160162 *(" .bss" )
161163 *(" .bss.*" )
@@ -244,6 +246,16 @@ SECTIONS {
244246 KEEP (*(.gnu .attributes ))
245247 }
246248
249+ #if !defined(CONFIG_XIP)
250+ /*
251+ * Zephyr uses _estack as a start of heap allocation area.
252+ * Region [_estack .. sram_end] should be defined in MPU.
253+ * Including _image_ram region which is [_image_ram_start .. _image_ram_end]
254+ * we get [_image_ram_start .. sram_end] region to be defined in MPU.
255+ */
256+ __arc_rw_sram_size = SRAM_START + SRAM_SIZE - _image_ram_start;
257+ #endif
258+
247259 /DISCARD/ : {
248260#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_CPP_STATIC_INIT_GNU) && defined(__MWDT_LINKER_CMD__)
249261 *(.dtors *)
0 commit comments