The approach is OK, and consistent with how other systems might separate their stack and heap. However, it's inconsistent with the official Teensy 4 runtime, which allocates the heap in OCRAM2.
This PR moves the heap into OCRAM2. It's maximum possible size is 512KB (all of OCRAM2). In practice, there may be DMA buffers allocated in the memory region, so not all of the space is available. Use heap_len() to compute the actual amount for a given program.
The heap starting address is in DTCM, right after
.uninit
. Observed usingThe approach is OK, and consistent with how other systems might separate their stack and heap. However, it's inconsistent with the official Teensy 4 runtime, which allocates the heap in OCRAM2.
This PR moves the heap into OCRAM2. It's maximum possible size is 512KB (all of OCRAM2). In practice, there may be DMA buffers allocated in the memory region, so not all of the space is available. Use
heap_len()
to compute the actual amount for a given program.