Skip to content

Use SOC_DRAM_LOW/HIGH for heap-range fallback on all targets.#3061

Merged
floitsch merged 12 commits into
masterfrom
floitsch/roll-esp-idf-5.4.2.esp32p4.heap-ranges
May 17, 2026
Merged

Use SOC_DRAM_LOW/HIGH for heap-range fallback on all targets.#3061
floitsch merged 12 commits into
masterfrom
floitsch/roll-esp-idf-5.4.2.esp32p4.heap-ranges

Conversation

@floitsch
Copy link
Copy Markdown
Member

The hard-coded fallback in OS::get_heap_memory_range() is only used when cmpctmalloc doesn't populate lowest_address/highest_address (which shouldn't happen in normal Toit ESP32 builds, but acts as a safety net).

Previous values were stale or wrong:

  • ESP32-C3 and -C6 fell through to the ESP32 #else branch with addresses (0x3FFC0000) that don't exist on those chips.
  • ESP32-S2 had the wrong start address, missing the low 64 KB of DRAM.
  • ESP32-S3 covered 384 KB starting at 0x3FCA0000, missing the lower ~96 KB of valid DRAM.
  • ESP32 missed the low pools (BT/ROM-shared region).

Use SOC_DRAM_LOW/SOC_DRAM_HIGH from <soc/soc.h> uniformly; the GC's ONLY_FOR_MALLOC adjustment trims the low part anyway.

floitsch and others added 10 commits May 11, 2026 21:13
The hard-coded fallback in OS::get_heap_memory_range() is only used
when cmpctmalloc doesn't populate lowest_address/highest_address (which
shouldn't happen in normal Toit ESP32 builds, but acts as a safety net).

Previous values were stale or wrong:
- ESP32-C3 and -C6 fell through to the ESP32 #else branch with addresses
  (0x3FFC0000) that don't exist on those chips.
- ESP32-S2 had the wrong start address, missing the low 64 KB of DRAM.
- ESP32-S3 covered 384 KB starting at 0x3FCA0000, missing the lower
  ~96 KB of valid DRAM.
- ESP32 missed the low pools (BT/ROM-shared region).

Use SOC_DRAM_LOW/SOC_DRAM_HIGH from <soc/soc.h> uniformly; the GC's
ONLY_FOR_MALLOC adjustment trims the low part anyway.
Base automatically changed from floitsch/roll-esp-idf-5.4.2.esp32p4 to master May 17, 2026 22:25
@floitsch
Copy link
Copy Markdown
Member Author

TBR.

@floitsch floitsch merged commit 9e0de5d into master May 17, 2026
3 checks passed
@floitsch floitsch deleted the floitsch/roll-esp-idf-5.4.2.esp32p4.heap-ranges branch May 17, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant