Skip to content

Commit cb8c2d7

Browse files
sylvioalvesnashif
authored andcommitted
soc: esp32s2: linker script clean up
This PR removes common-rom.ld section so that logging sections can now be mapped into RAM area. Signed-off-by: Sylvio Alves <[email protected]>
1 parent ac9c14d commit cb8c2d7

File tree

3 files changed

+20
-75
lines changed

3 files changed

+20
-75
lines changed

soc/xtensa/esp32s2/Kconfig.defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ if BOOTLOADER_MCUBOOT
1010
config HAS_FLASH_LOAD_OFFSET
1111
default y
1212

13-
config XIP
14-
default y
15-
1613
config MCUBOOT_GENERATE_UNSIGNED_IMAGE
1714
default y
1815

soc/xtensa/esp32s2/Kconfig.soc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ config SOC_ESP32S2
99
select CLOCK_CONTROL
1010
select CLOCK_CONTROL_ESP32
1111
select PINCTRL
12+
select XIP
1213

1314
if SOC_ESP32S2
1415

soc/xtensa/esp32s2/linker.ld

Lines changed: 19 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -134,66 +134,6 @@ SECTIONS
134134
*(.rodata_desc .rodata_desc.*)
135135
*(.rodata_custom_desc .rodata_custom_desc.*)
136136

137-
#ifdef CONFIG_USERSPACE
138-
Z_LINK_ITERABLE_ALIGNED(z_object_assignment, 4);
139-
#endif
140-
141-
#if defined(CONFIG_NET_SOCKETS)
142-
Z_LINK_ITERABLE_ALIGNED(net_socket_register, 4);
143-
#endif
144-
145-
#if defined(CONFIG_NET_L2_PPP)
146-
Z_LINK_ITERABLE_ALIGNED(ppp_protocol_handler, 4);
147-
#endif
148-
149-
Z_LINK_ITERABLE_ALIGNED(bt_l2cap_fixed_chan, 4);
150-
151-
#if defined(CONFIG_BT_BREDR)
152-
Z_LINK_ITERABLE_ALIGNED(bt_l2cap_br_fixed_chan, 4);
153-
#endif
154-
155-
#if defined(CONFIG_BT_CONN)
156-
Z_LINK_ITERABLE_ALIGNED(bt_conn_cb, 4)
157-
#endif
158-
159-
Z_LINK_ITERABLE_ALIGNED(bt_gatt_service_static, 4);
160-
161-
#if defined(CONFIG_BT_MESH)
162-
Z_LINK_ITERABLE_ALIGNED(bt_mesh_subnet_cb, 4);
163-
Z_LINK_ITERABLE_ALIGNED(bt_mesh_app_key_cb, 4);
164-
Z_LINK_ITERABLE_ALIGNED(bt_mesh_hb_cb, 4);
165-
#endif
166-
167-
#if defined(CONFIG_BT_MESH_FRIEND)
168-
Z_LINK_ITERABLE_ALIGNED(bt_mesh_friend_cb, 4);
169-
#endif
170-
171-
#if defined(CONFIG_BT_MESH_LOW_POWER)
172-
Z_LINK_ITERABLE_ALIGNED(bt_mesh_lpn_cb, 4);
173-
#endif
174-
175-
#if defined(CONFIG_BT_MESH_PROXY)
176-
Z_LINK_ITERABLE_ALIGNED(bt_mesh_proxy_cb, 4);
177-
#endif
178-
179-
#if defined(CONFIG_EC_HOST_CMD)
180-
Z_LINK_ITERABLE_ALIGNED(ec_host_cmd_handler, 4);
181-
#endif
182-
183-
#if defined(CONFIG_SETTINGS)
184-
Z_LINK_ITERABLE_ALIGNED(settings_handler_static, 4);
185-
#endif
186-
187-
Z_LINK_ITERABLE_ALIGNED(k_p4wq_initparam, 4);
188-
189-
Z_LINK_ITERABLE_ALIGNED(shell, 4);
190-
191-
Z_LINK_ITERABLE_ALIGNED(tracing_backend, 4)
192-
193-
__esp_shell_root_cmds_start = .;
194-
KEEP(*(SORT(.shell_root_cmd_*)));
195-
__esp_shell_root_cmds_end = .;
196-
197137
. = ALIGN(4);
198138
#include <snippets-rodata.ld>
199139

@@ -248,6 +188,19 @@ SECTIONS
248188
. = ALIGN(4);
249189
} GROUP_DATA_LINK_IN(RODATA_REGION, ROMABLE_REGION)
250190

191+
/* Flash segments (rodata and text) should be mapped in virtual address space by providing VMA.
192+
* Executing directly from LMA is not possible. */
193+
#pragma push_macro("GROUP_ROM_LINK_IN")
194+
#undef GROUP_ROM_LINK_IN
195+
#define GROUP_ROM_LINK_IN(vregion, lregion) > RODATA_REGION AT > lregion
196+
#include "linker/common-rom/common-rom-kernel-devices.ld"
197+
#include "linker/common-rom/common-rom-cpp.ld"
198+
#include "linker/common-rom/common-rom-net.ld"
199+
#include "linker/common-rom/common-rom-bt.ld"
200+
#include "linker/common-rom/common-rom-debug.ld"
201+
#include "linker/common-rom/common-rom-misc.ld"
202+
#pragma pop_macro("GROUP_ROM_LINK_IN")
203+
251204
/* Send .iram0 code to iram */
252205
.iram0.vectors : ALIGN(4)
253206
{
@@ -412,22 +365,16 @@ SECTIONS
412365
. = ALIGN(4);
413366
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
414367

415-
#pragma push_macro("GROUP_ROM_LINK_IN")
416-
#pragma push_macro("ITERABLE_SECTION_ROM")
417-
#undef GROUP_ROM_LINK_IN
418-
#undef ITERABLE_SECTION_ROM
419-
#define GROUP_ROM_LINK_IN GROUP_DATA_LINK_IN
420-
#define ITERABLE_SECTION_ROM(x,y)
421-
#include <linker/common-rom.ld>
422-
#pragma pop_macro("GROUP_ROM_LINK_IN")
423-
#pragma pop_macro("ITERABLE_SECTION_ROM")
424-
425368
#include <snippets-data-sections.ld>
426369
#include <linker/common-ram.ld>
427370
#include <snippets-ram-sections.ld>
428371

429-
__shell_root_cmds_start = __esp_shell_root_cmds_start;
430-
__shell_root_cmds_end = __esp_shell_root_cmds_end;
372+
/* logging sections should be placed in RAM area to avoid flash cache disabled issues */
373+
#pragma push_macro("GROUP_ROM_LINK_IN")
374+
#undef GROUP_ROM_LINK_IN
375+
#define GROUP_ROM_LINK_IN GROUP_DATA_LINK_IN
376+
#include "linker/common-rom/common-rom-logging.ld"
377+
#pragma pop_macro("GROUP_ROM_LINK_IN")
431378

432379
.dummy.dram.data :
433380
{

0 commit comments

Comments
 (0)