diff --git a/ports/raspberrypi/supervisor/internal_flash.c b/ports/raspberrypi/supervisor/internal_flash.c index b667112b5880..1b328cbc5a7b 100644 --- a/ports/raspberrypi/supervisor/internal_flash.c +++ b/ports/raspberrypi/supervisor/internal_flash.c @@ -49,11 +49,13 @@ static uint32_t m1_timing; static void save_psram_settings(void) { #ifdef PICO_RP2350 // We're about to invalidate the XIP cache, clean it first to commit any dirty writes to PSRAM - uint8_t *maintenance_ptr = (uint8_t *)XIP_MAINTENANCE_BASE; + volatile uint8_t *maintenance_ptr = (uint8_t *)XIP_MAINTENANCE_BASE; for (int i = 1; i < 16 * 1024; i += 8) { // Background info: https://forums.raspberrypi.com/viewtopic.php?t=378249 maintenance_ptr[i] = 0; // Clean + __compiler_memory_barrier(); maintenance_ptr[i - 1] = 0; // Explicitly invalidate + __compiler_memory_barrier(); } m1_timing = qmi_hw->m[1].timing; diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index ffa25d12404e..13e5abb61216 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -244,7 +244,7 @@ void port_heap_init(void) { _heap = tlsf_create_with_pool(heap_bottom, size, 64 * 1024 * 1024); _ram_pool = tlsf_get_pool(_heap); if (_psram_size > 0) { - _psram_pool = tlsf_add_pool(_heap, (void *)0x11000004, _psram_size - 4); + _psram_pool = tlsf_add_pool(_heap, (void *)0x11000000, _psram_size); } }