diff --git a/fusee/fusee-secondary/src/fs_utils.c b/fusee/fusee-secondary/src/fs_utils.c index 59b2daa48..f3f7042b5 100644 --- a/fusee/fusee-secondary/src/fs_utils.c +++ b/fusee/fusee-secondary/src/fs_utils.c @@ -13,3 +13,14 @@ size_t read_from_file(void *dst, size_t dst_size, const char *filename) { return sz; } } + +size_t dump_to_file(const void *src, size_t src_size, const char *filename) { + FILE *file = fopen(filename, "wb+"); + if (file == NULL) { + return 0; + } else { + size_t sz = fwrite(src, 1, src_size, file); + fclose(file); + return sz; + } +} diff --git a/fusee/fusee-secondary/src/fs_utils.h b/fusee/fusee-secondary/src/fs_utils.h index 2f71275ff..9574370e1 100644 --- a/fusee/fusee-secondary/src/fs_utils.h +++ b/fusee/fusee-secondary/src/fs_utils.h @@ -5,5 +5,6 @@ #include "sdmmc.h" size_t read_from_file(void *dst, size_t dst_size, const char *filename); +size_t dump_to_file(const void *src, size_t src_size, const char *filename); #endif diff --git a/fusee/fusee-secondary/src/switch_fs.c b/fusee/fusee-secondary/src/switch_fs.c index fb0daab2f..c6a2a0d56 100644 --- a/fusee/fusee-secondary/src/switch_fs.c +++ b/fusee/fusee-secondary/src/switch_fs.c @@ -44,6 +44,7 @@ static int mmc_partition_initialize(device_partition_t *devpart) { if (mmcpart->mmc == &g_sd_mmc && !g_sd_mmc_initialized) { int rc = sdmmc_init(mmcpart->mmc, mmcpart->controller); if (rc == 0) { + sdmmc_set_write_enable(mmcpart->mmc, SDMMC_WRITE_ENABLED); g_sd_mmc_initialized = true; } return rc;