Parcourir la source

add:增加780系列,模块中的sd_1010demo以及 tf_card demo 的大文件上传模块。按照新的下载路径,将各型号的代码重新验证,更改readme以及日志。

wangpenglin il y a 4 mois
Parent
commit
101c7ec9e1

+ 4 - 4
module/Air780EHM_Air780EHV_Air780EGH/demo/accessory_board/AirMICROSD_1010/http_download_file.lua

@@ -47,11 +47,11 @@ local function http_download_file_task()
     log.info("HTTP下载", "开始下载任务")
 
     -- 核心下载操作开始 (支持http和https)
-    -- local code, headers, body = http.request("GET", "...", nil, nil, {dst = "/sd/1.mp3"}).wait()
+    --local code, headers, body = http.request("GET", "...", nil, nil, {dst = "/sd/3_23MB.bin"}).wait()
     -- 其中 "..."为url地址, 支持 http和https, 支持域名, 支持自定义端口。
     local code, headers, body_size = http.request("GET",
-                                    "https://gitee.com/openLuat/LuatOS/raw/master/module/Air780EHM_Air780EHV_Air780EGH/demo/audio/1.mp3",
-                                    nil, nil, {dst = "/sd/1.mp3"}).wait()
+                                   "https://cdn.openluat-erp.openluat.com/erp_site_file/product_file/AirM2M_780EHT_V2017_LTE_AT.dfota.bin",
+                                    nil, nil, {dst = "/sd/3_23MB.bin"}).wait()
     -- 阶段3: 记录下载结果
     log.info("HTTP下载", "下载完成", 
         code==200 and "success" or "error", 
@@ -63,7 +63,7 @@ local function http_download_file_task()
         
     if code == 200 then
         -- 获取实际文件大小
-        local actual_size = io.fileSize("/sd/1.mp3")
+        local actual_size = io.fileSize("/sd/3_23MB.bin")
         log.info("HTTP下载", "文件大小验证", "预期:", body_size, "实际:", actual_size)
         
         if actual_size~= body_size then

+ 99 - 0
module/Air780EHM_Air780EHV_Air780EGH/demo/accessory_board/AirMICROSD_1010/http_upload_file.lua

@@ -0,0 +1,99 @@
+--[[
+@module http_upload_file
+@summary TF卡大文件httpplus上传模块
+@version 1.0.0
+@date 2025.08.25
+@author 王棚嶙
+@usage
+本文件演示通过httpplus库将TF卡中的大文件上传到HTTP服务器:
+1. 网络就绪检测
+2. TF卡文件系统挂载
+3. 大文件上传功能
+4. 上传结果记录
+本文件没有对外接口,直接在main.lua中require "http_upload_file"即可
+]]
+-- 加载httpplus扩展库,不可省略
+local httpplus = require "httpplus"
+
+local function http_upload_task()
+    -- 阶段1: 网络就绪检测
+    while not socket.adapter(socket.dft()) do
+        log.warn("HTTP上传", "等待网络连接", socket.dft())
+        -- 待IP_READY消息,超时设为1秒
+        sys.waitUntil("IP_READY", 1000)
+    end
+
+    -- 检测到了IP_READY消息
+    log.info("HTTP上传", "网络已就绪", socket.dft())
+
+    -- 在Air780EHM/EHV/EGH核心板上TF卡的的pin_cs为gpio8,spi_id为0.请根据实际硬件修改
+    spi_id, pin_cs = 0, 8
+    spi.setup(spi_id, nil, 0, 0, 400 * 1000)
+    -- 初始化后拉高pin_cs,准备开始挂载TF卡
+    gpio.setup(pin_cs, 1)
+    
+
+    -- 挂载文件系统
+    local mount_ok = fatfs.mount(fatfs.SPI, "/sd", spi_id, pin_cs, 24 * 1000 * 1000)
+    if not mount_ok then
+        log.error("HTTP上传", "文件系统挂载失败")
+        fatfs.unmount("/sd")
+        spi.close(spi_id)
+        return
+    end
+
+    -- 阶段3: 检查要上传的文件是否存在
+    -- 替换为实际的文件路径
+    local upload_file_path ="/sd/3_23MB.bin" 
+    if not io.exists(upload_file_path) then
+        log.error("HTTP上传", "要上传的文件不存在", upload_file_path)
+        fatfs.unmount("/sd")
+        spi.close(spi_id)
+        return
+    end
+
+    -- 获取文件大小
+    local file_size = io.fileSize(upload_file_path)
+    log.info("HTTP上传", "准备上传文件", upload_file_path, "大小:", file_size, "字节")
+
+    -- 阶段4: 执行文件上传
+    log.info("HTTP上传", "开始上传任务")
+    
+    -- 使用httpplus库上传文件,参考httpplus_app_post_file的实现
+    -- hhtplus.request接口支持单文件上传、多文件上传、单文本上传、多文本上传、单/多文本+单/多文件上传
+    -- http://airtest.openluat.com:2900/uploadFileToStatic 仅支持单文件上传,并且上传的文件name必须使用"uploadFile"
+    -- 所以此处仅演示了单文件上传功能,并且"uploadFile"不能改成其他名字,否则会出现上传失败的应答
+    local code, response = httpplus.request({
+        url = "http://airtest.openluat.com:2900/uploadFileToStatic",
+        files = {
+            -- 服务器要求文件名必须为"uploadFile"
+            ["uploadFile"] = upload_file_path, 
+        },
+    })
+
+    -- 阶段5: 记录上传结果
+    log.info("HTTP上传", "上传完成", 
+        code == 200 and "success" or "error", 
+        code)
+    
+    if code == 200 then
+        log.info("HTTP上传", "服务器响应头", json.encode(response.headers or {}))
+        local body = response.body and response.body:query()
+        log.info("HTTP上传", "服务器响应体长度", body and body:len() or 0)
+        
+        -- 可以进一步解析服务器响应
+        if body then
+            log.info("HTTP上传", "服务器响应内容", body:len() > 512 and "内容过长,不显示" or body)
+        end
+    else
+        log.error("HTTP上传", "上传失败", code)
+    end
+
+    -- 阶段6: 资源清理
+    fatfs.unmount("/sd")
+    spi.close(spi_id)
+    log.info("HTTP上传", "资源清理完成")
+end
+
+-- 创建上传任务
+sys.taskInit(http_upload_task)

+ 6 - 3
module/Air780EHM_Air780EHV_Air780EGH/demo/accessory_board/AirMICROSD_1010/main.lua

@@ -74,14 +74,17 @@ end
 
 
 
---[[在加载以下两个功能时,建议分别打开进行测试,因为文件操作和http下载功能是异步操作。
+--[[在加载以下三个功能时,建议分别打开进行测试,因为文件操作,http下载功能和http大文件上传功能是异步操作。
 放到一个项目中,如果加载的时间点是随机的,就会出现tfcard_app在spi.setup和fatfs挂载文件系统之后,
-还没有释放资源,然后http_download_file又去重复spi.setup和fatfs挂载文件系统了,不符合正常的业务逻辑,用户在参考编程的时候也要注意。]]
+还没有释放资源,然后http_download_file或http_upload_file又去重复spi.setup和fatfs挂载文件系统了,
+不符合正常的业务逻辑,用户在参考编程的时候也要注意。]]
 
 --加载tf卡测试应用模块
 require "tfcard_app"
 --加载HTTP下载存入TF卡功能演示模块
---require "http_download_file"
+-- require "http_download_file"
+--加载HTTP上传文件到服务器的功能演示模块
+-- require "http_upload_file"
 
 
 -- 用户代码已结束---------------------------------------------

+ 110 - 66
module/Air780EHM_Air780EHV_Air780EGH/demo/accessory_board/AirMICROSD_1010/readme.md

@@ -3,8 +3,9 @@
 本demo演示了在嵌入式环境中对TF卡(SD卡)的完整操作流程,覆盖了从文件系统挂载到高级文件操作的完整功能链。项目分为两个核心模块:
 
 1、main.lua:主程序入口 <br> 
-2、tfcard_app.lua:TF卡基础应用模块,实现文件系统管理、文件操作和目录管理功能。<br> 
-3、http_download_file.lua:HTTP下载模块,实现网络检测与文件下载到TF卡的功能
+2、tfcard_app.lua:TF卡基础应用模块,实现文件系统管理、文件操作和目录管理功能<br> 
+3、http_download_file.lua:HTTP下载模块,实现网络检测与文件下载到TF卡的功能<br> 
+4、http_upload_file.lua:HTTP上传模块,实现网络检测与文件上传到服务器的功能<br> 
 
 ## **演示功能概述**
 
@@ -15,11 +16,12 @@
 - 启动一个循环定时器,每隔3秒钟打印一次总内存,实时的已使用内存,历史最高的已使用内存情况方便分析内存使用是否有异常
 - 加载tfcard_app模块(通过require "tfcard_app")
 - 加载http_download_file模块(通过require "http_download_file")
+- 加载http_upload_file模块(通过require "http_upload_file")
 - 最后运行sys.run()。
 
 
 
-### 3、TF卡核心演示模块(tfcard_app.lua)
+### 2、TF卡核心演示模块(tfcard_app.lua)
 
 #### 文件系统管理
 
@@ -49,7 +51,7 @@
 
 - 资源清理(卸载/SPI关闭)
 
-### 4、HTTP下载功能 (http_download_file.lua)
+### 3、HTTP下载功能 (http_download_file.lua)
 
 #### 文件系统管理
 
@@ -64,6 +66,20 @@
 
 - HTTP下载
 
+### 4、HTTP上传功能 (http_upload_file.lua)
+
+#### 文件系统管理
+
+- SPI初始化与挂载
+
+#### 网络就绪检测
+
+- 1秒循环等待IP就绪
+- 网络故障处理机制
+
+#### 安全上传
+
+- HTTP上传
 
 #### 结果处理
 
@@ -95,7 +111,7 @@
 |  GND(任意)      |          GND          |
 |  VDD_EXT        |          3V3         |
 |  GPIO8/SPI0_CS  |        spi_cs       |
-|  SPI0_SLK       |        spi_clk,时钟       |
+|  SPI0_CLK       |        spi_clk,时钟       |
 |  SPI0_MOSI      |  spi_mosi,主机输出,从机输入|
 |  SPI0_MISO      |  spi_miso,主机输入,从机输出|
 
@@ -119,72 +135,100 @@ Air780EHV:https://docs.openluat.com/air780ehv/luatos/firmware/version/
 
 ```lua
 (1)TF卡初始化与挂载
-[2025-08-24 19:51:24.152][000000001.389] SPI_HWInit 552:spi1 speed 2000000,1994805,154
-[2025-08-24 19:51:24.213][000000002.390] D/fatfs init sdcard at spi=1 cs=20
-[2025-08-24 19:51:24.286][000000002.390] SPI_SetNewConfig 996:spi1 speed 400000,400000
-[2025-08-24 19:51:24.329][000000002.408] SPI_SetNewConfig 996:spi1 speed 24000000,25600000
-[2025-08-24 19:51:24.383][000000002.408] D/SPI_TF 卡容量 122138624KB
-[2025-08-24 19:51:24.430][000000002.408] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
-[2025-08-24 19:51:24.477][000000002.412] I/user.fatfs.mount 挂载成功 0
-[2025-08-24 19:51:24.535][000000002.617] I/user.fatfs getfree {"free_sectors":244262144,"total_kb":122132480,"free_kb":122131072,"total_sectors":244264960}
-[2025-08-24 19:51:24.583][000000002.618] I/user.fs lsmount [{"fs":"ec7xx","path":""},{"fs":"inline","path":"\/lua\/"},{"fs":"ram","path":"\/ram\/"},{"fs":"luadb","path":"\/luadb\/"},{"fs":"fatfs","path":"\/sd"}]
+[2025-11-14 11:49:12.769][000000000.278] SPI_HWInit 552:spi0 speed 2000000,1994805,154
+[2025-11-14 11:49:12.788][000000000.279] D/fatfs init sdcard at spi=0 cs=8
+[2025-11-14 11:49:12.811][000000000.407] D/SPI_TF 卡容量 125173760KB
+[2025-11-14 11:49:12.822][000000000.408] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
+[2025-11-14 11:49:12.835][000000000.412] I/user.fatfs.mount 挂载成功 0
+[2025-11-14 11:49:12.844][000000000.665] I/user.fatfs getfree {"free_sectors":250335488,"total_kb":125168512,"free_kb":125167744,"total_sectors":250337024}
+[2025-11-14 11:49:12.873][000000000.666] I/user.fs lsmount [{"fs":"ec7xx","path":""},{"fs":"inline","path":"\/lua\/"},{"fs":"ram","path":"\/ram\/"},{"fs":"luadb","path":"\/luadb\/"},{"fs":"fatfs","path":"\/sd"}]
+
 
 
 (2)文件操作演示
-[2025-08-24 19:51:24.685][000000002.619] I/user.文件操作 ===== 开始文件操作 =====
-[2025-08-24 19:51:25.145][000000003.032] I/user.io.mkdir 目录创建成功 路径:/sd/io_test
-[2025-08-24 19:51:25.231][000000003.043] I/user.文件创建 文件写入成功 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.297][000000003.046] I/user.io.exists 文件存在 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.376][000000003.049] I/user.io.fileSize 文件大小:41字节 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.467][000000003.052] I/user.文件读取 路径:/sd/io_test/boottime 内容:这是io库API文档示例的测试内容
-[2025-08-24 19:51:25.547][000000003.056] I/user.启动计数 文件内容: 这是io库API文档示例的测试内容 十六进制: E8BF99E698AF696FE5BA93415049E69687E6A1A3E7A4BAE4BE8BE79A84E6B58BE8AF95E58685E5AEB9 82
-[2025-08-24 19:51:25.616][000000003.056] I/user.启动计数 当前值: 0
-[2025-08-24 19:51:25.693][000000003.057] I/user.启动计数 更新值: 1
-[2025-08-24 19:51:25.736][000000003.068] I/user.文件写入 路径:/sd/io_test/boottime 内容: 1
-[2025-08-24 19:51:25.795][000000003.081] I/user.文件创建 路径:/sd/io_test/test_a 初始内容:ABC
-[2025-08-24 19:51:25.852][000000003.088] I/user.文件追加 路径:/sd/io_test/test_a 追加内容:def
-[2025-08-24 19:51:25.909][000000003.091] I/user.文件验证 路径:/sd/io_test/test_a 内容:ABCdef 结果: 成功
-[2025-08-24 19:51:25.954][000000003.102] I/user.文件创建 路径:/sd/io_test/testline 写入3行文本
-[2025-08-24 19:51:26.001][000000003.106] I/user.按行读取 路径:/sd/io_test/testline 第1行: abc
-[2025-08-24 19:51:26.048][000000003.106] I/user.按行读取 路径:/sd/io_test/testline 第2行: 123
-[2025-08-24 19:51:26.093][000000003.107] I/user.按行读取 路径:/sd/io_test/testline 第3行: wendal
-[2025-08-24 19:51:26.140][000000003.112] I/user.os.rename 文件重命名成功 原路径:/sd/io_test/test_a 新路径:/sd/io_test/renamed_file.txt
-[2025-08-24 19:51:26.188][000000003.116] D/fatfs f_open /io_test/test_a 4
-[2025-08-24 19:51:26.238][000000003.116] D/vfs fopen /sd/io_test/test_a r not found
-[2025-08-24 19:51:26.312][000000003.117] I/user.验证结果 重命名验证成功 新文件存在 原文件不存在
-[2025-08-24 19:51:26.367][000000003.117] I/user.目录操作 ===== 开始目录列举 =====
-[2025-08-24 19:51:26.424][000000003.121] I/user.fs lsdir [{"name":"boottime","size":0,"type":0},{"name":"testline","size":0,"type":0},{"name":"renamed_file.txt","size":0,"type":0}]
-[2025-08-24 19:51:26.478][000000003.127] I/user.os.remove 文件删除成功 路径:/sd/io_test/renamed_file.txt
-[2025-08-24 19:51:26.539][000000003.129] D/fatfs f_open /io_test/renamed_file.txt 4
-[2025-08-24 19:51:26.593][000000003.130] D/vfs fopen /sd/io_test/renamed_file.txt r not found
-[2025-08-24 19:51:26.656][000000003.130] I/user.验证结果 renamed_file.txt文件删除验证成功
-[2025-08-24 19:51:26.734][000000003.137] I/user.os.remove testline文件删除成功 路径:/sd/io_test/testline
-[2025-08-24 19:51:26.856][000000003.139] D/fatfs f_open /io_test/testline 4
-[2025-08-24 19:51:26.922][000000003.140] D/vfs fopen /sd/io_test/testline r not found
-[2025-08-24 19:51:27.113][000000003.140] I/user.验证结果 testline文件删除验证成功
-[2025-08-24 19:51:27.197][000000003.147] I/user.os.remove 文件删除成功 路径:/sd/io_test/boottime
-[2025-08-24 19:51:27.251][000000003.149] D/fatfs f_open /io_test/boottime 4
-[2025-08-24 19:51:27.302][000000003.150] D/vfs fopen /sd/io_test/boottime r not found
-[2025-08-24 19:51:27.365][000000003.150] I/user.验证结果 boottime文件删除验证成功
-[2025-08-24 19:51:27.407][000000003.158] I/user.io.rmdir 目录删除成功 路径:/sd/io_test
-[2025-08-24 19:51:27.461][000000003.159] D/fatfs f_open /io_test 4
-[2025-08-24 19:51:27.536][000000003.159] D/vfs fopen /sd/io_test r not found
-[2025-08-24 19:51:27.610][000000003.159] I/user.验证结果 目录删除验证成功
-[2025-08-24 19:51:27.668][000000003.160] I/user.文件操作 ===== 文件操作完成 =====
-[2025-08-24 19:51:27.712][000000003.160] I/user.系统清理 开始执行关闭操作...
-[2025-08-24 19:51:27.772][000000003.160] I/user.文件系统 卸载成功
-[2025-08-24 19:51:27.867][000000003.160] I/user.SPI接口 已关闭
+[2025-11-14 11:49:12.880][000000000.666] I/user.文件操作 ===== 开始文件操作 =====
+[2025-11-14 11:49:13.111][000000001.254] I/user.io.mkdir 目录创建成功 路径:/sd/io_test
+[2025-11-14 11:49:13.116][000000001.267] I/user.文件创建 文件写入成功 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.123][000000001.270] I/user.io.exists 文件存在 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.127][000000001.273] I/user.io.fileSize 文件大小:41字节 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.131][000000001.276] I/user.文件读取 路径:/sd/io_test/boottime 内容:这是io库API文档示例的测试内容
+[2025-11-14 11:49:13.148][000000001.280] I/user.启动计数 文件内容: 这是io库API文档示例的测试内容 十六进制: E8BF99E698AF696FE5BA93415049E69687E6A1A3E7A4BAE4BE8BE79A84E6B58BE8AF95E58685E5AEB9 82
+[2025-11-14 11:49:13.157][000000001.280] I/user.启动计数 当前值: 0
+[2025-11-14 11:49:13.165][000000001.281] I/user.启动计数 更新值: 1
+[2025-11-14 11:49:13.178][000000001.292] I/user.文件写入 路径:/sd/io_test/boottime 内容: 1
+[2025-11-14 11:49:13.188][000000001.308] I/user.文件创建 路径:/sd/io_test/test_a 初始内容:ABC
+[2025-11-14 11:49:13.194][000000001.314] I/user.文件追加 路径:/sd/io_test/test_a 追加内容:def
+[2025-11-14 11:49:13.203][000000001.318] I/user.文件验证 路径:/sd/io_test/test_a 内容:ABCdef 结果: 成功
+[2025-11-14 11:49:13.208][000000001.334] I/user.文件创建 路径:/sd/io_test/testline 写入3行文本
+[2025-11-14 11:49:13.215][000000001.338] I/user.按行读取 路径:/sd/io_test/testline 第1行: abc
+[2025-11-14 11:49:13.219][000000001.338] I/user.按行读取 路径:/sd/io_test/testline 第2行: 123
+[2025-11-14 11:49:13.223][000000001.339] I/user.按行读取 路径:/sd/io_test/testline 第3行: wendal
+[2025-11-14 11:49:13.232][000000001.344] I/user.os.rename 文件重命名成功 原路径:/sd/io_test/test_a 新路径:/sd/io_test/renamed_file.txt
+[2025-11-14 11:49:13.236][000000001.348] D/fatfs f_open /io_test/test_a 4
+[2025-11-14 11:49:13.242][000000001.349] D/vfs fopen /sd/io_test/test_a r not found
+[2025-11-14 11:49:13.247][000000001.349] I/user.验证结果 重命名验证成功 新文件存在 原文件不存在
+[2025-11-14 11:49:13.252][000000001.349] I/user.目录操作 ===== 开始目录列举 =====
+[2025-11-14 11:49:13.259][000000001.357] I/user.fs lsdir [{"name":"boottime","size":1,"type":0},{"name":"testline","size":15,"type":0},{"name":"renamed_file.txt","size":6,"type":0}]
+[2025-11-14 11:49:13.264][000000001.364] I/user.os.remove 文件删除成功 路径:/sd/io_test/renamed_file.txt
+[2025-11-14 11:49:13.276][000000001.366] D/fatfs f_open /io_test/renamed_file.txt 4
+[2025-11-14 11:49:13.281][000000001.366] D/vfs fopen /sd/io_test/renamed_file.txt r not found
+[2025-11-14 11:49:13.287][000000001.367] I/user.验证结果 renamed_file.txt文件删除验证成功
+[2025-11-14 11:49:13.293][000000001.373] I/user.os.remove testline文件删除成功 路径:/sd/io_test/testline
+[2025-11-14 11:49:13.297][000000001.375] D/fatfs f_open /io_test/testline 4
+[2025-11-14 11:49:13.305][000000001.376] D/vfs fopen /sd/io_test/testline r not found
+[2025-11-14 11:49:13.310][000000001.376] I/user.验证结果 testline文件删除验证成功
+[2025-11-14 11:49:13.315][000000001.383] I/user.os.remove 文件删除成功 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.323][000000001.385] D/fatfs f_open /io_test/boottime 4
+[2025-11-14 11:49:13.328][000000001.386] D/vfs fopen /sd/io_test/boottime r not found
+[2025-11-14 11:49:13.332][000000001.386] I/user.验证结果 boottime文件删除验证成功
+[2025-11-14 11:49:13.339][000000001.393] I/user.io.rmdir 目录删除成功 路径:/sd/io_test
+[2025-11-14 11:49:13.343][000000001.395] D/fatfs f_open /io_test 4
+[2025-11-14 11:49:13.348][000000001.395] D/vfs fopen /sd/io_test r not found
+[2025-11-14 11:49:13.352][000000001.395] I/user.验证结果 目录删除验证成功
+[2025-11-14 11:49:13.359][000000001.395] I/user.文件操作 ===== 文件操作完成 =====
+[2025-11-14 11:49:13.369][000000001.396] I/user.结束 开始执行关闭操作...
+[2025-11-14 11:49:13.373][000000001.396] I/user.文件系统 卸载成功
+[2025-11-14 11:49:13.379][000000001.396] I/user.SPI接口 已关闭
+
 
 
 (3)网络连接与HTTP下载
-[2025-08-24 20:31:49.405][000000006.268] I/user.HTTP下载 开始下载任务
-[2025-08-24 20:31:49.438][000000006.275] dns_run 674:gitee.com state 0 id 1 ipv6 0 use dns server2, try 0
-[2025-08-24 20:31:49.471][000000006.277] D/mobile TIME_SYNC 0
-[2025-08-24 20:31:49.503][000000006.297] dns_run 691:dns all done ,now stop
-[2025-08-24 20:31:54.800][000000012.080] I/user.HTTP下载 下载完成 success 200 
-[2025-08-24 20:31:54.872][000000012.080] {"Age":"0","Cache-Control":"public, max-age=60","Via":"1.1 varnish","Transfer-Encoding":"chunked","Date":"Sun, 24 Aug 2025 12:31:49 GMT","Access-Control-Allow-Credentials":"true","Vary":"Accept-Encoding","X-Served-By":"cache-ffe9","X-Gitee-Server":"http-pilot 1.9.21","Connection":"keep-alive","Server":"ADAS\/1.0.214","Access-Control-Allow-Headers":"Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-CustomHeader,Content-Range,Range,Set-Language","Content-Security-Policy":"default-src 'none'; style-src 'unsafe-inline'; sandbox","X-Request-Id":"1f7e4b55-53c8-440a-9806-8894aa823f50","Accept-Ranges":"bytes","Etag":"W\/\"6ea36a6c51a48eaba0ffbc01d409424e7627bc56\"","Content-Type":"text\/plain; charset=utf-8","Access-Control-Allow-Methods":"GET, POST, PUT, PATCH, DELETE, OPTIONS","X-Frame-Options":"DENY","X-Cache":"MISS","Set-Cookie":"BEC=1f1759df3ccd099821dcf0da6feb0357;Path=\/;Max-Age=126000"}
-[2025-08-24 20:31:54.910][000000012.080]  411922
-[2025-08-24 20:31:54.936][000000012.082] I/user.HTTP下载 文件大小验证 预期: 411922 实际: 411922
-[2025-08-24 20:31:54.979][000000012.083] I/user.HTTP下载 资源清理完成
+[2025-11-14 11:52:24.522][000000002.310] I/user.HTTP下载 开始下载任务
+[2025-11-14 11:52:24.539][000000002.314] dns_run 676:cdn.openluat-erp.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
+[2025-11-14 11:52:24.550][000000002.316] D/mobile TIME_SYNC 0
+[2025-11-14 11:52:24.567][000000002.390] dns_run 693:dns all done ,now stop
+[2025-11-14 11:53:02.635][000000040.462] I/user.HTTP下载 下载完成 success 200 
+[2025-11-14 11:53:02.650][000000040.462] {"x-oss-hash-crc64ecma":"7570337686322137116","x-oss-server-time":"104","x-oss-object-type":"Normal","Content-Length":"3389723","Via":"cache19.l2cn3022[331,331,200-0,M], cache35.l2cn3022[333,0], kunlun19.cn5230[416,415,200-0,M], kunlun19.cn5230[421,0]","x-oss-cdn-auth":"success","Date":"Fri, 14 Nov 2025 03:52:24 GMT","x-oss-request-id":"6916A7782B654B37362C05B4","Content-MD5":"Ap894+Aw36xpOHjjgfW0Cw==","Last-Modified":"Wed, 03 Sep 2025 07:26:20 GMT","Connection":"keep-alive","Server":"Tengine","ETag":"\"029F3DE3E030DFAC693878E381F5B40B\"","Timing-Allow-Origin":"*","X-Swift-CacheTime":"3600","Accept-Ranges":"bytes","x-oss-storage-class":"Standard","Content-Type":"application\/octet-stream","X-Swift-SaveTime":"Fri, 14 Nov 2025 03:52:24 GMT","X-Cache":"MISS TCP_MISS dirn:-2:-2","Ali-Swift-Global-Savetime":"1763092344","EagleId":"6f30473017630923443325751e"}
+[2025-11-14 11:53:02.667][000000040.462]  3389723
+[2025-11-14 11:53:02.679][000000040.464] I/user.HTTP下载 文件大小验证 预期: 3389723 实际: 3389723
+[2025-11-14 11:53:02.693][000000040.465] I/user.HTTP下载 资源清理完成
+
+
+(4)网络连接与HTTP上传
+[2025-11-14 12:10:07.428][000000000.266] I/user.main tfcard 001.000.000
+[2025-11-14 12:10:07.433][000000000.288] W/user.HTTP上传 等待网络连接 1 1
+[2025-11-14 12:10:07.732][000000001.289] W/user.HTTP上传 等待网络连接 1 1
+[2025-11-14 12:10:08.580][000000002.059] D/mobile cid1, state0
+[2025-11-14 12:10:08.586][000000002.059] D/mobile bearer act 0, result 0
+[2025-11-14 12:10:08.597][000000002.060] D/mobile NETIF_LINK_ON -> IP_READY
+[2025-11-14 12:10:08.606][000000002.061] I/user.HTTP上传 网络已就绪 1 1
+[2025-11-14 12:10:08.611][000000002.062] SPI_HWInit 552:spi0 speed 2000000,1994805,154
+[2025-11-14 12:10:08.615][000000002.062] D/fatfs init sdcard at spi=0 cs=8
+[2025-11-14 12:10:08.666][000000002.224] D/SPI_TF 卡容量 125173760KB
+[2025-11-14 12:10:08.671][000000002.224] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
+[2025-11-14 12:10:08.676][000000002.230] I/user.HTTP上传 准备上传文件 /sd/3_23MB.bin 大小: 3389723 字节
+[2025-11-14 12:10:08.687][000000002.230] I/user.HTTP上传 开始上传任务
+[2025-11-14 12:10:08.691][000000002.234] D/socket connect to airtest.openluat.com,2900
+[2025-11-14 12:10:08.699][000000002.235] dns_run 676:airtest.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
+[2025-11-14 12:10:08.704][000000002.237] D/mobile TIME_SYNC 0
+[2025-11-14 12:10:08.736][000000002.291] dns_run 693:dns all done ,now stop
+[2025-11-14 12:10:19.571][000000013.118] I/user.httpplus 等待服务器完成响应
+[2025-11-14 12:10:19.974][000000013.519] I/user.httpplus 等待服务器完成响应
+[2025-11-14 12:10:19.980][000000013.529] I/user.httpplus 服务器已完成响应,开始解析响应
+[2025-11-14 12:10:20.005][000000013.555] I/user.HTTP上传 上传完成 success 200
+[2025-11-14 12:10:20.010][000000013.555] I/user.HTTP上传 服务器响应头 {"Content-Type":"text\/plain;charset=UTF-8","Connection":"close","Content-Length":"20","Vary":"Access-Control-Request-Headers","Date":"Fri, 14 Nov 2025 04"}
+[2025-11-14 12:10:20.017][000000013.556] I/user.HTTP上传 服务器响应体长度 20
+[2025-11-14 12:10:20.026][000000013.557] I/user.HTTP上传 服务器响应内容 uploadFileToStaticOK
+[2025-11-14 12:10:20.031][000000013.557] I/user.HTTP上传 资源清理完成
 
 ```

+ 99 - 0
module/Air780EHM_Air780EHV_Air780EGH/demo/tf_card/http_upload_file.lua

@@ -0,0 +1,99 @@
+--[[
+@module http_upload_file
+@summary TF卡大文件httpplus上传模块
+@version 1.0.0
+@date 2025.08.25
+@author 王棚嶙
+@usage
+本文件演示通过httpplus库将TF卡中的大文件上传到HTTP服务器:
+1. 网络就绪检测
+2. TF卡文件系统挂载
+3. 大文件上传功能
+4. 上传结果记录
+本文件没有对外接口,直接在main.lua中require "http_upload_file"即可
+]]
+-- 加载httpplus扩展库,不可省略
+local httpplus = require "httpplus"
+
+local function http_upload_task()
+    -- 阶段1: 网络就绪检测
+    while not socket.adapter(socket.dft()) do
+        log.warn("HTTP上传", "等待网络连接", socket.dft())
+        -- 待IP_READY消息,超时设为1秒
+        sys.waitUntil("IP_READY", 1000)
+    end
+
+    -- 检测到了IP_READY消息
+    log.info("HTTP上传", "网络已就绪", socket.dft())
+
+    -- 在Air780EHM/EHV/EGH核心板上TF卡的的pin_cs为gpio8,spi_id为0.请根据实际硬件修改
+    spi_id, pin_cs = 0, 8
+    spi.setup(spi_id, nil, 0, 0, 400 * 1000)
+    -- 初始化后拉高pin_cs,准备开始挂载TF卡
+    gpio.setup(pin_cs, 1)
+    
+
+    -- 挂载文件系统
+    local mount_ok = fatfs.mount(fatfs.SPI, "/sd", spi_id, pin_cs, 24 * 1000 * 1000)
+    if not mount_ok then
+        log.error("HTTP上传", "文件系统挂载失败")
+        fatfs.unmount("/sd")
+        spi.close(spi_id)
+        return
+    end
+
+    -- 阶段3: 检查要上传的文件是否存在
+    -- 替换为实际的文件路径
+    local upload_file_path ="/sd/3_23MB.bin" 
+    if not io.exists(upload_file_path) then
+        log.error("HTTP上传", "要上传的文件不存在", upload_file_path)
+        fatfs.unmount("/sd")
+        spi.close(spi_id)
+        return
+    end
+
+    -- 获取文件大小
+    local file_size = io.fileSize(upload_file_path)
+    log.info("HTTP上传", "准备上传文件", upload_file_path, "大小:", file_size, "字节")
+
+    -- 阶段4: 执行文件上传
+    log.info("HTTP上传", "开始上传任务")
+    
+    -- 使用httpplus库上传文件,参考httpplus_app_post_file的实现
+    -- hhtplus.request接口支持单文件上传、多文件上传、单文本上传、多文本上传、单/多文本+单/多文件上传
+    -- http://airtest.openluat.com:2900/uploadFileToStatic 仅支持单文件上传,并且上传的文件name必须使用"uploadFile"
+    -- 所以此处仅演示了单文件上传功能,并且"uploadFile"不能改成其他名字,否则会出现上传失败的应答
+    local code, response = httpplus.request({
+        url = "http://airtest.openluat.com:2900/uploadFileToStatic",
+        files = {
+            -- 服务器要求文件名必须为"uploadFile"
+            ["uploadFile"] = upload_file_path, 
+        },
+    })
+
+    -- 阶段5: 记录上传结果
+    log.info("HTTP上传", "上传完成", 
+        code == 200 and "success" or "error", 
+        code)
+    
+    if code == 200 then
+        log.info("HTTP上传", "服务器响应头", json.encode(response.headers or {}))
+        local body = response.body and response.body:query()
+        log.info("HTTP上传", "服务器响应体长度", body and body:len() or 0)
+        
+        -- 可以进一步解析服务器响应
+        if body then
+            log.info("HTTP上传", "服务器响应内容", body:len() > 512 and "内容过长,不显示" or body)
+        end
+    else
+        log.error("HTTP上传", "上传失败", code)
+    end
+
+    -- 阶段6: 资源清理
+    fatfs.unmount("/sd")
+    spi.close(spi_id)
+    log.info("HTTP上传", "资源清理完成")
+end
+
+-- 创建上传任务
+sys.taskInit(http_upload_task)

+ 6 - 3
module/Air780EHM_Air780EHV_Air780EGH/demo/tf_card/main.lua

@@ -78,14 +78,17 @@ end
 -- 在使用Air780E/EHV/EGH核心板时,关闭这个功能模块。                  
 --require "ch390_manager"
 
---[[在加载以下两个功能时,建议分别打开进行测试,因为文件操作和http下载功能是异步操作。
+--[[在加载以下三个功能时,建议分别打开进行测试,因为文件操作,http下载功能和http大文件上传功能是异步操作。
 放到一个项目中,如果加载的时间点是随机的,就会出现tfcard_app在spi.setup和fatfs挂载文件系统之后,
-还没有释放资源,然后http_download_file又去重复spi.setup和fatfs挂载文件系统了,不符合正常的业务逻辑,用户在参考编程的时候也要注意。]]
+还没有释放资源,然后http_download_file或http_upload_file又去重复spi.setup和fatfs挂载文件系统了,
+不符合正常的业务逻辑,用户在参考编程的时候也要注意。]]
 
 --加载tf卡测试应用模块
 require "tfcard_app"
 --加载HTTP下载存入TF卡功能演示模块
---require "http_download_file"
+-- require "http_download_file"
+--加载HTTP上传文件到服务器的功能演示模块
+--require "http_upload_file"
 
 
 -- 用户代码已结束---------------------------------------------

+ 109 - 65
module/Air780EHM_Air780EHV_Air780EGH/demo/tf_card/readme.md

@@ -3,8 +3,9 @@
 本demo演示了在嵌入式环境中对TF卡(SD卡)的完整操作流程,覆盖了从文件系统挂载到高级文件操作的完整功能链。项目分为两个核心模块:
 
 1、main.lua:主程序入口 <br> 
-2、tfcard_app.lua:TF卡基础应用模块,实现文件系统管理、文件操作和目录管理功能。<br> 
-3、http_download_file.lua:HTTP下载模块,实现网络检测与文件下载到TF卡的功能
+2、tfcard_app.lua:TF卡基础应用模块,实现文件系统管理、文件操作和目录管理功能<br> 
+3、http_download_file.lua:HTTP下载模块,实现网络检测与文件下载到TF卡的功能<br> 
+4、http_upload_file.lua:HTTP上传模块,实现网络检测与文件上传到服务器的功能<br> 
 
 ## **演示功能概述**
 
@@ -16,6 +17,7 @@
 - 加载ch390_manager模块(通过require "ch390_manager")。
 - 加载tfcard_app模块(通过require "tfcard_app")
 - 加载http_download_file模块(通过require "http_download_file")
+- 加载http_upload_file模块(通过require "http_upload_file")
 - 最后运行sys.run()。
 
 ### 2、CH390控制模块(ch390_manager.lua)
@@ -71,6 +73,20 @@
 
 - HTTP下载
 
+### 5、HTTP上传功能 (http_upload_file.lua)
+
+#### 文件系统管理
+
+- SPI初始化与挂载
+
+#### 网络就绪检测
+
+- 1秒循环等待IP就绪
+- 网络故障处理机制
+
+#### 安全上传
+
+- HTTP上传
 
 #### 结果处理
 
@@ -102,7 +118,7 @@
 |  GND(任意)      |          GND          |
 |  VDD_EXT        |          3V3         |
 |  GPIO8/SPI0_CS  |        spi_cs       |
-|  SPI0_SLK       |        spi_clk,时钟       |
+|  SPI0_CLK       |        spi_clk,时钟       |
 |  SPI0_MOSI      |  spi_mosi,主机输出,从机输入|
 |  SPI0_MISO      |  spi_miso,主机输入,从机输出|
 
@@ -126,7 +142,7 @@
 |  GND(任意)      |          GND          |
 |  VDD_EXT        |          3V3         |
 |  GPIO16/SPI0_CS  |        spi_cs       |
-|  SPI0_SLK       |        spi_clk,时钟       |
+|  SPI0_CLK       |        spi_clk,时钟       |
 |  SPI0_MOSI      |  spi_mosi,主机输出,从机输入|
 |  SPI0_MISO      |  spi_miso,主机输入,从机输出|
 
@@ -149,72 +165,100 @@ Air780EHV:https://docs.openluat.com/air780ehv/luatos/firmware/version/
 
 ```lua
 (1)TF卡初始化与挂载
-[2025-08-24 19:51:24.152][000000001.389] SPI_HWInit 552:spi1 speed 2000000,1994805,154
-[2025-08-24 19:51:24.213][000000002.390] D/fatfs init sdcard at spi=1 cs=20
-[2025-08-24 19:51:24.286][000000002.390] SPI_SetNewConfig 996:spi1 speed 400000,400000
-[2025-08-24 19:51:24.329][000000002.408] SPI_SetNewConfig 996:spi1 speed 24000000,25600000
-[2025-08-24 19:51:24.383][000000002.408] D/SPI_TF 卡容量 122138624KB
-[2025-08-24 19:51:24.430][000000002.408] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
-[2025-08-24 19:51:24.477][000000002.412] I/user.fatfs.mount 挂载成功 0
-[2025-08-24 19:51:24.535][000000002.617] I/user.fatfs getfree {"free_sectors":244262144,"total_kb":122132480,"free_kb":122131072,"total_sectors":244264960}
-[2025-08-24 19:51:24.583][000000002.618] I/user.fs lsmount [{"fs":"ec7xx","path":""},{"fs":"inline","path":"\/lua\/"},{"fs":"ram","path":"\/ram\/"},{"fs":"luadb","path":"\/luadb\/"},{"fs":"fatfs","path":"\/sd"}]
+[2025-11-14 11:49:12.769][000000000.278] SPI_HWInit 552:spi0 speed 2000000,1994805,154
+[2025-11-14 11:49:12.788][000000000.279] D/fatfs init sdcard at spi=0 cs=8
+[2025-11-14 11:49:12.811][000000000.407] D/SPI_TF 卡容量 125173760KB
+[2025-11-14 11:49:12.822][000000000.408] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
+[2025-11-14 11:49:12.835][000000000.412] I/user.fatfs.mount 挂载成功 0
+[2025-11-14 11:49:12.844][000000000.665] I/user.fatfs getfree {"free_sectors":250335488,"total_kb":125168512,"free_kb":125167744,"total_sectors":250337024}
+[2025-11-14 11:49:12.873][000000000.666] I/user.fs lsmount [{"fs":"ec7xx","path":""},{"fs":"inline","path":"\/lua\/"},{"fs":"ram","path":"\/ram\/"},{"fs":"luadb","path":"\/luadb\/"},{"fs":"fatfs","path":"\/sd"}]
+
 
 
 (2)文件操作演示
-[2025-08-24 19:51:24.685][000000002.619] I/user.文件操作 ===== 开始文件操作 =====
-[2025-08-24 19:51:25.145][000000003.032] I/user.io.mkdir 目录创建成功 路径:/sd/io_test
-[2025-08-24 19:51:25.231][000000003.043] I/user.文件创建 文件写入成功 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.297][000000003.046] I/user.io.exists 文件存在 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.376][000000003.049] I/user.io.fileSize 文件大小:41字节 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.467][000000003.052] I/user.文件读取 路径:/sd/io_test/boottime 内容:这是io库API文档示例的测试内容
-[2025-08-24 19:51:25.547][000000003.056] I/user.启动计数 文件内容: 这是io库API文档示例的测试内容 十六进制: E8BF99E698AF696FE5BA93415049E69687E6A1A3E7A4BAE4BE8BE79A84E6B58BE8AF95E58685E5AEB9 82
-[2025-08-24 19:51:25.616][000000003.056] I/user.启动计数 当前值: 0
-[2025-08-24 19:51:25.693][000000003.057] I/user.启动计数 更新值: 1
-[2025-08-24 19:51:25.736][000000003.068] I/user.文件写入 路径:/sd/io_test/boottime 内容: 1
-[2025-08-24 19:51:25.795][000000003.081] I/user.文件创建 路径:/sd/io_test/test_a 初始内容:ABC
-[2025-08-24 19:51:25.852][000000003.088] I/user.文件追加 路径:/sd/io_test/test_a 追加内容:def
-[2025-08-24 19:51:25.909][000000003.091] I/user.文件验证 路径:/sd/io_test/test_a 内容:ABCdef 结果: 成功
-[2025-08-24 19:51:25.954][000000003.102] I/user.文件创建 路径:/sd/io_test/testline 写入3行文本
-[2025-08-24 19:51:26.001][000000003.106] I/user.按行读取 路径:/sd/io_test/testline 第1行: abc
-[2025-08-24 19:51:26.048][000000003.106] I/user.按行读取 路径:/sd/io_test/testline 第2行: 123
-[2025-08-24 19:51:26.093][000000003.107] I/user.按行读取 路径:/sd/io_test/testline 第3行: wendal
-[2025-08-24 19:51:26.140][000000003.112] I/user.os.rename 文件重命名成功 原路径:/sd/io_test/test_a 新路径:/sd/io_test/renamed_file.txt
-[2025-08-24 19:51:26.188][000000003.116] D/fatfs f_open /io_test/test_a 4
-[2025-08-24 19:51:26.238][000000003.116] D/vfs fopen /sd/io_test/test_a r not found
-[2025-08-24 19:51:26.312][000000003.117] I/user.验证结果 重命名验证成功 新文件存在 原文件不存在
-[2025-08-24 19:51:26.367][000000003.117] I/user.目录操作 ===== 开始目录列举 =====
-[2025-08-24 19:51:26.424][000000003.121] I/user.fs lsdir [{"name":"boottime","size":0,"type":0},{"name":"testline","size":0,"type":0},{"name":"renamed_file.txt","size":0,"type":0}]
-[2025-08-24 19:51:26.478][000000003.127] I/user.os.remove 文件删除成功 路径:/sd/io_test/renamed_file.txt
-[2025-08-24 19:51:26.539][000000003.129] D/fatfs f_open /io_test/renamed_file.txt 4
-[2025-08-24 19:51:26.593][000000003.130] D/vfs fopen /sd/io_test/renamed_file.txt r not found
-[2025-08-24 19:51:26.656][000000003.130] I/user.验证结果 renamed_file.txt文件删除验证成功
-[2025-08-24 19:51:26.734][000000003.137] I/user.os.remove testline文件删除成功 路径:/sd/io_test/testline
-[2025-08-24 19:51:26.856][000000003.139] D/fatfs f_open /io_test/testline 4
-[2025-08-24 19:51:26.922][000000003.140] D/vfs fopen /sd/io_test/testline r not found
-[2025-08-24 19:51:27.113][000000003.140] I/user.验证结果 testline文件删除验证成功
-[2025-08-24 19:51:27.197][000000003.147] I/user.os.remove 文件删除成功 路径:/sd/io_test/boottime
-[2025-08-24 19:51:27.251][000000003.149] D/fatfs f_open /io_test/boottime 4
-[2025-08-24 19:51:27.302][000000003.150] D/vfs fopen /sd/io_test/boottime r not found
-[2025-08-24 19:51:27.365][000000003.150] I/user.验证结果 boottime文件删除验证成功
-[2025-08-24 19:51:27.407][000000003.158] I/user.io.rmdir 目录删除成功 路径:/sd/io_test
-[2025-08-24 19:51:27.461][000000003.159] D/fatfs f_open /io_test 4
-[2025-08-24 19:51:27.536][000000003.159] D/vfs fopen /sd/io_test r not found
-[2025-08-24 19:51:27.610][000000003.159] I/user.验证结果 目录删除验证成功
-[2025-08-24 19:51:27.668][000000003.160] I/user.文件操作 ===== 文件操作完成 =====
-[2025-08-24 19:51:27.712][000000003.160] I/user.系统清理 开始执行关闭操作...
-[2025-08-24 19:51:27.772][000000003.160] I/user.文件系统 卸载成功
-[2025-08-24 19:51:27.867][000000003.160] I/user.SPI接口 已关闭
+[2025-11-14 11:49:12.880][000000000.666] I/user.文件操作 ===== 开始文件操作 =====
+[2025-11-14 11:49:13.111][000000001.254] I/user.io.mkdir 目录创建成功 路径:/sd/io_test
+[2025-11-14 11:49:13.116][000000001.267] I/user.文件创建 文件写入成功 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.123][000000001.270] I/user.io.exists 文件存在 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.127][000000001.273] I/user.io.fileSize 文件大小:41字节 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.131][000000001.276] I/user.文件读取 路径:/sd/io_test/boottime 内容:这是io库API文档示例的测试内容
+[2025-11-14 11:49:13.148][000000001.280] I/user.启动计数 文件内容: 这是io库API文档示例的测试内容 十六进制: E8BF99E698AF696FE5BA93415049E69687E6A1A3E7A4BAE4BE8BE79A84E6B58BE8AF95E58685E5AEB9 82
+[2025-11-14 11:49:13.157][000000001.280] I/user.启动计数 当前值: 0
+[2025-11-14 11:49:13.165][000000001.281] I/user.启动计数 更新值: 1
+[2025-11-14 11:49:13.178][000000001.292] I/user.文件写入 路径:/sd/io_test/boottime 内容: 1
+[2025-11-14 11:49:13.188][000000001.308] I/user.文件创建 路径:/sd/io_test/test_a 初始内容:ABC
+[2025-11-14 11:49:13.194][000000001.314] I/user.文件追加 路径:/sd/io_test/test_a 追加内容:def
+[2025-11-14 11:49:13.203][000000001.318] I/user.文件验证 路径:/sd/io_test/test_a 内容:ABCdef 结果: 成功
+[2025-11-14 11:49:13.208][000000001.334] I/user.文件创建 路径:/sd/io_test/testline 写入3行文本
+[2025-11-14 11:49:13.215][000000001.338] I/user.按行读取 路径:/sd/io_test/testline 第1行: abc
+[2025-11-14 11:49:13.219][000000001.338] I/user.按行读取 路径:/sd/io_test/testline 第2行: 123
+[2025-11-14 11:49:13.223][000000001.339] I/user.按行读取 路径:/sd/io_test/testline 第3行: wendal
+[2025-11-14 11:49:13.232][000000001.344] I/user.os.rename 文件重命名成功 原路径:/sd/io_test/test_a 新路径:/sd/io_test/renamed_file.txt
+[2025-11-14 11:49:13.236][000000001.348] D/fatfs f_open /io_test/test_a 4
+[2025-11-14 11:49:13.242][000000001.349] D/vfs fopen /sd/io_test/test_a r not found
+[2025-11-14 11:49:13.247][000000001.349] I/user.验证结果 重命名验证成功 新文件存在 原文件不存在
+[2025-11-14 11:49:13.252][000000001.349] I/user.目录操作 ===== 开始目录列举 =====
+[2025-11-14 11:49:13.259][000000001.357] I/user.fs lsdir [{"name":"boottime","size":1,"type":0},{"name":"testline","size":15,"type":0},{"name":"renamed_file.txt","size":6,"type":0}]
+[2025-11-14 11:49:13.264][000000001.364] I/user.os.remove 文件删除成功 路径:/sd/io_test/renamed_file.txt
+[2025-11-14 11:49:13.276][000000001.366] D/fatfs f_open /io_test/renamed_file.txt 4
+[2025-11-14 11:49:13.281][000000001.366] D/vfs fopen /sd/io_test/renamed_file.txt r not found
+[2025-11-14 11:49:13.287][000000001.367] I/user.验证结果 renamed_file.txt文件删除验证成功
+[2025-11-14 11:49:13.293][000000001.373] I/user.os.remove testline文件删除成功 路径:/sd/io_test/testline
+[2025-11-14 11:49:13.297][000000001.375] D/fatfs f_open /io_test/testline 4
+[2025-11-14 11:49:13.305][000000001.376] D/vfs fopen /sd/io_test/testline r not found
+[2025-11-14 11:49:13.310][000000001.376] I/user.验证结果 testline文件删除验证成功
+[2025-11-14 11:49:13.315][000000001.383] I/user.os.remove 文件删除成功 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.323][000000001.385] D/fatfs f_open /io_test/boottime 4
+[2025-11-14 11:49:13.328][000000001.386] D/vfs fopen /sd/io_test/boottime r not found
+[2025-11-14 11:49:13.332][000000001.386] I/user.验证结果 boottime文件删除验证成功
+[2025-11-14 11:49:13.339][000000001.393] I/user.io.rmdir 目录删除成功 路径:/sd/io_test
+[2025-11-14 11:49:13.343][000000001.395] D/fatfs f_open /io_test 4
+[2025-11-14 11:49:13.348][000000001.395] D/vfs fopen /sd/io_test r not found
+[2025-11-14 11:49:13.352][000000001.395] I/user.验证结果 目录删除验证成功
+[2025-11-14 11:49:13.359][000000001.395] I/user.文件操作 ===== 文件操作完成 =====
+[2025-11-14 11:49:13.369][000000001.396] I/user.结束 开始执行关闭操作...
+[2025-11-14 11:49:13.373][000000001.396] I/user.文件系统 卸载成功
+[2025-11-14 11:49:13.379][000000001.396] I/user.SPI接口 已关闭
+
 
 
 (3)网络连接与HTTP下载
-[2025-08-24 20:31:49.405][000000006.268] I/user.HTTP下载 开始下载任务
-[2025-08-24 20:31:49.438][000000006.275] dns_run 674:gitee.com state 0 id 1 ipv6 0 use dns server2, try 0
-[2025-08-24 20:31:49.471][000000006.277] D/mobile TIME_SYNC 0
-[2025-08-24 20:31:49.503][000000006.297] dns_run 691:dns all done ,now stop
-[2025-08-24 20:31:54.800][000000012.080] I/user.HTTP下载 下载完成 success 200 
-[2025-08-24 20:31:54.872][000000012.080] {"Age":"0","Cache-Control":"public, max-age=60","Via":"1.1 varnish","Transfer-Encoding":"chunked","Date":"Sun, 24 Aug 2025 12:31:49 GMT","Access-Control-Allow-Credentials":"true","Vary":"Accept-Encoding","X-Served-By":"cache-ffe9","X-Gitee-Server":"http-pilot 1.9.21","Connection":"keep-alive","Server":"ADAS\/1.0.214","Access-Control-Allow-Headers":"Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-CustomHeader,Content-Range,Range,Set-Language","Content-Security-Policy":"default-src 'none'; style-src 'unsafe-inline'; sandbox","X-Request-Id":"1f7e4b55-53c8-440a-9806-8894aa823f50","Accept-Ranges":"bytes","Etag":"W\/\"6ea36a6c51a48eaba0ffbc01d409424e7627bc56\"","Content-Type":"text\/plain; charset=utf-8","Access-Control-Allow-Methods":"GET, POST, PUT, PATCH, DELETE, OPTIONS","X-Frame-Options":"DENY","X-Cache":"MISS","Set-Cookie":"BEC=1f1759df3ccd099821dcf0da6feb0357;Path=\/;Max-Age=126000"}
-[2025-08-24 20:31:54.910][000000012.080]  411922
-[2025-08-24 20:31:54.936][000000012.082] I/user.HTTP下载 文件大小验证 预期: 411922 实际: 411922
-[2025-08-24 20:31:54.979][000000012.083] I/user.HTTP下载 资源清理完成
+[2025-11-14 11:52:24.522][000000002.310] I/user.HTTP下载 开始下载任务
+[2025-11-14 11:52:24.539][000000002.314] dns_run 676:cdn.openluat-erp.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
+[2025-11-14 11:52:24.550][000000002.316] D/mobile TIME_SYNC 0
+[2025-11-14 11:52:24.567][000000002.390] dns_run 693:dns all done ,now stop
+[2025-11-14 11:53:02.635][000000040.462] I/user.HTTP下载 下载完成 success 200 
+[2025-11-14 11:53:02.650][000000040.462] {"x-oss-hash-crc64ecma":"7570337686322137116","x-oss-server-time":"104","x-oss-object-type":"Normal","Content-Length":"3389723","Via":"cache19.l2cn3022[331,331,200-0,M], cache35.l2cn3022[333,0], kunlun19.cn5230[416,415,200-0,M], kunlun19.cn5230[421,0]","x-oss-cdn-auth":"success","Date":"Fri, 14 Nov 2025 03:52:24 GMT","x-oss-request-id":"6916A7782B654B37362C05B4","Content-MD5":"Ap894+Aw36xpOHjjgfW0Cw==","Last-Modified":"Wed, 03 Sep 2025 07:26:20 GMT","Connection":"keep-alive","Server":"Tengine","ETag":"\"029F3DE3E030DFAC693878E381F5B40B\"","Timing-Allow-Origin":"*","X-Swift-CacheTime":"3600","Accept-Ranges":"bytes","x-oss-storage-class":"Standard","Content-Type":"application\/octet-stream","X-Swift-SaveTime":"Fri, 14 Nov 2025 03:52:24 GMT","X-Cache":"MISS TCP_MISS dirn:-2:-2","Ali-Swift-Global-Savetime":"1763092344","EagleId":"6f30473017630923443325751e"}
+[2025-11-14 11:53:02.667][000000040.462]  3389723
+[2025-11-14 11:53:02.679][000000040.464] I/user.HTTP下载 文件大小验证 预期: 3389723 实际: 3389723
+[2025-11-14 11:53:02.693][000000040.465] I/user.HTTP下载 资源清理完成
+
+
+(4)网络连接与HTTP上传
+[2025-11-14 12:10:07.428][000000000.266] I/user.main tfcard 001.000.000
+[2025-11-14 12:10:07.433][000000000.288] W/user.HTTP上传 等待网络连接 1 1
+[2025-11-14 12:10:07.732][000000001.289] W/user.HTTP上传 等待网络连接 1 1
+[2025-11-14 12:10:08.580][000000002.059] D/mobile cid1, state0
+[2025-11-14 12:10:08.586][000000002.059] D/mobile bearer act 0, result 0
+[2025-11-14 12:10:08.597][000000002.060] D/mobile NETIF_LINK_ON -> IP_READY
+[2025-11-14 12:10:08.606][000000002.061] I/user.HTTP上传 网络已就绪 1 1
+[2025-11-14 12:10:08.611][000000002.062] SPI_HWInit 552:spi0 speed 2000000,1994805,154
+[2025-11-14 12:10:08.615][000000002.062] D/fatfs init sdcard at spi=0 cs=8
+[2025-11-14 12:10:08.666][000000002.224] D/SPI_TF 卡容量 125173760KB
+[2025-11-14 12:10:08.671][000000002.224] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
+[2025-11-14 12:10:08.676][000000002.230] I/user.HTTP上传 准备上传文件 /sd/3_23MB.bin 大小: 3389723 字节
+[2025-11-14 12:10:08.687][000000002.230] I/user.HTTP上传 开始上传任务
+[2025-11-14 12:10:08.691][000000002.234] D/socket connect to airtest.openluat.com,2900
+[2025-11-14 12:10:08.699][000000002.235] dns_run 676:airtest.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
+[2025-11-14 12:10:08.704][000000002.237] D/mobile TIME_SYNC 0
+[2025-11-14 12:10:08.736][000000002.291] dns_run 693:dns all done ,now stop
+[2025-11-14 12:10:19.571][000000013.118] I/user.httpplus 等待服务器完成响应
+[2025-11-14 12:10:19.974][000000013.519] I/user.httpplus 等待服务器完成响应
+[2025-11-14 12:10:19.980][000000013.529] I/user.httpplus 服务器已完成响应,开始解析响应
+[2025-11-14 12:10:20.005][000000013.555] I/user.HTTP上传 上传完成 success 200
+[2025-11-14 12:10:20.010][000000013.555] I/user.HTTP上传 服务器响应头 {"Content-Type":"text\/plain;charset=UTF-8","Connection":"close","Content-Length":"20","Vary":"Access-Control-Request-Headers","Date":"Fri, 14 Nov 2025 04"}
+[2025-11-14 12:10:20.017][000000013.556] I/user.HTTP上传 服务器响应体长度 20
+[2025-11-14 12:10:20.026][000000013.557] I/user.HTTP上传 服务器响应内容 uploadFileToStaticOK
+[2025-11-14 12:10:20.031][000000013.557] I/user.HTTP上传 资源清理完成
 
 ```

+ 4 - 4
module/Air8000/demo/accessory_board/AirMICROSD_1010/http_download_file.lua

@@ -44,11 +44,11 @@ local function http_download_file_task()
     log.info("HTTP下载", "开始下载任务")
 
     -- 核心下载操作开始 (支持http和https)
-    --local code, headers, body = http.request("GET", "...", nil, nil, {dst = "/sd/1.mp3"}).wait()
+    --local code, headers, body = http.request("GET", "...", nil, nil, {dst = "/sd/3_23MB.bin"}).wait()
     -- 其中 "..."为url地址, 支持 http和https, 支持域名, 支持自定义端口。
     local code, headers, body_size = http.request("GET",
-                                    "https://gitee.com/openLuat/LuatOS/raw/master/module/Air780EHM_Air780EHV_Air780EGH/demo/audio/1.mp3",
-                                    nil, nil, {dst = "/sd/1.mp3"}).wait()
+                                   "https://cdn.openluat-erp.openluat.com/erp_site_file/product_file/AirM2M_780EHT_V2017_LTE_AT.dfota.bin",
+                                    nil, nil, {dst = "/sd/3_23MB.bin"}).wait()
     -- 阶段3: 记录下载结果
     log.info("HTTP下载", "下载完成", 
         code==200 and "success" or "error", 
@@ -60,7 +60,7 @@ local function http_download_file_task()
         
     if code == 200 then
         -- 获取实际文件大小
-        local actual_size = io.fileSize("/sd/1.mp3")
+        local actual_size = io.fileSize("/sd/3_23MB.bin")
         log.info("HTTP下载", "文件大小验证", "预期:", body_size, "实际:", actual_size)
         
         if actual_size~= body_size then

+ 1 - 1
module/Air8000/demo/accessory_board/AirMICROSD_1010/http_upload_file.lua

@@ -41,7 +41,7 @@ local function http_upload_task()
 
     -- 阶段3: 检查要上传的文件是否存在
     -- 替换为实际的文件路径
-    local upload_file_path = "/sd/30M_test.txt" 
+    local upload_file_path ="/sd/3_23MB.bin" 
     if not io.exists(upload_file_path) then
         log.error("HTTP上传", "要上传的文件不存在", upload_file_path)
         fatfs.unmount("/sd")

+ 116 - 90
module/Air8000/demo/accessory_board/AirMICROSD_1010/readme.md

@@ -16,7 +16,35 @@
 - 启动一个循环定时器,每隔3秒钟打印一次总内存,实时的已使用内存,历史最高的已使用内存情况方便分析内存使用是否有异常
 - 加载tfcard_app模块(通过require "tfcard_app")
 - 加载http_download_file模块(通过require "http_download_file")
-- 最后运行sys.run()。
+- 加载http_upload_file模块(通过require "http_upload_file")
+
+### 2、TF卡基础应用模块(tfcard_app.lua)
+
+#### 文件系统管理
+
+- SPI初始化与挂载:
+  - 配置SPI接口参数(频率400kHz)
+  - 挂载FAT32文件系统到`/sd`路径
+  - 自动格式化检测与处理
+- 空间信息获取:
+  - 实时查询TF卡可用空间
+  - 输出详细存储信息(总空间/剩余空间)
+
+#### 文件操作
+
+- 创建目录:io.mkdir("/sd/io_test")
+- 创建/写入文件: io.open("/sd/io_test/boottime", "wb")
+- 检查文件存在: io.exists(file_path)
+- 获取文件大小:io.fileSize(file_path)
+- 读取文件内容: io.open(file_path, "rb"):read("*a")
+- 启动计数文件: 记录设备启动次数
+- 文件追加: io.open(append_file, "a+")
+- 按行读取: file:read("*l")
+- 文件关闭: file:close()
+- 文件重命名: os.rename(old_path, new_path)
+- 列举目录: io.lsdir(dir_path)
+- 删除文件: os.remove(file_path)
+- 删除目录: io.rmdir(dir_path)
 
 ### 3、TF卡核心演示模块(tfcard_app.lua)
 
@@ -138,101 +166,99 @@
 
 ```lua
 (1)TF卡初始化与挂载
-[2025-08-24 19:51:24.152][000000001.389] SPI_HWInit 552:spi1 speed 2000000,1994805,154
-[2025-08-24 19:51:24.213][000000002.390] D/fatfs init sdcard at spi=1 cs=20
-[2025-08-24 19:51:24.286][000000002.390] SPI_SetNewConfig 996:spi1 speed 400000,400000
-[2025-08-24 19:51:24.329][000000002.408] SPI_SetNewConfig 996:spi1 speed 24000000,25600000
-[2025-08-24 19:51:24.383][000000002.408] D/SPI_TF 卡容量 122138624KB
-[2025-08-24 19:51:24.430][000000002.408] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
-[2025-08-24 19:51:24.477][000000002.412] I/user.fatfs.mount 挂载成功 0
-[2025-08-24 19:51:24.535][000000002.617] I/user.fatfs getfree {"free_sectors":244262144,"total_kb":122132480,"free_kb":122131072,"total_sectors":244264960}
-[2025-08-24 19:51:24.583][000000002.618] I/user.fs lsmount [{"fs":"ec7xx","path":""},{"fs":"inline","path":"\/lua\/"},{"fs":"ram","path":"\/ram\/"},{"fs":"luadb","path":"\/luadb\/"},{"fs":"fatfs","path":"\/sd"}]
+[2025-11-14 11:49:12.769][000000000.278] SPI_HWInit 552:spi1 speed 2000000,1994805,154
+[2025-11-14 11:49:12.788][000000000.279] D/fatfs init sdcard at spi=1 cs=12
+[2025-11-14 11:49:12.811][000000000.407] D/SPI_TF 卡容量 125173760KB
+[2025-11-14 11:49:12.822][000000000.408] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
+[2025-11-14 11:49:12.835][000000000.412] I/user.fatfs.mount 挂载成功 0
+[2025-11-14 11:49:12.844][000000000.665] I/user.fatfs getfree {"free_sectors":250335488,"total_kb":125168512,"free_kb":125167744,"total_sectors":250337024}
+[2025-11-14 11:49:12.873][000000000.666] I/user.fs lsmount [{"fs":"ec7xx","path":""},{"fs":"inline","path":"\/lua\/"},{"fs":"ram","path":"\/ram\/"},{"fs":"luadb","path":"\/luadb\/"},{"fs":"fatfs","path":"\/sd"}]
+
 
 
 (2)文件操作演示
-[2025-08-24 19:51:24.685][000000002.619] I/user.文件操作 ===== 开始文件操作 =====
-[2025-08-24 19:51:25.145][000000003.032] I/user.io.mkdir 目录创建成功 路径:/sd/io_test
-[2025-08-24 19:51:25.231][000000003.043] I/user.文件创建 文件写入成功 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.297][000000003.046] I/user.io.exists 文件存在 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.376][000000003.049] I/user.io.fileSize 文件大小:41字节 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.467][000000003.052] I/user.文件读取 路径:/sd/io_test/boottime 内容:这是io库API文档示例的测试内容
-[2025-08-24 19:51:25.547][000000003.056] I/user.启动计数 文件内容: 这是io库API文档示例的测试内容 十六进制: E8BF99E698AF696FE5BA93415049E69687E6A1A3E7A4BAE4BE8BE79A84E6B58BE8AF95E58685E5AEB9 82
-[2025-08-24 19:51:25.616][000000003.056] I/user.启动计数 当前值: 0
-[2025-08-24 19:51:25.693][000000003.057] I/user.启动计数 更新值: 1
-[2025-08-24 19:51:25.736][000000003.068] I/user.文件写入 路径:/sd/io_test/boottime 内容: 1
-[2025-08-24 19:51:25.795][000000003.081] I/user.文件创建 路径:/sd/io_test/test_a 初始内容:ABC
-[2025-08-24 19:51:25.852][000000003.088] I/user.文件追加 路径:/sd/io_test/test_a 追加内容:def
-[2025-08-24 19:51:25.909][000000003.091] I/user.文件验证 路径:/sd/io_test/test_a 内容:ABCdef 结果: 成功
-[2025-08-24 19:51:25.954][000000003.102] I/user.文件创建 路径:/sd/io_test/testline 写入3行文本
-[2025-08-24 19:51:26.001][000000003.106] I/user.按行读取 路径:/sd/io_test/testline 第1行: abc
-[2025-08-24 19:51:26.048][000000003.106] I/user.按行读取 路径:/sd/io_test/testline 第2行: 123
-[2025-08-24 19:51:26.093][000000003.107] I/user.按行读取 路径:/sd/io_test/testline 第3行: wendal
-[2025-08-24 19:51:26.140][000000003.112] I/user.os.rename 文件重命名成功 原路径:/sd/io_test/test_a 新路径:/sd/io_test/renamed_file.txt
-[2025-08-24 19:51:26.188][000000003.116] D/fatfs f_open /io_test/test_a 4
-[2025-08-24 19:51:26.238][000000003.116] D/vfs fopen /sd/io_test/test_a r not found
-[2025-08-24 19:51:26.312][000000003.117] I/user.验证结果 重命名验证成功 新文件存在 原文件不存在
-[2025-08-24 19:51:26.367][000000003.117] I/user.目录操作 ===== 开始目录列举 =====
-[2025-08-24 19:51:26.424][000000003.121] I/user.fs lsdir [{"name":"boottime","size":0,"type":0},{"name":"testline","size":0,"type":0},{"name":"renamed_file.txt","size":0,"type":0}]
-[2025-08-24 19:51:26.478][000000003.127] I/user.os.remove 文件删除成功 路径:/sd/io_test/renamed_file.txt
-[2025-08-24 19:51:26.539][000000003.129] D/fatfs f_open /io_test/renamed_file.txt 4
-[2025-08-24 19:51:26.593][000000003.130] D/vfs fopen /sd/io_test/renamed_file.txt r not found
-[2025-08-24 19:51:26.656][000000003.130] I/user.验证结果 renamed_file.txt文件删除验证成功
-[2025-08-24 19:51:26.734][000000003.137] I/user.os.remove testline文件删除成功 路径:/sd/io_test/testline
-[2025-08-24 19:51:26.856][000000003.139] D/fatfs f_open /io_test/testline 4
-[2025-08-24 19:51:26.922][000000003.140] D/vfs fopen /sd/io_test/testline r not found
-[2025-08-24 19:51:27.113][000000003.140] I/user.验证结果 testline文件删除验证成功
-[2025-08-24 19:51:27.197][000000003.147] I/user.os.remove 文件删除成功 路径:/sd/io_test/boottime
-[2025-08-24 19:51:27.251][000000003.149] D/fatfs f_open /io_test/boottime 4
-[2025-08-24 19:51:27.302][000000003.150] D/vfs fopen /sd/io_test/boottime r not found
-[2025-08-24 19:51:27.365][000000003.150] I/user.验证结果 boottime文件删除验证成功
-[2025-08-24 19:51:27.407][000000003.158] I/user.io.rmdir 目录删除成功 路径:/sd/io_test
-[2025-08-24 19:51:27.461][000000003.159] D/fatfs f_open /io_test 4
-[2025-08-24 19:51:27.536][000000003.159] D/vfs fopen /sd/io_test r not found
-[2025-08-24 19:51:27.610][000000003.159] I/user.验证结果 目录删除验证成功
-[2025-08-24 19:51:27.668][000000003.160] I/user.文件操作 ===== 文件操作完成 =====
-[2025-08-24 19:51:27.712][000000003.160] I/user.系统清理 开始执行关闭操作...
-[2025-08-24 19:51:27.772][000000003.160] I/user.文件系统 卸载成功
-[2025-08-24 19:51:27.867][000000003.160] I/user.SPI接口 已关闭
+[2025-11-14 11:49:12.880][000000000.666] I/user.文件操作 ===== 开始文件操作 =====
+[2025-11-14 11:49:13.111][000000001.254] I/user.io.mkdir 目录创建成功 路径:/sd/io_test
+[2025-11-14 11:49:13.116][000000001.267] I/user.文件创建 文件写入成功 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.123][000000001.270] I/user.io.exists 文件存在 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.127][000000001.273] I/user.io.fileSize 文件大小:41字节 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.131][000000001.276] I/user.文件读取 路径:/sd/io_test/boottime 内容:这是io库API文档示例的测试内容
+[2025-11-14 11:49:13.148][000000001.280] I/user.启动计数 文件内容: 这是io库API文档示例的测试内容 十六进制: E8BF99E698AF696FE5BA93415049E69687E6A1A3E7A4BAE4BE8BE79A84E6B58BE8AF95E58685E5AEB9 82
+[2025-11-14 11:49:13.157][000000001.280] I/user.启动计数 当前值: 0
+[2025-11-14 11:49:13.165][000000001.281] I/user.启动计数 更新值: 1
+[2025-11-14 11:49:13.178][000000001.292] I/user.文件写入 路径:/sd/io_test/boottime 内容: 1
+[2025-11-14 11:49:13.188][000000001.308] I/user.文件创建 路径:/sd/io_test/test_a 初始内容:ABC
+[2025-11-14 11:49:13.194][000000001.314] I/user.文件追加 路径:/sd/io_test/test_a 追加内容:def
+[2025-11-14 11:49:13.203][000000001.318] I/user.文件验证 路径:/sd/io_test/test_a 内容:ABCdef 结果: 成功
+[2025-11-14 11:49:13.208][000000001.334] I/user.文件创建 路径:/sd/io_test/testline 写入3行文本
+[2025-11-14 11:49:13.215][000000001.338] I/user.按行读取 路径:/sd/io_test/testline 第1行: abc
+[2025-11-14 11:49:13.219][000000001.338] I/user.按行读取 路径:/sd/io_test/testline 第2行: 123
+[2025-11-14 11:49:13.223][000000001.339] I/user.按行读取 路径:/sd/io_test/testline 第3行: wendal
+[2025-11-14 11:49:13.232][000000001.344] I/user.os.rename 文件重命名成功 原路径:/sd/io_test/test_a 新路径:/sd/io_test/renamed_file.txt
+[2025-11-14 11:49:13.236][000000001.348] D/fatfs f_open /io_test/test_a 4
+[2025-11-14 11:49:13.242][000000001.349] D/vfs fopen /sd/io_test/test_a r not found
+[2025-11-14 11:49:13.247][000000001.349] I/user.验证结果 重命名验证成功 新文件存在 原文件不存在
+[2025-11-14 11:49:13.252][000000001.349] I/user.目录操作 ===== 开始目录列举 =====
+[2025-11-14 11:49:13.259][000000001.357] I/user.fs lsdir [{"name":"boottime","size":1,"type":0},{"name":"testline","size":15,"type":0},{"name":"renamed_file.txt","size":6,"type":0}]
+[2025-11-14 11:49:13.264][000000001.364] I/user.os.remove 文件删除成功 路径:/sd/io_test/renamed_file.txt
+[2025-11-14 11:49:13.276][000000001.366] D/fatfs f_open /io_test/renamed_file.txt 4
+[2025-11-14 11:49:13.281][000000001.366] D/vfs fopen /sd/io_test/renamed_file.txt r not found
+[2025-11-14 11:49:13.287][000000001.367] I/user.验证结果 renamed_file.txt文件删除验证成功
+[2025-11-14 11:49:13.293][000000001.373] I/user.os.remove testline文件删除成功 路径:/sd/io_test/testline
+[2025-11-14 11:49:13.297][000000001.375] D/fatfs f_open /io_test/testline 4
+[2025-11-14 11:49:13.305][000000001.376] D/vfs fopen /sd/io_test/testline r not found
+[2025-11-14 11:49:13.310][000000001.376] I/user.验证结果 testline文件删除验证成功
+[2025-11-14 11:49:13.315][000000001.383] I/user.os.remove 文件删除成功 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.323][000000001.385] D/fatfs f_open /io_test/boottime 4
+[2025-11-14 11:49:13.328][000000001.386] D/vfs fopen /sd/io_test/boottime r not found
+[2025-11-14 11:49:13.332][000000001.386] I/user.验证结果 boottime文件删除验证成功
+[2025-11-14 11:49:13.339][000000001.393] I/user.io.rmdir 目录删除成功 路径:/sd/io_test
+[2025-11-14 11:49:13.343][000000001.395] D/fatfs f_open /io_test 4
+[2025-11-14 11:49:13.348][000000001.395] D/vfs fopen /sd/io_test r not found
+[2025-11-14 11:49:13.352][000000001.395] I/user.验证结果 目录删除验证成功
+[2025-11-14 11:49:13.359][000000001.395] I/user.文件操作 ===== 文件操作完成 =====
+[2025-11-14 11:49:13.369][000000001.396] I/user.结束 开始执行关闭操作...
+[2025-11-14 11:49:13.373][000000001.396] I/user.文件系统 卸载成功
+[2025-11-14 11:49:13.379][000000001.396] I/user.SPI接口 已关闭
+
 
 
 (3)网络连接与HTTP下载
-[2025-08-24 20:31:49.405][000000006.268] I/user.HTTP下载 开始下载任务
-[2025-08-24 20:31:49.438][000000006.275] dns_run 674:gitee.com state 0 id 1 ipv6 0 use dns server2, try 0
-[2025-08-24 20:31:49.471][000000006.277] D/mobile TIME_SYNC 0
-[2025-08-24 20:31:49.503][000000006.297] dns_run 691:dns all done ,now stop
-[2025-08-24 20:31:54.800][000000012.080] I/user.HTTP下载 下载完成 success 200 
-[2025-08-24 20:31:54.872][000000012.080] {"Age":"0","Cache-Control":"public, max-age=60","Via":"1.1 varnish","Transfer-Encoding":"chunked","Date":"Sun, 24 Aug 2025 12:31:49 GMT","Access-Control-Allow-Credentials":"true","Vary":"Accept-Encoding","X-Served-By":"cache-ffe9","X-Gitee-Server":"http-pilot 1.9.21","Connection":"keep-alive","Server":"ADAS\/1.0.214","Access-Control-Allow-Headers":"Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-CustomHeader,Content-Range,Range,Set-Language","Content-Security-Policy":"default-src 'none'; style-src 'unsafe-inline'; sandbox","X-Request-Id":"1f7e4b55-53c8-440a-9806-8894aa823f50","Accept-Ranges":"bytes","Etag":"W\/\"6ea36a6c51a48eaba0ffbc01d409424e7627bc56\"","Content-Type":"text\/plain; charset=utf-8","Access-Control-Allow-Methods":"GET, POST, PUT, PATCH, DELETE, OPTIONS","X-Frame-Options":"DENY","X-Cache":"MISS","Set-Cookie":"BEC=1f1759df3ccd099821dcf0da6feb0357;Path=\/;Max-Age=126000"}
-[2025-08-24 20:31:54.910][000000012.080]  411922
-[2025-08-24 20:31:54.936][000000012.082] I/user.HTTP下载 文件大小验证 预期: 411922 实际: 411922
-[2025-08-24 20:31:54.979][000000012.083] I/user.HTTP下载 资源清理完成
+[2025-11-14 11:52:24.522][000000002.310] I/user.HTTP下载 开始下载任务
+[2025-11-14 11:52:24.539][000000002.314] dns_run 676:cdn.openluat-erp.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
+[2025-11-14 11:52:24.550][000000002.316] D/mobile TIME_SYNC 0
+[2025-11-14 11:52:24.567][000000002.390] dns_run 693:dns all done ,now stop
+[2025-11-14 11:53:02.635][000000040.462] I/user.HTTP下载 下载完成 success 200 
+[2025-11-14 11:53:02.650][000000040.462] {"x-oss-hash-crc64ecma":"7570337686322137116","x-oss-server-time":"104","x-oss-object-type":"Normal","Content-Length":"3389723","Via":"cache19.l2cn3022[331,331,200-0,M], cache35.l2cn3022[333,0], kunlun19.cn5230[416,415,200-0,M], kunlun19.cn5230[421,0]","x-oss-cdn-auth":"success","Date":"Fri, 14 Nov 2025 03:52:24 GMT","x-oss-request-id":"6916A7782B654B37362C05B4","Content-MD5":"Ap894+Aw36xpOHjjgfW0Cw==","Last-Modified":"Wed, 03 Sep 2025 07:26:20 GMT","Connection":"keep-alive","Server":"Tengine","ETag":"\"029F3DE3E030DFAC693878E381F5B40B\"","Timing-Allow-Origin":"*","X-Swift-CacheTime":"3600","Accept-Ranges":"bytes","x-oss-storage-class":"Standard","Content-Type":"application\/octet-stream","X-Swift-SaveTime":"Fri, 14 Nov 2025 03:52:24 GMT","X-Cache":"MISS TCP_MISS dirn:-2:-2","Ali-Swift-Global-Savetime":"1763092344","EagleId":"6f30473017630923443325751e"}
+[2025-11-14 11:53:02.667][000000040.462]  3389723
+[2025-11-14 11:53:02.679][000000040.464] I/user.HTTP下载 文件大小验证 预期: 3389723 实际: 3389723
+[2025-11-14 11:53:02.693][000000040.465] I/user.HTTP下载 资源清理完成
+
 
 (4)网络连接与HTTP上传
-[2025-09-24 18:07:54.587][000000000.360] I/user.main tfcard 001.000.000
-[2025-09-24 18:07:54.601][000000000.396] W/user.HTTP上传 等待网络连接 1 3
-[2025-09-24 18:07:56.758][000000004.693] D/mobile cid1, state0
-[2025-09-24 18:07:56.763][000000004.694] D/mobile bearer act 0, result 0
-[2025-09-24 18:07:56.774][000000004.695] D/mobile NETIF_LINK_ON -> IP_READY
-[2025-09-24 18:07:56.779][000000004.696] I/user.HTTP上传 网络已就绪 1 3
-[2025-09-24 18:07:56.791][000000004.696] SPI_HWInit 552:spi1 speed 2000000,1994805,154
-[2025-09-24 18:07:56.796][000000004.697] D/fatfs init sdcard at spi=1 cs=20
-[2025-09-24 18:07:56.809][000000004.716] D/SPI_TF 卡容量 122138624KB
-[2025-09-24 18:07:56.828][000000004.716] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
-[2025-09-24 18:07:56.833][000000004.725] I/user.HTTP上传 准备上传文件 /sd/30M_test.txt 大小: 31467520 字节
-[2025-09-24 18:07:56.852][000000004.725] I/user.HTTP上传 开始上传任务
-[2025-09-24 18:07:56.860][000000004.730] D/socket connect to airtest.openluat.com,2900
-[2025-09-24 18:07:56.865][000000004.731] dns_run 676:airtest.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
-[2025-09-24 18:07:56.869][000000004.799] dns_run 693:dns all done ,now stop
-[2025-09-24 18:07:56.885][000000004.881] soc_cms_proc 2189:cenc report 1,51,1,15
-[2025-09-24 18:07:57.063][000000005.068] D/mobile NETIF_LINK_ON -> IP_READY
-[2025-09-24 18:07:58.364][000000006.364] D/mobile ims reg state 0
-[2025-09-24 18:07:58.375][000000006.365] D/mobile LUAT_MOBILE_EVENT_CC status 0
-[2025-09-24 18:07:58.385][000000006.365] D/mobile LUAT_MOBILE_CC_READY
-[2025-09-24 18:09:32.042][000000100.039] I/user.httpplus 等待服务器完成响应
-[2025-09-24 18:09:32.135][000000100.135] I/user.httpplus 等待服务器完成响应
-[2025-09-24 18:09:32.982][000000100.973] I/user.httpplus 服务器已完成响应,开始解析响应
-[2025-09-24 18:09:32.997][000000100.998] I/user.HTTP上传 上传完成 success 200
-[2025-09-24 18:09:33.004][000000100.998] I/user.HTTP上传 服务器响应头 {"Content-Type":"text\/plain;charset=UTF-8","Connection":"close","Content-Length":"20","Vary":"Access-Control-Request-Headers","Date":"Wed, 24 Sep 2025 10"}
-[2025-09-24 18:09:33.011][000000100.999] I/user.HTTP上传 服务器响应体长度 20
-[2025-09-24 18:09:33.021][000000101.000] I/user.HTTP上传 服务器响应内容 uploadFileToStaticOK
-[2025-09-24 18:09:33.027][000000101.000] I/user.HTTP上传 资源清理完成
+[2025-11-14 12:10:07.428][000000000.266] I/user.main tfcard 001.000.000
+[2025-11-14 12:10:07.433][000000000.288] W/user.HTTP上传 等待网络连接 1 1
+[2025-11-14 12:10:07.732][000000001.289] W/user.HTTP上传 等待网络连接 1 1
+[2025-11-14 12:10:08.580][000000002.059] D/mobile cid1, state0
+[2025-11-14 12:10:08.586][000000002.059] D/mobile bearer act 0, result 0
+[2025-11-14 12:10:08.597][000000002.060] D/mobile NETIF_LINK_ON -> IP_READY
+[2025-11-14 12:10:08.606][000000002.061] I/user.HTTP上传 网络已就绪 1 1
+[2025-11-14 12:10:08.611][000000002.062] SPI_HWInit 552:spi1 speed 2000000,1994805,154
+[2025-11-14 12:10:08.615][000000002.062] D/fatfs init sdcard at spi=1 cs=12
+[2025-11-14 12:10:08.666][000000002.224] D/SPI_TF 卡容量 125173760KB
+[2025-11-14 12:10:08.671][000000002.224] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
+[2025-11-14 12:10:08.676][000000002.230] I/user.HTTP上传 准备上传文件 /sd/3_23MB.bin 大小: 3389723 字节
+[2025-11-14 12:10:08.687][000000002.230] I/user.HTTP上传 开始上传任务
+[2025-11-14 12:10:08.691][000000002.234] D/socket connect to airtest.openluat.com,2900
+[2025-11-14 12:10:08.699][000000002.235] dns_run 676:airtest.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
+[2025-11-14 12:10:08.704][000000002.237] D/mobile TIME_SYNC 0
+[2025-11-14 12:10:08.736][000000002.291] dns_run 693:dns all done ,now stop
+[2025-11-14 12:10:19.571][000000013.118] I/user.httpplus 等待服务器完成响应
+[2025-11-14 12:10:19.974][000000013.519] I/user.httpplus 等待服务器完成响应
+[2025-11-14 12:10:19.980][000000013.529] I/user.httpplus 服务器已完成响应,开始解析响应
+[2025-11-14 12:10:20.005][000000013.555] I/user.HTTP上传 上传完成 success 200
+[2025-11-14 12:10:20.010][000000013.555] I/user.HTTP上传 服务器响应头 {"Content-Type":"text\/plain;charset=UTF-8","Connection":"close","Content-Length":"20","Vary":"Access-Control-Request-Headers","Date":"Fri, 14 Nov 2025 04"}
+[2025-11-14 12:10:20.017][000000013.556] I/user.HTTP上传 服务器响应体长度 20
+[2025-11-14 12:10:20.026][000000013.557] I/user.HTTP上传 服务器响应内容 uploadFileToStaticOK
+[2025-11-14 12:10:20.031][000000013.557] I/user.HTTP上传 资源清理完成
 ```

+ 1 - 1
module/Air8000/demo/tf_card/http_download_file.lua

@@ -47,7 +47,7 @@ local function http_download_file_task()
     log.info("HTTP下载", "开始下载任务")
 
     -- 核心下载操作开始 (支持http和https)
-    -- local code, headers, body = http.request("GET", "...", nil, nil, {dst = "/sd/1.mp3"}).wait()
+    -- local code, headers, body = http.request("GET", "...", nil, nil, {dst = "/sd/3_23MB.bin"}).wait()
     -- 其中 "..."为url地址, 支持 http和https, 支持域名, 支持自定义端口。
     local code, headers, body_size = http.request("GET",
                                     "https://cdn.openluat-erp.openluat.com/erp_site_file/product_file/AirM2M_780EHT_V2017_LTE_AT.dfota.bin",

+ 3 - 3
module/Air8000/demo/tf_card/main.lua

@@ -82,11 +82,11 @@ require "ch390_manager"
 不符合正常的业务逻辑,用户在参考编程的时候也要注意。]]
 
 --加载tf卡测试应用模块
--- require "tfcard_app"
+require "tfcard_app"
 --加载HTTP下载存入TF卡功能演示模块
---require "http_download_file"
+-- require "http_download_file"
 --加载HTTP上传文件到服务器的功能演示模块
-require "http_upload_file"
+-- require "http_upload_file"
 
 -- 用户代码已结束---------------------------------------------
 -- 结尾总是这一句

+ 88 - 89
module/Air8000/demo/tf_card/readme.md

@@ -17,6 +17,7 @@
 - 加载ch390_manager模块(通过require "ch390_manager")。
 - 加载tfcard_app模块(通过require "tfcard_app")
 - 加载http_download_file模块(通过require "http_download_file")
+- 加载http_upload_file模块(通过require "http_upload_file")
 - 最后运行sys.run()。
 
 ### 2、CH390控制模块(ch390_manager.lua)
@@ -135,101 +136,99 @@
 
 ```lua
 (1)TF卡初始化与挂载
-[2025-08-24 19:51:24.152][000000001.389] SPI_HWInit 552:spi1 speed 2000000,1994805,154
-[2025-08-24 19:51:24.213][000000002.390] D/fatfs init sdcard at spi=1 cs=20
-[2025-08-24 19:51:24.286][000000002.390] SPI_SetNewConfig 996:spi1 speed 400000,400000
-[2025-08-24 19:51:24.329][000000002.408] SPI_SetNewConfig 996:spi1 speed 24000000,25600000
-[2025-08-24 19:51:24.383][000000002.408] D/SPI_TF 卡容量 122138624KB
-[2025-08-24 19:51:24.430][000000002.408] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
-[2025-08-24 19:51:24.477][000000002.412] I/user.fatfs.mount 挂载成功 0
-[2025-08-24 19:51:24.535][000000002.617] I/user.fatfs getfree {"free_sectors":244262144,"total_kb":122132480,"free_kb":122131072,"total_sectors":244264960}
-[2025-08-24 19:51:24.583][000000002.618] I/user.fs lsmount [{"fs":"ec7xx","path":""},{"fs":"inline","path":"\/lua\/"},{"fs":"ram","path":"\/ram\/"},{"fs":"luadb","path":"\/luadb\/"},{"fs":"fatfs","path":"\/sd"}]
+[2025-11-14 11:49:12.769][000000000.278] SPI_HWInit 552:spi1 speed 2000000,1994805,154
+[2025-11-14 11:49:12.788][000000000.279] D/fatfs init sdcard at spi=1 cs=20
+[2025-11-14 11:49:12.811][000000000.407] D/SPI_TF 卡容量 125173760KB
+[2025-11-14 11:49:12.822][000000000.408] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
+[2025-11-14 11:49:12.835][000000000.412] I/user.fatfs.mount 挂载成功 0
+[2025-11-14 11:49:12.844][000000000.665] I/user.fatfs getfree {"free_sectors":250335488,"total_kb":125168512,"free_kb":125167744,"total_sectors":250337024}
+[2025-11-14 11:49:12.873][000000000.666] I/user.fs lsmount [{"fs":"ec7xx","path":""},{"fs":"inline","path":"\/lua\/"},{"fs":"ram","path":"\/ram\/"},{"fs":"luadb","path":"\/luadb\/"},{"fs":"fatfs","path":"\/sd"}]
+
 
 
 (2)文件操作演示
-[2025-08-24 19:51:24.685][000000002.619] I/user.文件操作 ===== 开始文件操作 =====
-[2025-08-24 19:51:25.145][000000003.032] I/user.io.mkdir 目录创建成功 路径:/sd/io_test
-[2025-08-24 19:51:25.231][000000003.043] I/user.文件创建 文件写入成功 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.297][000000003.046] I/user.io.exists 文件存在 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.376][000000003.049] I/user.io.fileSize 文件大小:41字节 路径:/sd/io_test/boottime
-[2025-08-24 19:51:25.467][000000003.052] I/user.文件读取 路径:/sd/io_test/boottime 内容:这是io库API文档示例的测试内容
-[2025-08-24 19:51:25.547][000000003.056] I/user.启动计数 文件内容: 这是io库API文档示例的测试内容 十六进制: E8BF99E698AF696FE5BA93415049E69687E6A1A3E7A4BAE4BE8BE79A84E6B58BE8AF95E58685E5AEB9 82
-[2025-08-24 19:51:25.616][000000003.056] I/user.启动计数 当前值: 0
-[2025-08-24 19:51:25.693][000000003.057] I/user.启动计数 更新值: 1
-[2025-08-24 19:51:25.736][000000003.068] I/user.文件写入 路径:/sd/io_test/boottime 内容: 1
-[2025-08-24 19:51:25.795][000000003.081] I/user.文件创建 路径:/sd/io_test/test_a 初始内容:ABC
-[2025-08-24 19:51:25.852][000000003.088] I/user.文件追加 路径:/sd/io_test/test_a 追加内容:def
-[2025-08-24 19:51:25.909][000000003.091] I/user.文件验证 路径:/sd/io_test/test_a 内容:ABCdef 结果: 成功
-[2025-08-24 19:51:25.954][000000003.102] I/user.文件创建 路径:/sd/io_test/testline 写入3行文本
-[2025-08-24 19:51:26.001][000000003.106] I/user.按行读取 路径:/sd/io_test/testline 第1行: abc
-[2025-08-24 19:51:26.048][000000003.106] I/user.按行读取 路径:/sd/io_test/testline 第2行: 123
-[2025-08-24 19:51:26.093][000000003.107] I/user.按行读取 路径:/sd/io_test/testline 第3行: wendal
-[2025-08-24 19:51:26.140][000000003.112] I/user.os.rename 文件重命名成功 原路径:/sd/io_test/test_a 新路径:/sd/io_test/renamed_file.txt
-[2025-08-24 19:51:26.188][000000003.116] D/fatfs f_open /io_test/test_a 4
-[2025-08-24 19:51:26.238][000000003.116] D/vfs fopen /sd/io_test/test_a r not found
-[2025-08-24 19:51:26.312][000000003.117] I/user.验证结果 重命名验证成功 新文件存在 原文件不存在
-[2025-08-24 19:51:26.367][000000003.117] I/user.目录操作 ===== 开始目录列举 =====
-[2025-08-24 19:51:26.424][000000003.121] I/user.fs lsdir [{"name":"boottime","size":0,"type":0},{"name":"testline","size":0,"type":0},{"name":"renamed_file.txt","size":0,"type":0}]
-[2025-08-24 19:51:26.478][000000003.127] I/user.os.remove 文件删除成功 路径:/sd/io_test/renamed_file.txt
-[2025-08-24 19:51:26.539][000000003.129] D/fatfs f_open /io_test/renamed_file.txt 4
-[2025-08-24 19:51:26.593][000000003.130] D/vfs fopen /sd/io_test/renamed_file.txt r not found
-[2025-08-24 19:51:26.656][000000003.130] I/user.验证结果 renamed_file.txt文件删除验证成功
-[2025-08-24 19:51:26.734][000000003.137] I/user.os.remove testline文件删除成功 路径:/sd/io_test/testline
-[2025-08-24 19:51:26.856][000000003.139] D/fatfs f_open /io_test/testline 4
-[2025-08-24 19:51:26.922][000000003.140] D/vfs fopen /sd/io_test/testline r not found
-[2025-08-24 19:51:27.113][000000003.140] I/user.验证结果 testline文件删除验证成功
-[2025-08-24 19:51:27.197][000000003.147] I/user.os.remove 文件删除成功 路径:/sd/io_test/boottime
-[2025-08-24 19:51:27.251][000000003.149] D/fatfs f_open /io_test/boottime 4
-[2025-08-24 19:51:27.302][000000003.150] D/vfs fopen /sd/io_test/boottime r not found
-[2025-08-24 19:51:27.365][000000003.150] I/user.验证结果 boottime文件删除验证成功
-[2025-08-24 19:51:27.407][000000003.158] I/user.io.rmdir 目录删除成功 路径:/sd/io_test
-[2025-08-24 19:51:27.461][000000003.159] D/fatfs f_open /io_test 4
-[2025-08-24 19:51:27.536][000000003.159] D/vfs fopen /sd/io_test r not found
-[2025-08-24 19:51:27.610][000000003.159] I/user.验证结果 目录删除验证成功
-[2025-08-24 19:51:27.668][000000003.160] I/user.文件操作 ===== 文件操作完成 =====
-[2025-08-24 19:51:27.712][000000003.160] I/user.系统清理 开始执行关闭操作...
-[2025-08-24 19:51:27.772][000000003.160] I/user.文件系统 卸载成功
-[2025-08-24 19:51:27.867][000000003.160] I/user.SPI接口 已关闭
+[2025-11-14 11:49:12.880][000000000.666] I/user.文件操作 ===== 开始文件操作 =====
+[2025-11-14 11:49:13.111][000000001.254] I/user.io.mkdir 目录创建成功 路径:/sd/io_test
+[2025-11-14 11:49:13.116][000000001.267] I/user.文件创建 文件写入成功 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.123][000000001.270] I/user.io.exists 文件存在 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.127][000000001.273] I/user.io.fileSize 文件大小:41字节 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.131][000000001.276] I/user.文件读取 路径:/sd/io_test/boottime 内容:这是io库API文档示例的测试内容
+[2025-11-14 11:49:13.148][000000001.280] I/user.启动计数 文件内容: 这是io库API文档示例的测试内容 十六进制: E8BF99E698AF696FE5BA93415049E69687E6A1A3E7A4BAE4BE8BE79A84E6B58BE8AF95E58685E5AEB9 82
+[2025-11-14 11:49:13.157][000000001.280] I/user.启动计数 当前值: 0
+[2025-11-14 11:49:13.165][000000001.281] I/user.启动计数 更新值: 1
+[2025-11-14 11:49:13.178][000000001.292] I/user.文件写入 路径:/sd/io_test/boottime 内容: 1
+[2025-11-14 11:49:13.188][000000001.308] I/user.文件创建 路径:/sd/io_test/test_a 初始内容:ABC
+[2025-11-14 11:49:13.194][000000001.314] I/user.文件追加 路径:/sd/io_test/test_a 追加内容:def
+[2025-11-14 11:49:13.203][000000001.318] I/user.文件验证 路径:/sd/io_test/test_a 内容:ABCdef 结果: 成功
+[2025-11-14 11:49:13.208][000000001.334] I/user.文件创建 路径:/sd/io_test/testline 写入3行文本
+[2025-11-14 11:49:13.215][000000001.338] I/user.按行读取 路径:/sd/io_test/testline 第1行: abc
+[2025-11-14 11:49:13.219][000000001.338] I/user.按行读取 路径:/sd/io_test/testline 第2行: 123
+[2025-11-14 11:49:13.223][000000001.339] I/user.按行读取 路径:/sd/io_test/testline 第3行: wendal
+[2025-11-14 11:49:13.232][000000001.344] I/user.os.rename 文件重命名成功 原路径:/sd/io_test/test_a 新路径:/sd/io_test/renamed_file.txt
+[2025-11-14 11:49:13.236][000000001.348] D/fatfs f_open /io_test/test_a 4
+[2025-11-14 11:49:13.242][000000001.349] D/vfs fopen /sd/io_test/test_a r not found
+[2025-11-14 11:49:13.247][000000001.349] I/user.验证结果 重命名验证成功 新文件存在 原文件不存在
+[2025-11-14 11:49:13.252][000000001.349] I/user.目录操作 ===== 开始目录列举 =====
+[2025-11-14 11:49:13.259][000000001.357] I/user.fs lsdir [{"name":"boottime","size":1,"type":0},{"name":"testline","size":15,"type":0},{"name":"renamed_file.txt","size":6,"type":0}]
+[2025-11-14 11:49:13.264][000000001.364] I/user.os.remove 文件删除成功 路径:/sd/io_test/renamed_file.txt
+[2025-11-14 11:49:13.276][000000001.366] D/fatfs f_open /io_test/renamed_file.txt 4
+[2025-11-14 11:49:13.281][000000001.366] D/vfs fopen /sd/io_test/renamed_file.txt r not found
+[2025-11-14 11:49:13.287][000000001.367] I/user.验证结果 renamed_file.txt文件删除验证成功
+[2025-11-14 11:49:13.293][000000001.373] I/user.os.remove testline文件删除成功 路径:/sd/io_test/testline
+[2025-11-14 11:49:13.297][000000001.375] D/fatfs f_open /io_test/testline 4
+[2025-11-14 11:49:13.305][000000001.376] D/vfs fopen /sd/io_test/testline r not found
+[2025-11-14 11:49:13.310][000000001.376] I/user.验证结果 testline文件删除验证成功
+[2025-11-14 11:49:13.315][000000001.383] I/user.os.remove 文件删除成功 路径:/sd/io_test/boottime
+[2025-11-14 11:49:13.323][000000001.385] D/fatfs f_open /io_test/boottime 4
+[2025-11-14 11:49:13.328][000000001.386] D/vfs fopen /sd/io_test/boottime r not found
+[2025-11-14 11:49:13.332][000000001.386] I/user.验证结果 boottime文件删除验证成功
+[2025-11-14 11:49:13.339][000000001.393] I/user.io.rmdir 目录删除成功 路径:/sd/io_test
+[2025-11-14 11:49:13.343][000000001.395] D/fatfs f_open /io_test 4
+[2025-11-14 11:49:13.348][000000001.395] D/vfs fopen /sd/io_test r not found
+[2025-11-14 11:49:13.352][000000001.395] I/user.验证结果 目录删除验证成功
+[2025-11-14 11:49:13.359][000000001.395] I/user.文件操作 ===== 文件操作完成 =====
+[2025-11-14 11:49:13.369][000000001.396] I/user.结束 开始执行关闭操作...
+[2025-11-14 11:49:13.373][000000001.396] I/user.文件系统 卸载成功
+[2025-11-14 11:49:13.379][000000001.396] I/user.SPI接口 已关闭
+
 
 
 (3)网络连接与HTTP下载
-[2025-08-24 20:31:49.405][000000006.268] I/user.HTTP下载 开始下载任务
-[2025-08-24 20:31:49.438][000000006.275] dns_run 674:gitee.com state 0 id 1 ipv6 0 use dns server2, try 0
-[2025-08-24 20:31:49.471][000000006.277] D/mobile TIME_SYNC 0
-[2025-08-24 20:31:49.503][000000006.297] dns_run 691:dns all done ,now stop
-[2025-08-24 20:31:54.800][000000012.080] I/user.HTTP下载 下载完成 success 200 
-[2025-08-24 20:31:54.872][000000012.080] {"Age":"0","Cache-Control":"public, max-age=60","Via":"1.1 varnish","Transfer-Encoding":"chunked","Date":"Sun, 24 Aug 2025 12:31:49 GMT","Access-Control-Allow-Credentials":"true","Vary":"Accept-Encoding","X-Served-By":"cache-ffe9","X-Gitee-Server":"http-pilot 1.9.21","Connection":"keep-alive","Server":"ADAS\/1.0.214","Access-Control-Allow-Headers":"Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-CustomHeader,Content-Range,Range,Set-Language","Content-Security-Policy":"default-src 'none'; style-src 'unsafe-inline'; sandbox","X-Request-Id":"1f7e4b55-53c8-440a-9806-8894aa823f50","Accept-Ranges":"bytes","Etag":"W\/\"6ea36a6c51a48eaba0ffbc01d409424e7627bc56\"","Content-Type":"text\/plain; charset=utf-8","Access-Control-Allow-Methods":"GET, POST, PUT, PATCH, DELETE, OPTIONS","X-Frame-Options":"DENY","X-Cache":"MISS","Set-Cookie":"BEC=1f1759df3ccd099821dcf0da6feb0357;Path=\/;Max-Age=126000"}
-[2025-08-24 20:31:54.910][000000012.080]  411922
-[2025-08-24 20:31:54.936][000000012.082] I/user.HTTP下载 文件大小验证 预期: 411922 实际: 411922
-[2025-08-24 20:31:54.979][000000012.083] I/user.HTTP下载 资源清理完成
+[2025-11-14 11:52:24.522][000000002.310] I/user.HTTP下载 开始下载任务
+[2025-11-14 11:52:24.539][000000002.314] dns_run 676:cdn.openluat-erp.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
+[2025-11-14 11:52:24.550][000000002.316] D/mobile TIME_SYNC 0
+[2025-11-14 11:52:24.567][000000002.390] dns_run 693:dns all done ,now stop
+[2025-11-14 11:53:02.635][000000040.462] I/user.HTTP下载 下载完成 success 200 
+[2025-11-14 11:53:02.650][000000040.462] {"x-oss-hash-crc64ecma":"7570337686322137116","x-oss-server-time":"104","x-oss-object-type":"Normal","Content-Length":"3389723","Via":"cache19.l2cn3022[331,331,200-0,M], cache35.l2cn3022[333,0], kunlun19.cn5230[416,415,200-0,M], kunlun19.cn5230[421,0]","x-oss-cdn-auth":"success","Date":"Fri, 14 Nov 2025 03:52:24 GMT","x-oss-request-id":"6916A7782B654B37362C05B4","Content-MD5":"Ap894+Aw36xpOHjjgfW0Cw==","Last-Modified":"Wed, 03 Sep 2025 07:26:20 GMT","Connection":"keep-alive","Server":"Tengine","ETag":"\"029F3DE3E030DFAC693878E381F5B40B\"","Timing-Allow-Origin":"*","X-Swift-CacheTime":"3600","Accept-Ranges":"bytes","x-oss-storage-class":"Standard","Content-Type":"application\/octet-stream","X-Swift-SaveTime":"Fri, 14 Nov 2025 03:52:24 GMT","X-Cache":"MISS TCP_MISS dirn:-2:-2","Ali-Swift-Global-Savetime":"1763092344","EagleId":"6f30473017630923443325751e"}
+[2025-11-14 11:53:02.667][000000040.462]  3389723
+[2025-11-14 11:53:02.679][000000040.464] I/user.HTTP下载 文件大小验证 预期: 3389723 实际: 3389723
+[2025-11-14 11:53:02.693][000000040.465] I/user.HTTP下载 资源清理完成
+
 
 (4)网络连接与HTTP上传
-[2025-09-24 18:07:54.587][000000000.360] I/user.main tfcard 001.000.000
-[2025-09-24 18:07:54.601][000000000.396] W/user.HTTP上传 等待网络连接 1 3
-[2025-09-24 18:07:56.758][000000004.693] D/mobile cid1, state0
-[2025-09-24 18:07:56.763][000000004.694] D/mobile bearer act 0, result 0
-[2025-09-24 18:07:56.774][000000004.695] D/mobile NETIF_LINK_ON -> IP_READY
-[2025-09-24 18:07:56.779][000000004.696] I/user.HTTP上传 网络已就绪 1 3
-[2025-09-24 18:07:56.791][000000004.696] SPI_HWInit 552:spi1 speed 2000000,1994805,154
-[2025-09-24 18:07:56.796][000000004.697] D/fatfs init sdcard at spi=1 cs=20
-[2025-09-24 18:07:56.809][000000004.716] D/SPI_TF 卡容量 122138624KB
-[2025-09-24 18:07:56.828][000000004.716] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
-[2025-09-24 18:07:56.833][000000004.725] I/user.HTTP上传 准备上传文件 /sd/30M_test.txt 大小: 31467520 字节
-[2025-09-24 18:07:56.852][000000004.725] I/user.HTTP上传 开始上传任务
-[2025-09-24 18:07:56.860][000000004.730] D/socket connect to airtest.openluat.com,2900
-[2025-09-24 18:07:56.865][000000004.731] dns_run 676:airtest.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
-[2025-09-24 18:07:56.869][000000004.799] dns_run 693:dns all done ,now stop
-[2025-09-24 18:07:56.885][000000004.881] soc_cms_proc 2189:cenc report 1,51,1,15
-[2025-09-24 18:07:57.063][000000005.068] D/mobile NETIF_LINK_ON -> IP_READY
-[2025-09-24 18:07:58.364][000000006.364] D/mobile ims reg state 0
-[2025-09-24 18:07:58.375][000000006.365] D/mobile LUAT_MOBILE_EVENT_CC status 0
-[2025-09-24 18:07:58.385][000000006.365] D/mobile LUAT_MOBILE_CC_READY
-[2025-09-24 18:09:32.042][000000100.039] I/user.httpplus 等待服务器完成响应
-[2025-09-24 18:09:32.135][000000100.135] I/user.httpplus 等待服务器完成响应
-[2025-09-24 18:09:32.982][000000100.973] I/user.httpplus 服务器已完成响应,开始解析响应
-[2025-09-24 18:09:32.997][000000100.998] I/user.HTTP上传 上传完成 success 200
-[2025-09-24 18:09:33.004][000000100.998] I/user.HTTP上传 服务器响应头 {"Content-Type":"text\/plain;charset=UTF-8","Connection":"close","Content-Length":"20","Vary":"Access-Control-Request-Headers","Date":"Wed, 24 Sep 2025 10"}
-[2025-09-24 18:09:33.011][000000100.999] I/user.HTTP上传 服务器响应体长度 20
-[2025-09-24 18:09:33.021][000000101.000] I/user.HTTP上传 服务器响应内容 uploadFileToStaticOK
-[2025-09-24 18:09:33.027][000000101.000] I/user.HTTP上传 资源清理完成
+[2025-11-14 12:10:07.428][000000000.266] I/user.main tfcard 001.000.000
+[2025-11-14 12:10:07.433][000000000.288] W/user.HTTP上传 等待网络连接 1 1
+[2025-11-14 12:10:07.732][000000001.289] W/user.HTTP上传 等待网络连接 1 1
+[2025-11-14 12:10:08.580][000000002.059] D/mobile cid1, state0
+[2025-11-14 12:10:08.586][000000002.059] D/mobile bearer act 0, result 0
+[2025-11-14 12:10:08.597][000000002.060] D/mobile NETIF_LINK_ON -> IP_READY
+[2025-11-14 12:10:08.606][000000002.061] I/user.HTTP上传 网络已就绪 1 1
+[2025-11-14 12:10:08.611][000000002.062] SPI_HWInit 552:spi1 speed 2000000,1994805,154
+[2025-11-14 12:10:08.615][000000002.062] D/fatfs init sdcard at spi=1 cs=20
+[2025-11-14 12:10:08.666][000000002.224] D/SPI_TF 卡容量 125173760KB
+[2025-11-14 12:10:08.671][000000002.224] D/SPI_TF sdcard init OK OCR:0xc0ff8000!
+[2025-11-14 12:10:08.676][000000002.230] I/user.HTTP上传 准备上传文件 /sd/3_23MB.bin 大小: 3389723 字节
+[2025-11-14 12:10:08.687][000000002.230] I/user.HTTP上传 开始上传任务
+[2025-11-14 12:10:08.691][000000002.234] D/socket connect to airtest.openluat.com,2900
+[2025-11-14 12:10:08.699][000000002.235] dns_run 676:airtest.openluat.com state 0 id 1 ipv6 0 use dns server2, try 0
+[2025-11-14 12:10:08.704][000000002.237] D/mobile TIME_SYNC 0
+[2025-11-14 12:10:08.736][000000002.291] dns_run 693:dns all done ,now stop
+[2025-11-14 12:10:19.571][000000013.118] I/user.httpplus 等待服务器完成响应
+[2025-11-14 12:10:19.974][000000013.519] I/user.httpplus 等待服务器完成响应
+[2025-11-14 12:10:19.980][000000013.529] I/user.httpplus 服务器已完成响应,开始解析响应
+[2025-11-14 12:10:20.005][000000013.555] I/user.HTTP上传 上传完成 success 200
+[2025-11-14 12:10:20.010][000000013.555] I/user.HTTP上传 服务器响应头 {"Content-Type":"text\/plain;charset=UTF-8","Connection":"close","Content-Length":"20","Vary":"Access-Control-Request-Headers","Date":"Fri, 14 Nov 2025 04"}
+[2025-11-14 12:10:20.017][000000013.556] I/user.HTTP上传 服务器响应体长度 20
+[2025-11-14 12:10:20.026][000000013.557] I/user.HTTP上传 服务器响应内容 uploadFileToStaticOK
+[2025-11-14 12:10:20.031][000000013.557] I/user.HTTP上传 资源清理完成
 ```