Skip to content

Commit 513cc7a

Browse files
committed
Enable use of larger sized GhostFAT volume
1 parent 1b08161 commit 513cc7a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/usb/uf2/ghostfat.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct TextFile {
6868
#define BPB_RESERVED_SECTORS ( 1)
6969
#define BPB_NUMBER_OF_FATS ( 2)
7070
#define BPB_ROOT_DIR_ENTRIES ( 64)
71-
#define BPB_TOTAL_SECTORS CFG_UF2_NUM_BLOCKS // 0x101dd is absolute max at current code commit
71+
#define BPB_TOTAL_SECTORS (0x10109) // Use a fixed (near max) number of sectors for the FAT file system
7272
#define BPB_MEDIA_DESCRIPTOR_BYTE (0xF8)
7373
#define FAT_ENTRY_SIZE (2)
7474
#define FAT_ENTRIES_PER_SECTOR (BPB_SECTOR_SIZE / FAT_ENTRY_SIZE)
@@ -78,6 +78,10 @@ struct TextFile {
7878
#define DIRENTRIES_PER_SECTOR (BPB_SECTOR_SIZE/sizeof(DirEntry))
7979
#define ROOT_DIR_SECTOR_COUNT (BPB_ROOT_DIR_ENTRIES/DIRENTRIES_PER_SECTOR)
8080

81+
#if defined(CFG_UF2_NUM_BLOCKS)
82+
STATIC_ASSERT(BPB_TOTAL_SECTORS >= CFG_UF2_NUM_BLOCKS); // configuration used, and asked for a larger size GhostFAT?
83+
#endif
84+
8185
STATIC_ASSERT(BPB_SECTOR_SIZE == 512); // GhostFAT does not support other sector sizes (currently)
8286
STATIC_ASSERT(BPB_SECTORS_PER_CLUSTER == 1); // GhostFAT presumes one sector == one cluster (for simplicity)
8387
STATIC_ASSERT(BPB_NUMBER_OF_FATS == 2); // FAT highest compatibility

0 commit comments

Comments
 (0)