KDocs 研发资料库
  • 视频技术应用资料与文档入口汇总
  • Window下使用Makefile编译代码教程
  • AC52系列PWM使用说明文档
  • AC57系列PWM使用说明文档
  • 52 系列_串口外设的使用说明
  • 57 系列_串口外设的使用说明
  • AC52系列SPI使用说明文档
  • AC57系列SPI使用说明文档
  • AC52系列外部中断使用说明文档
  • AC57系列外部中断使用说明文档
  • AC54&56外部中断使用说明文档
  • AC52 红外捕获中断demo使用说明文档
  • 视频系列SDK汇总及获取方法
  • AC52系列软件典型问题整理文档获取
  • AC791N开发-入门到进阶开发指导文档(完善ing)
  • AC792N开发-入门到进阶开发指导文档(完善ing)
  • 792 littlefs文件系统配置
  • 792N系列 U盘单备份升级说明
  • 792x串口uart升级说明参考

AC52 系列虚拟u盘使用说明文档

📎 原始文档:https://www.kdocs.cn/l/ccZmua9Tpqcb AC52 系列虚拟u盘使用说明文档
目录
TOC \o "1-3" \h \u  HYPERLINK \l "_Toc131273148" 一、功能描述  PAGEREF _Toc131273148 \h 2
 HYPERLINK \l "_Toc131273149" 二、软硬件测试环境  PAGEREF _Toc131273149 \h 2
 HYPERLINK \l "_Toc131273150" 三、虚拟u盘环境配置  PAGEREF _Toc131273150 \h 2


一、功能描述

该功能可以使得AC52系列外挂的flash某一内存区域挂载上FAT文件系统,并且通过usb实现了虚拟U盘的功能。

二、软硬件测试环境

测试软件环境:V1.1.6 SDK。
测试硬件环境:5211开发板+8M的华邦flash。

三、虚拟u盘环境配置

板级文件配置参考:
image

注意正确选择文件系统挂载地址,挂载容量。
image

usb模式配置:
image

请在app_main函数加入测试逻辑:

  1. /*
  2.  * 应用程序主函数
  3.  */
  4. void app_main()
  5. {​
  6. //    if (!fdir_exist("mnt/spiflash")) {​
  7. ////        mount("spiflash", "mnt/spiflash", "sdfile", 0, NULL);
  8. //    ​}
  9.     mount_sd_to_fs(SDX_DEV);
  10.     err = upgrade_detect(SDX_DEV);
  11.     if (!err) {​
  12.         return;
  13.     ​}
  14. // 接电脑进盘符模式
  15.     os_time_dly(200);
  16.     set_usb_mass_storage();
  17.     return;
  18.     char buf[101]={​0​};
  19.     int l_cnt = 3;
  20.     struct imount *mt;
  21. #define FLASH_ROOT_PATH     "storage/extflash"
  22. #if 0//挂载文件系统
  23.     do{​
  24.         os_time_dly(100);
  25.         if (!fdir_exist(FLASH_ROOT_PATH)) {​
  26.             puts("fdir_exist == 0!\n");
  27.             mt = mount("extflash", FLASH_ROOT_PATH, "flashfs", 0, NULL);
  28.             if (!mt) {​
  29.                 puts("mount flashfs fail\n");
  30.                 int err0 = f_format("extflash","flashfs", 0);
  31.                 printf("f_format err_code:%d\n", err0);
  32.             ​}
  33.              else {​
  34.                 puts("mount flashfs suss\n");
  35.                 if (!fdir_exist(FLASH_ROOT_PATH)){​
  36.                     puts("mount suss but fdir no exist!!\n");
  37.                 ​}
  38.                 break;
  39.             ​}
  40.         ​}else{​
  41.             break;
  42.         ​}
  43.     ​}while(l_cnt--);
  44. #endif // 0
  45. #if 0
  46.     FILE* fp= fopen(FLASH_ROOT_PATH"/C/readme.txt", "w+");//"mnt/spiflash/
  47.     if(fp){​
  48.         puts("fopen ok\n");
  49.         fwrite(fp, "hello world!", 10);
  50.         fclose(fp);
  51.     ​}else{​
  52.            puts("fopen err\n");
  53.     ​}
  54. #else
  55.     //总是挂载失败请注意:检查jl_isd.bin超板级所设置的extflash大小和地址,每次烧录后将原来的文件系统给擦除了
  56.     mt = mount("extflash", FLASH_ROOT_PATH, "flashfs", 0, NULL);
  57.     if (!mt) {​
  58.         puts("mount flashfs fail\n");
  59.         return;
  60.     ​}
  61.     FILE* fp= fopen(FLASH_ROOT_PATH"/C/readme.txt", "r");//"mnt/spiflash/
  62.     if(fp){​
  63.         puts("fopen ok\n");
  64.         fread(fp, buf, 100);
  65.         printf("buf %s\n", buf);
  66.         fclose(fp);
  67.     ​}else{​
  68.            puts("fopen err\n");
  69.     ​}
  70. #endif // 0
  71.     return;
  72. ​}

杰理科技
2023年04月01日