Skip to content

Commit c1953a2

Browse files
committed
ports/rp2: Skip flash copy buffer for non PSRAM.
Avoid an extra 4k static buffer being included in builds that do not use PSRAM. Signed-off-by: Phil Howard <[email protected]>
1 parent 21eb479 commit c1953a2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ports/rp2/rp2_flash.c

+4
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,14 @@ static mp_obj_t rp2_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
264264
offset += mp_obj_get_int(args[3]);
265265
}
266266

267+
#if defined(MICROPY_HW_PSRAM_CS_PIN) && MICROPY_HW_ENABLE_PSRAM
267268
if ((uintptr_t)bufinfo.buf >= SRAM_BASE) {
269+
#endif
268270
mp_uint_t atomic_state = begin_critical_flash_section();
269271
flash_range_program(self->flash_base + offset, bufinfo.buf, bufinfo.len);
270272
end_critical_flash_section(atomic_state);
271273
mp_event_handle_nowait();
274+
#if defined(MICROPY_HW_PSRAM_CS_PIN) && MICROPY_HW_ENABLE_PSRAM
272275
} else {
273276
size_t bytes_left = bufinfo.len;
274277
size_t bytes_offset = 0;
@@ -287,6 +290,7 @@ static mp_obj_t rp2_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
287290
mp_event_handle_nowait();
288291
}
289292
}
293+
#endif
290294

291295
// TODO check return value
292296
return mp_const_none;

0 commit comments

Comments
 (0)