Skip to content

Commit 28e09e0

Browse files
committed
READ CAPACITY uses CFG_UF2_NUM_BLOCKS,
Therefore, use that existing configuration setting for BPB_TOTAL_BLOCKS.
1 parent 513cc7a commit 28e09e0

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/usb/uf2/ghostfat.c

Lines changed: 1 addition & 5 deletions
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 (0x10109) // Use a fixed (near max) number of sectors for the FAT file system
71+
#define BPB_TOTAL_SECTORS CFG_UF2_NUM_BLOCKS
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,10 +78,6 @@ 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-
8581
STATIC_ASSERT(BPB_SECTOR_SIZE == 512); // GhostFAT does not support other sector sizes (currently)
8682
STATIC_ASSERT(BPB_SECTORS_PER_CLUSTER == 1); // GhostFAT presumes one sector == one cluster (for simplicity)
8783
STATIC_ASSERT(BPB_NUMBER_OF_FATS == 2); // FAT highest compatibility

src/usb/uf2/uf2cfg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Family ID for updating Bootloader
88
#define CFG_UF2_FAMILY_BOOT_ID 0xd663823c
99

10-
#define CFG_UF2_NUM_BLOCKS 8000 // at least 4,1 MB for FAT16
10+
#define CFG_UF2_NUM_BLOCKS 0x10109 // just under 32MB
1111
#define CFG_UF2_FLASH_SIZE (1024*1024) // 1 MB
1212

1313
// Application Address Space

0 commit comments

Comments
 (0)