diff --git a/stm32/COLDCARD_MK4/file_time.c b/stm32/COLDCARD_MK4/file_time.c index 59c5abfb..1ae75450 100644 --- a/stm32/COLDCARD_MK4/file_time.c +++ b/stm32/COLDCARD_MK4/file_time.c @@ -2,12 +2,12 @@ // // AUTO-generated. // -// built: 2024-03-10 -// version: 1.0.0Q +// built: 2024-04-11 +// version: 5.3.0 // #include // this overrides ports/stm32/fatfs_port.c uint32_t get_fattime(void) { - return 0x586a0800UL; + return 0x588b2860UL; } diff --git a/stm32/COLDCARD_MK4/psramdisk.c b/stm32/COLDCARD_MK4/psramdisk.c index 813f7efb..b1fc0d69 100644 --- a/stm32/COLDCARD_MK4/psramdisk.c +++ b/stm32/COLDCARD_MK4/psramdisk.c @@ -499,13 +499,30 @@ static void psram_init_vfs(fs_user_mount_t *vfs, bool readonly) { vfs->blockdev.u.ioctl[1] = MP_OBJ_FROM_PTR(&psram_obj); } +// psram_memset4() +// + static inline void +psram_memset4(void *dest_addr, uint32_t value, uint32_t byte_len) +{ + // Fast, aligned, and bug-fixing memset + // - PSRAM can starve the internal bus with too many writes, too fast + // - leads to a weird crash where SRAM bus (at least) is locked up, but flash works + uint32_t *dest = (uint32_t *)dest_addr; + + for(; byte_len; byte_len-=4, dest++) { + *dest = value; + + asm("nop; nop; nop;"); // tested value, do not reduce + } +} + mp_obj_t psram_wipe_and_setup(mp_obj_t unused_self) { // Erase and reformat filesystem // - you probably should unmount it, before calling this // Wipe contents for security. - memset(PSRAM_TOP_BASE, 0x21, BLOCK_SIZE * BLOCK_COUNT); + psram_memset4(PSRAM_TOP_BASE, 0x12345678, BLOCK_SIZE * BLOCK_COUNT); // Build obj to handle blockdev protocol fs_user_mount_t vfs = {0};