Openblt流程1:基本框架

今天介绍一下 一款开源的bootloader "openblt"的代码流程,

openblt支持can,RS232,ethernet等多种方式去更新固件,非常的方便

Openblt 官网地址:https://www.feaser.com/openblt/doku.php

由于平时基本使用较多是RS232来更新固件,那么就以这种方式来进行

整体软件框架思路:

明白了整个的软件框架,这边讲解一下Openblt最重要的配置文件 “blt_conf.h

#define BOOT_COM_CAN_ENABLE             (1)
/** \brief Configure the desired CAN baudrate. */
#define BOOT_COM_CAN_BAUDRATE           (500000)
/** \brief Configure CAN message ID target->host. */
#define BOOT_COM_CAN_TX_MSG_ID          (0x7E1 /*| 0x80000000*/)
/** \brief Configure number of bytes in the target->host CAN message. */
#define BOOT_COM_CAN_TX_MAX_DATA        (8)
/** \brief Configure CAN message ID host->target. */
#define BOOT_COM_CAN_RX_MSG_ID          (0x667 /*| 0x80000000*/)
/** \brief Configure number of bytes in the host->target CAN message. */
#define BOOT_COM_CAN_RX_MAX_DATA        (8)
/** \brief Select the desired CAN peripheral as a zero based index. */
#define BOOT_COM_CAN_CHANNEL_INDEX      (1)

/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE 
 * configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed
 * in bits/second. The maximum amount of data bytes in a message for data transmission 
 * and reception is set through BOOT_COM_RS232_TX_MAX_DATA and BOOT_COM_RS232_RX_MAX_DATA, 
 * respectively. It is common for a microcontroller to have more than 1 UART interface
 * on board. The zero-based BOOT_COM_RS232_CHANNEL_INDEX selects the UART interface.
 * 
 */
/** \brief Enable/disable UART transport layer. */
#define BOOT_COM_RS232_ENABLE            (1)
/** \brief Configure the desired communication speed. */
#define BOOT_COM_RS232_BAUDRATE          (57600)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_RS232_TX_MAX_DATA       (64)

这些配置都是以宏定义的方式,比方说要使用RS232,不使用can,那么就可以

#define BOOT_COM_CAN_ENABLE             (0)
#define BOOT_COM_RS232_ENABLE            (1)

设置波特率的话,比方说我们想用115200的波特率,,就如下这么修改

#define BOOT_COM_RS232_BAUDRATE          (115200)

主要文件构成:

openblt_v011101\Target\source

然后对应的mcu的硬件代码,比方说F7,那么它的这些代码也很重要,移植的时候用得上

接下来会拿一个mcu的例子,咋们来分析一下他的源码

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值