2026-04-23 13:49:53 +08:00
|
|
|
#ifndef _DEV_BOOT_
|
|
|
|
|
#define _DEV_BOOT_
|
|
|
|
|
|
|
|
|
|
#include "hdl_flash.h"
|
|
|
|
|
|
|
|
|
|
#define APP_START_FLAG 0x55AA5A5A
|
|
|
|
|
#define APP_UPDATE_FLAG 0xA5A5AA55
|
2026-07-14 17:24:52 +08:00
|
|
|
#define APP_BOOT_UPGRADE_FLAG 0x5A5A55A5
|
2026-04-23 13:49:53 +08:00
|
|
|
|
|
|
|
|
#define BOOT_BASE (FLASH_BASE)
|
|
|
|
|
#define BOOT_SIZE (4*FLASH_SECTOR_SIZE)
|
|
|
|
|
|
|
|
|
|
#define APP_ADDRESS (BOOT_BASE + BOOT_SIZE)
|
|
|
|
|
#define APP_SIZE (58*FLASH_SECTOR_SIZE)
|
|
|
|
|
|
|
|
|
|
#define BOOT_PARA_ADDRESS (APP_ADDRESS + APP_SIZE)
|
|
|
|
|
#define BOOT_PARA_SIZE (FLASH_SECTOR_SIZE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
uint32_t AppFlag;
|
|
|
|
|
uint32_t DevType;
|
|
|
|
|
uint32_t DevAddr;
|
|
|
|
|
uint32_t UpdateFlag;
|
|
|
|
|
uint32_t PackageNum;
|
|
|
|
|
uint32_t AppSize;
|
|
|
|
|
uint32_t Crc32Check;
|
|
|
|
|
}boot_para_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void dev_boot_read_param(boot_para_t *pParam);
|
|
|
|
|
|
|
|
|
|
int dev_boot_write_param(boot_para_t Param);
|
|
|
|
|
|
|
|
|
|
void dev_boot_erase_app(void);
|
|
|
|
|
|
|
|
|
|
void dev_boot_write_app(uint32_t AddrOffset, uint8_t* wData, int wLen);
|
|
|
|
|
|
|
|
|
|
uint8_t dev_boot_check_app(void);
|
|
|
|
|
|
|
|
|
|
uint32_t dev_boot_get_app_crc32(int dwLen);
|
|
|
|
|
|
|
|
|
|
void dev_boot_run_app(void);
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|