mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
0c17b918fb
Add full flash XIP support for ESP32, enabling code and read-only data to execute/load directly from flash via the MMU cache rather than consuming precious SRAM. This increases available RAM from ~328KB to effectively unlimited for code/rodata, while keeping ~121KB for the Go heap. Changes: - src/device/esp/esp32.S: Add MMU initialization in call_start_cpu0 - Call ROM bootloader mmu_init() and cache_flash_mmu_set() to map DROM/IROM - Enable flash cache via ROM Cache_Read_Enable() - Fix tinygo_scanCurrentStack to spill all register windows for GC - targets/esp32-interrupts.S: Add exception diagnostics - targets/esp32.ld: Major linker script restructure for XIP - Add DROM (4MB @ 0x3F400000) and IROM (4MB @ 0x400D0000) regions - Move .rodata to DROM, main .text to IROM (both flash-mapped) - Keep boot code, vectors, and WiFi blob IRAM sections in SRAM0 - Create WiFi arena in SRAM1 pool 7/6 (64KB @ 0x3FFF0000) - Move .bss and heap to SRAM2 (200KB @ 0x3FFAE000), avoiding ROM/MAC regions - Add _drom_flash_addr variable (patched by builder with flash offset) - targets/esp32.json: Add linker wrap flags for malloc/free and WiFi functions Signed-off-by: deadprogram <ron@hybridgroup.com>
31 lines
983 B
JSON
31 lines
983 B
JSON
{
|
|
"inherits": ["xtensa"],
|
|
"inheritable-only": true,
|
|
"cpu": "esp32",
|
|
"features": "+atomctl,+bool,+clamps,+coprocessor,+debug,+density,+dfpaccel,+div32,+exception,+fp,+highpriinterrupts,+interrupt,+loop,+mac16,+memctl,+minmax,+miscsr,+mul32,+mul32high,+nsa,+prid,+regprotect,+rvector,+s32c1i,+sext,+threadptr,+timerint,+windowed",
|
|
"build-tags": ["esp32", "esp"],
|
|
"scheduler": "tasks",
|
|
"serial": "uart",
|
|
"linker": "ld.lld",
|
|
"ldflags": [
|
|
"--wrap=malloc",
|
|
"--wrap=calloc",
|
|
"--wrap=free",
|
|
"--wrap=realloc",
|
|
"--wrap=ppCheckTxConnTrafficIdle"
|
|
],
|
|
"default-stack-size": 8192,
|
|
"rtlib": "compiler-rt",
|
|
"libc": "picolibc",
|
|
"linkerscript": "targets/esp32.ld",
|
|
"extra-files": [
|
|
"src/device/esp/esp32.S",
|
|
"targets/esp32-interrupts.S",
|
|
"src/internal/task/task_stack_esp32.S"
|
|
],
|
|
"binary-format": "esp32",
|
|
"flash-method": "esp32flash",
|
|
"emulator": "qemu-system-xtensa -machine esp32 -nographic -drive file={img},if=mtd,format=raw",
|
|
"gdb": ["xtensa-esp32-elf-gdb"]
|
|
}
|