zhyinch
2021-09-22 451d480321fd775084c0faf5d1877ed83f21d59b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "stm32f10x.h"
 
#define FLASH_SIZE               (uint32_t)0x10000
#define PAGE_SIZE               (0x400)                       //C8T6 Flash is 64KB ,each page is 1KB 
#define MAX_FPAGE_NUM           64
  
#define FLASH_BASE_ADDR           (uint32_t)0x08000000    //the start address of APP,keep the 0x8000000-0x8004FFF forIAP(20K)
#define FLASH_APP_FORMAL_ADDR      (uint32_t)0x08001000    //the start address of formal software
#define FLASH_APP_TEMP_ADDR     (uint32_t)0x08008000    //the start address of temp software,wait for checks
#define FLASH_IAP_CTRL_MAP        (uint32_t)0x0800FC00    //the control map start address,
#define FLASH_HARDWARE_FLAG        (uint32_t)0x0800F800    //the control map start address,
#define MAX_APP_ADDR              (uint32_t)0x0800FFFF    //the max array of Flash address 
 
#define MAX_APP_SIZE              (uint32_t)0x7000      //the max size of software is 28K
#define MAX_APPPAGE_NUM            28
 
#define NVIC_VectTab_FLASH           ((uint32_t)0x08000000)
 
//parameters position
uint32_t FLASH_Pages_Calculate(uint32_t Size);
uint32_t FLASH_Prepare( uint32_t Address, uint32_t Len);
void FLASH_Read( uint32_t Address, uint8_t *Readbuff, uint32_t Len);
uint32_t FLASH_Write( uint32_t Address, const uint8_t* pData, uint32_t Len);
void FLASH_Dis_WriteProt_Pages(void);