Skip to content

Commit

Permalink
NO_FLASH_SIZE option
Browse files Browse the repository at this point in the history
  • Loading branch information
203Null committed Dec 1, 2024
1 parent 29440ce commit 2ef9375
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions ports/espressif/boards/mystrix/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#define CUSTOM_BOOTLOADER_NAME "Mystrix"
#define CUSTOM_LED
#define NO_FLASH_SIZE

//--------------------------------------------------------------------+
// Button
Expand Down
10 changes: 8 additions & 2 deletions src/ghostfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] =
"<!doctype html>\n"
Expand Down Expand Up @@ -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);
Expand All @@ -300,6 +304,8 @@ void uf2_init(void) {
txt_len += 6;
}
}
#endif

info[FID_INFO].size = txt_len;

init_starting_clusters();
Expand Down

0 comments on commit 2ef9375

Please sign in to comment.