diff options
| author | Phil Howard <github@gadgetoid.com> | 2024-08-09 14:15:33 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-04-08 10:59:00 +1000 |
| commit | b7d5caf2a3e08fa90bbb09b43b29455e2c20eaf6 (patch) | |
| tree | 44fc16df810f650f50e670a621581e8a7dbbdfd8 | |
| parent | 11f057dd9a5801e23b39822b3a57cbfa8cd10f00 (diff) | |
rp2/mpconfigport: Configure heap for PSRAM.
PSRAM will be used exclusively if MICROPY_GC_SPLIT_HEAP == 0, it will be
added to RAM if MICROPY_GC_SPLIT_HEAP == 1, and the system will fall back
to RAM only if it's not detected.
Due to the size of PSRAM, GC stack was overflowing and causing the GC to
scan through the entire memory pool. This caused noticable slowdowns
during GC. Increase the stack from 256 to 4096 bytes to avoid overflow and
increase the stack entry type size to accomodate 8MB+ PSRAM.
Changes are:
- ports/rp2/mpconfigport.h: Make split-heap optional and enable by default.
- ports/rp2/mpconfigport.h: Increase GC stack entry type to uint32_t.
- ports/rp2/mpconfigport.h: Raise GC stack size.
Co-authored-by: Kirk Benell <kirk.benell@sparkfun.com>
Signed-off-by: Phil Howard <github@gadgetoid.com>
| -rw-r--r-- | ports/rp2/mpconfigport.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 28022ba42..3d6573726 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -86,7 +86,15 @@ #endif // Memory allocation policies +#if MICROPY_HW_ENABLE_PSRAM +#define MICROPY_GC_STACK_ENTRY_TYPE uint32_t +#define MICROPY_ALLOC_GC_STACK_SIZE (1024) // Avoid slowdown when GC stack overflow causes a full sweep of PSRAM-backed heap +#else #define MICROPY_GC_STACK_ENTRY_TYPE uint16_t +#endif +#ifndef MICROPY_GC_SPLIT_HEAP +#define MICROPY_GC_SPLIT_HEAP MICROPY_HW_ENABLE_PSRAM // whether PSRAM is added to or replaces the heap +#endif #define MICROPY_ALLOC_PATH_MAX (128) #define MICROPY_QSTR_BYTES_IN_HASH (1) |
