main.h 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #ifndef MAIN_H
  2. #define MAIN_H
  3. #include "stdint.h"
  4. #define GD32_FLASH_SADDR 0x08000000 //FLASH起始地址
  5. #define GD32_PAGE_SIZE 1024 //FLASH扇区大小
  6. #define GD32_PAGE_NUM 1024 //FLASH总扇区个数
  7. #define GD32_B_PAGE_NUM 20 //B区扇区个数
  8. #define GD32_A_PAGE_NUM GD32_PAGE_NUM - GD32_B_PAGE_NUM //A区扇区个数
  9. #define GD32_A_START_PAGE GD32_B_PAGE_NUM //A区起始扇区编号
  10. #define GD32_A_SADDR GD32_FLASH_SADDR + GD32_A_START_PAGE * GD32_PAGE_SIZE //A区起始地址
  11. #define OTA_INFOCB_SIZE sizeof(OTA_InfoCB) //OTA相关的信息结构体占用的字节长度
  12. //注意4字节对齐
  13. typedef struct{
  14. uint32_t otaflag; //用于记录是否要从w25q32中读取
  15. uint32_t XmodemByte; //用于记录一共写入了多少字节的数据
  16. }OTA_STRUCT;
  17. extern OTA_STRUCT UpDataA;
  18. void task_fwdgt_reload();
  19. #endif