1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #ifndef _CHIPFLASH_H_
- #define _CHIPFLASH_H_
- #include "stdint.h"
- //#include "drv_ec800k.h"
- #include "stm32l4xx_hal.h"
- //芯片大小 256kb
- #define CHIPFLASH_SIZE 256
- //#define FLASH_BASE ((uint32_t)0x08000000)
- #if CHIPFLASH_SIZE < 256
- #define SECTOR_SIZE 1024 //byte
- #else
- #define SECTOR_SIZE 2048 //byte
- #endif
- extern uint32_t cur_address;
- //应用程序起始地址
- #define APPLICATION_ADDRESS (uint32_t)0x08008000
- //固件标志位信息地址
- #define SET_ADDRESS (APPLICATION_ADDRESS - SECTOR_SIZE)
- #define SET_RESET_ADDRESS (APPLICATION_ADDRESS - 2*SECTOR_SIZE)
- //设备CONFIG地址
- //#define BASE_CONFIG_ADDR (0x0801FC00 - SECTOR_SIZE)
- #define USER_FLASH_END_ADDR 0x0803FFFF
- //有效验证位
- #define AVAILABLE_FLAG (unsigned int)0xA88A
- //extern BASE_CONFIG base_config;
- //extern unsigned short ipaFlag;
- uint16_t FLASH_ReadHalfWord(uint32_t address);
- uint64_t FLASH_ReadDoubleWord(uint32_t address);
- int FLASH_ReadMoreData(uint32_t startAddress, uint64_t *readData, uint32_t countToRead);
- int FLASH_ErasePage(uint32_t StartPage, uint32_t PageNumber);
- void erasure_bin_flash(void);
- int FLASH_Write_DoubleWord(volatile uint32_t FlashAddress, uint64_t *WriteData, uint16_t DataLength);
- #endif
|