基于rtthread studio的STM32F407OTA升级(http篇)
0、前提
0.1、已经完成联网配置
STM32F407VG联网笔记(基于rtthread studio)_LangLang_2020的博客-优快云博客
0.2、已经完成ymodem_OTA升级
基于rtthread studio的STM32F407OTA升级(ymodem篇)_LangLang_2020的博客-优快云博客
1、相关配置



2、更改http_ota.c的文件内容

将原文件中的内容替换为以下内容,具体细节可自行分析源码。
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <rtthread.h>
#include <finsh.h>
#include "webclient.h"
#include <fal.h>
#define DBG_ENABLE
#define DBG_SECTION_NAME "http_ota"
#ifdef OTA_DOWNLOADER_DEBUG
#define DBG_LEVEL DBG_LOG
#else
#define DBG_LEVEL DBG_INFO
#endif
#define DBG_COLOR
#include <rtdbg.h>
#ifdef PKG_USING_HTTP_OTA
#define HTTP_OTA_BUFF_LEN 4096
#define GET_HEADER_BUFSZ 1024
#define GET_RESP_BUFSZ 1024
#define HTTP_OTA_DL_DELAY (10 * RT_TICK_PER_SECOND)
#define HTTP_OTA_URL PKG_HTTP_OTA_URL
static void print_progress(size_t cur_size, size_t total_

本文档详细介绍了如何使用rtthreadstudio配置STM32F407进行HTTP OTA升级。首先,设备需要完成联网配置和ymodem OTA升级的基础步骤。接着,修改http_ota.c文件,实现HTTP OTA下载流程,包括错误处理、进度显示和固件写入。然后,打包生成.rbl升级文件,并启动Web服务器。最后,通过命令行执行http_ota命令来开始升级过程。
最低0.47元/天 解锁文章
2310





