Skip to content

Commit 584888f

Browse files
committed
soc: esp32c3: fix TLS flash addressing
When TLS is used, `__tdata_start` is PROVIDED by "thread-local-storage.ld" using absolute address, which makes it land in wrong flash address. This causes risc-v startup code to fail during memcpy/memset. This PR overrides `__tdata_start` to use ADDR, which will make sure it is placed in DROM region due to AT keyword. Signed-off-by: Sylvio Alves <[email protected]>
1 parent 97a97c7 commit 584888f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

soc/espressif/esp32c3/default.ld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,12 @@ SECTIONS
786786
.flash.rodata_end : ALIGN(0x10)
787787
{
788788
. = ALIGN(4);
789+
790+
/* create explicit symbol for __tdata_start so that it is loaded
791+
* into proper DROM region atributted by AT keyword below
792+
*/
793+
__tdata_start = ADDR(tdata);
794+
789795
_rodata_reserved_end = ABSOLUTE(.);
790796
_image_rodata_end = ABSOLUTE(.);
791797
} GROUP_DATA_LINK_IN(RODATA_REGION, ROMABLE_REGION)

0 commit comments

Comments
 (0)