FTP 测试通过

This commit is contained in:
2026-08-28 12:22:10 +08:00
parent cf33171c8f
commit 615a9b13e9
10 changed files with 437 additions and 128 deletions

View File

@@ -168,9 +168,33 @@ void MX_FREERTOS_Init(void) {
void StartDefaultTask(void *argument)
{
/* USER CODE BEGIN StartDefaultTask */
/* 测试任务已全部收归 ch395fTestTask 统一调度,本任务不再承担任何测试 */
(void)argument;
/* 系统启动期挂载 NAND 上的 FatFS 卷,供 FTP 及其它模块访问。
* f_mount(forced=1) 会触发 disk_initialize() → nand_ftl_init()
* dhara_map_resume。此前默认构建从未挂载导致 FTP 的
* LIST/STOR/RETR 全部返回 550f_opendir 失败)。
* 若卷为空FR_NO_FILESYSTEM如恢复/坏块重建后清空),则首次自动
* 格式化建卷MKFS_PARM 与存储测试一致FM_FAT32 / 无分区表)。 */
static FATFS default_fatfs;
FRESULT fr = f_mount(&default_fatfs, "", 1);
if (fr == FR_NO_FILESYSTEM) {
DBG_INFO("[FS] no FAT volume, formatting NAND...");
static uint8_t fs_work[FF_MAX_SS];
MKFS_PARM opts = { FM_FAT32, 0, 0, 0, 0 };
fr = f_mkfs("", &opts, fs_work, sizeof(fs_work));
if (fr == FR_OK) {
fr = f_mount(&default_fatfs, "", 1);
} else {
DBG_ERROR("[FS] f_mkfs failed (fr=%d)", (int)fr);
}
}
if (fr == FR_OK) {
DBG_INFO("[FS] FATFS mounted");
} else {
DBG_ERROR("[FS] f_mount failed (fr=%d)", (int)fr);
}
for (;;) {
osDelay(1000);
}