基于rtthread studio的STM32F407OTA升级(ymodem篇)

基于rtthread studio的STM32F407OTA升级(ymodem篇)

0、部分电路图

image-20211104164230283

1、在线生成Bootloader

官方参考地址

在线生成地址

1553247249515

1553247299946

1553247372693

1553247497496

image-20211104170850907

提示:

1M = 1024kB = 8 * 128 kB
128kB = 0x20000

此处,我将ROM按以下分区,大家可根据实际情况自行划分

未命名绘图.drawio

按照上面分析,分区表配置为

image-20211105143136163

1553673658407

2、烧录BootLoader

2.1、擦除芯片

image-20211105143406163

2.2、烧录boot

image-20211105143631220

2.3、烧录结束串口打印

image-20211105144852664

3、配置工程

3.1、创建工程

image-20211104164343273

3.2、配置cubemx

image-20211105145550578

3.3、添加组件包

image-20211105145739653

image-20211105145844062

image-20211105161113149

3.4、修改board.h

image-20211105150132226

3.5、配置FAL文件

3.5.1、初始化Fal

image-20211105151010119

3.5.2、新增/修改fal_cfg.h文件

image-20211105150640151

/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-11-05     YPD       the first version
 */
#ifndef PACKAGES_FAL_V0_5_0_INC_FAL_CFG_H_
#define PACKAGES_FAL_V0_5_0_INC_FAL_CFG_H_

#include <rtthread.h>
#include "board.h"

#define FLASH_SIZE_GRANULARITY_16K   (4 * 16 * 1024)
#define FLASH_SIZE_GRANULARITY_64K   (64 * 1024)
#define FLASH_SIZE_GRANULARITY_128K  (7 * 128 * 1024)

#define STM32_FLASH_START_ADRESS_16K  STM32_FLASH_START_ADRESS
#define STM32_FLASH_START_ADRESS_64K  (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)

extern const struct fal_flash_dev stm32_onchip_flash_16k;
extern const struct fal_flash_dev stm32_onchip_flash_64k;
extern const struct fal_flash_dev stm32_onchip_flash_128k;
/* flash device table */
#define FAL_FLASH_DEV_TABLE                                          \
{                                                                    \
    &stm32_onchip_flash_128k,                                        \
}
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG

/* partition table */
#define FAL_PART_TABLE                                                                                                     \
{                                                                                                                          \
    {FAL_PART_MAGIC_WROD, "app",     "onchip_flash_128k", 0 ,           (3*128*1024), 0}, \
    {FAL_PART_MAGIC_WROD, "download","onchip_flash_128k", (3*128*1024), (4*128*1024), 0}, \
}


#endif /* FAL_PART_HAS_TABLE_CFG */

#endif /* PACKAGES_FAL_V0_5_0_INC_FAL_CFG_H_ */

image-20211105151726200

3.6、修改 app 固件配置

3.6.1、修改中断向量表的跳转基地址为 0x8020000。
#define RT_APP_PART_ADDR 0x8020000

static int ota_app_vtor_reconfig(void)
{
    #define NVIC_VTOR_MASK   0x3FFFFF80
    /* Set the Vector Table base location by user application firmware definition */
    SCB->VTOR = RT_APP_PART_ADDR & NVIC_VTOR_MASK;

    return 0;
}
INIT_BOARD_EXPORT(ota_app_vtor_reconfig);

image-20211105152923669

3.6.2、修改app固件连接地址

image-20211105153204757

3.7、编译下载

image-20211105161627134

3.8、编译新固件

image-20211105162003553

3.9、打包.rbl文件

image-20211105161440848

image-20211105162424170

4、通过ymodem进行升级

此处使用的是secureCRT工具

image-20211105163018557

image-20211105163153517

image-20211105163422482

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值