123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #ifndef _FLASH_H_
- #define _FLASH_H_
- /* includes ----------------------------------------------------------*/
- #include "stm32f1xx_hal.h"
- #include "FreeRTOS.h"
- #include "task.h"
- /* typedef -----------------------------------------------------------*/
- typedef struct{
- uint8_t updateFlag; // 更新标志
- uint8_t pageNumMove; // 需要进行搬移的flash页的数量
- uint16_t b; // 预留
- uint32_t jumpAddr; // 跳转地址
- }param_boot;
- extern param_boot s_param_boot;
- /* define ------------------------------------------------------------*/
- #define APP1_ADDRESS ((unsigned int)0x8002800U) // 0x8002800-0x8040C00 250k 程序运行区
- #define APP2_ADDRESS ((unsigned int)0x8041000U) // 0x8040C00-0x807F000 248k 下载备份区
- #define PARAM_ADDRESS ((unsigned int)0x807F000U) // 0x807F000-0x80800000 4k
- /* macro -------------------------------------------------------------*/
- /* variables ---------------------------------------------------------*/
- /* function prototypes -----------------------------------------------*/
- // @brief 参数区数据读取
- void Read_ParamArea(void);
- // @brief 向量重映射
- void Remap_Vector_Table(void);
- // @brief flash按字写入
- HAL_StatusTypeDef FLASH_Write(uint32_t address, uint32_t *data, uint32_t length);
- // @brief 写参数区数据
- void Write_paramArea(void);
- // @brief flash按页擦除
- HAL_StatusTypeDef FLASH_Erase(uint32_t start_address, uint32_t number_of_pages);
- // @brief flash读数据
- void FLASH_Read(uint32_t address, uint32_t *read_buf, uint32_t length);
- #endif
|