2efab2862f
2、Sx1276Type_t 结构体给定固定值 3、lora通道选择取消,通过修改频率来修改通道 4、增加了修改lora参数的函数 5、将USE_BOOTLOADER的宏定义更改到工程预编译define 6、将BootPara_t结构体定义到bsp.h文件下 7、在bsp.h文件下增加了LoraPara_r,RS485Para_t结构体并声明 8、串口带波特率参数初始化 9、增加了MAIN_DBG_LOG和DATA_DBG_LOG调试打印 10、Update.h的boot参数定义在bsp.h获取 11、当工程是app_boot时调试口为Lpuart0,当工程是app_debug时调试口为uart0 12、设备Mac从bootloader中固定地址0x00002800获取,设备类型、通讯方式、设备标志和设备序号从获取到的mac地址解析 13、debug文件增加了调试指令
52 lines
1.5 KiB
C
52 lines
1.5 KiB
C
#ifndef __UPDATE_H
|
|
#define __UPDATE_H
|
|
|
|
#include <stdint.h>
|
|
#include "bsp.h"
|
|
|
|
#define APP_START_FLAG 0x55AA5A5A
|
|
#define APP_UPDATE_FLAG 0xA5A5AA55
|
|
|
|
#define FLASH_SECTOR_SIZE 0x200ul
|
|
#define FLASH_BASE ((uint32_t)0x00000000)
|
|
#define FLASH_SIZE (256u * FLASH_SECTOR_SIZE)
|
|
|
|
#define SRAM_BASE ((uint32_t)0x20000000)
|
|
#define RAM_SIZE 0x2000ul
|
|
|
|
#define BOOT_ADDRESS FLASH_BASE
|
|
#define BOOT_SIZE (20 * FLASH_SECTOR_SIZE)
|
|
#define DEV_MAC_ADDRESS (BOOT_ADDRESS + BOOT_SIZE) //0x00002800
|
|
#define DEV_MAC_SIZE FLASH_SECTOR_SIZE
|
|
#define APP_ADDRESS (DEV_MAC_ADDRESS + DEV_MAC_SIZE)
|
|
|
|
#define BOOT_PARA_ADDRESS (0x0001FC00)//(FLASH_BASE + BOOT_SIZE)
|
|
#define BOOT_PARA_SIZE (FLASH_SECTOR_SIZE)
|
|
|
|
//主机下发升级请求载荷结构体
|
|
typedef struct {
|
|
uint16_t PackageNum;
|
|
uint32_t AppSize;
|
|
uint32_t AppCrc32;
|
|
}__attribute__ ((packed))UpDataRequset_t, *UDReq;
|
|
|
|
//帧头结构体
|
|
typedef struct {
|
|
uint8_t Header;
|
|
uint8_t DevMac[6];
|
|
uint8_t Cmd;
|
|
uint8_t PayloadLen;
|
|
}__attribute__((packed))UpdateFrameHeader_t,*pUpdateFrameHeader;
|
|
|
|
|
|
//输入接口函数定义,需根据接口重新定义
|
|
#define U_DBG_LOG(...) DBG_LOG(__VA_ARGS__)
|
|
#define U_DELAY_MS(x) delay_ms(x)
|
|
#define U_SYSTEM_TESET() SystemReset()
|
|
#define SAVE_BOOT_PARA(addr) SAVE_APP_PARA(addr)
|
|
#define READ_BOOT_PARA(addr) READ_APP_PARA(addr)
|
|
|
|
//输出接口
|
|
void Update(uint8_t *PayLoad);
|
|
void UpdateInit(void);
|
|
#endif |