From 2ef9375c3d0c356f5b786104dec2eafb04edcb92 Mon Sep 17 00:00:00 2001 From: Nengzhuo Cai Date: Sun, 1 Dec 2024 07:52:29 -0500 Subject: [PATCH] NO_FLASH_SIZE option --- ports/espressif/boards/mystrix/board.h | 1 + src/ghostfat.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/mystrix/board.h b/ports/espressif/boards/mystrix/board.h index e43fb3e4..74c346fa 100644 --- a/ports/espressif/boards/mystrix/board.h +++ b/ports/espressif/boards/mystrix/board.h @@ -27,6 +27,7 @@ #define CUSTOM_BOOTLOADER_NAME "Mystrix" #define CUSTOM_LED +#define NO_FLASH_SIZE //--------------------------------------------------------------------+ // Button diff --git a/src/ghostfat.c b/src/ghostfat.c index a3cf3638..2daf8b6d 100644 --- a/src/ghostfat.c +++ b/src/ghostfat.c @@ -142,7 +142,10 @@ const char infoUf2File[] = "Model: " UF2_PRODUCT_NAME "\r\n" "Board-ID: " UF2_BOARD_ID "\r\n" "Date: " COMPILE_DATE "\r\n" - "Flash Size: 0x"; + #ifndef NO_FLASH_SIZE + "Flash Size: 0x" + #endif + ; TINYUF2_CONST char indexFile[] = "\n" @@ -288,8 +291,9 @@ void uf2_init(void) { // update CURRENT.UF2 file size info[FID_UF2].size = UF2_BYTE_COUNT; - // update INFO_UF2.TXT with flash size if having enough space (8 bytes) size_t txt_len = strlen(infoUf2File); + #ifndef NO_FLASH_SIZE + // update INFO_UF2.TXT with flash size if having enough space (8 bytes) size_t const max_len = sizeof(infoUf2File) - 1; if ( max_len - txt_len > 8) { u32_to_hexstr(_flash_size, infoUf2File + txt_len); @@ -300,6 +304,8 @@ void uf2_init(void) { txt_len += 6; } } + #endif + info[FID_INFO].size = txt_len; init_starting_clusters();