



#define STORAGE_LUN_NBR 1
#define STORAGE_BLK_NBR 0x10000
#define STORAGE_BLK_SIZ 0x200
将其改成对应的大小,比如W25Q256的配置
#define STORAGE_LUN_NBR 1
#define STORAGE_BLK_NBR 8192
#define STORAGE_BLK_SIZ 4096
在MX_USB_Device_Init函数中加入W25Q256的初始化函数

此函数是挂载Flash,若没有发现文件系统则创建,或则是调用擦除全片的函数擦除,然后在电脑上格式化也行。
FRESULT fileSystemInit(void)
{f_res = f_mount(&fs, USER_Path, 1);if (f_res != FR_OK){//No Disk file system,format disk !f_res = f_mkfs(USER_Path, FM_FAT, 4096, work, sizeof work);if (f_res == FR_OK){f_res = f_mount(&fs, USER_Path, 1);if (f_res == 0){return FR_OK;}else{debug_print("f_mount error %d\n",f_res);return FR_DISK_ERR;}}else{debug_print("f_mkfs error %d\n",f_res);return FR_DISK_ERR;}}else{debug_print("f_mount ok %d\n",f_res);}return FR_OK;
}