feat: implement baremetal GC

fix: pthread gc

fix: xiao-esp32c3 symbol

refactor: use clite memset instead of linking

fix: stack top symbol
This commit is contained in:
Haolan
2025-09-16 09:39:23 +08:00
parent 2f65c98eb4
commit 812dfd45c9
14 changed files with 707 additions and 18 deletions

View File

@@ -1,6 +1,4 @@
__stack = ORIGIN(dram_seg) + LENGTH(dram_seg);
__MIN_STACK_SIZE = 0x1000;
_stack_top = __stack;
_heapEnd = ORIGIN(dram_seg) + LENGTH(dram_seg);
/* Default entry point */
ENTRY(_start)
@@ -104,6 +102,14 @@ SECTIONS
. += ORIGIN(iram_seg) == ORIGIN(dram_seg) ? 0 : _iram_end - _iram_start;
} > dram_seg
.stack (NOLOAD) :
{
__stack_end = .;
. = ALIGN(16);
. += 16K;
__stack = .;
}
.data :
{
_data_start = .;
@@ -148,7 +154,7 @@ SECTIONS
} > dram_seg
/* Check if data + heap + stack exceeds RAM limit */
ASSERT(_end <= __stack - __MIN_STACK_SIZE, "region DRAM overflowed by .data and .bss sections")
ASSERT(_end <= _heapEnd, "region DRAM overflowed by .data and .bss sections")
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
@@ -193,3 +199,8 @@ SECTIONS
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
}
_globals_start = _data_start;
_globals_end = _end;
_heapStart = _end;
_stack_top = __stack;

View File

@@ -1,5 +1,4 @@
__stack = ORIGIN(dram_seg) + LENGTH(dram_seg);
__MIN_STACK_SIZE = 0x2000;
_heapEnd = ORIGIN(dram_seg) + LENGTH(dram_seg);
ENTRY(_start)
SECTIONS
@@ -26,6 +25,14 @@ SECTIONS
the same address within the page on the next page up. */
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
.stack (NOLOAD) :
{
__stack_end = .;
. = ALIGN(16);
. += 16K;
__stack = .;
}
.rodata :
{
@@ -116,7 +123,7 @@ SECTIONS
. = DATA_SEGMENT_END (.);
/* Check if data + heap + stack exceeds RAM limit */
ASSERT(. <= __stack - __MIN_STACK_SIZE, "region DRAM overflowed by .data and .bss sections")
ASSERT(. <= _heapEnd, "region DRAM overflowed by .data and .bss sections")
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
@@ -165,4 +172,7 @@ SECTIONS
_sbss = __bss_start;
_ebss = _end;
_globals_start = _data_start;
_globals_end = _end;
_heapStart = _end;
_stack_top = __stack;

View File

@@ -19,8 +19,8 @@ MEMORY
/* 64k at the end of DRAM, after ROM bootloader stack
* or entire DRAM (for QEMU only)
*/
dram_seg (RW) : org = 0x3FFF0000 ,
len = 0x10000
dram_seg (RW) : org = 0x3ffae000 ,
len = 0x52000
}
INCLUDE "targets/esp32.app.elf.ld";