94 lines
2.7 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __STMFLASH_H
#define __STMFLASH_H
#include "sys.h"
//////////////////////////////////////////////////////////////////////////////////
/**************************************************************************/
//STM32内部FLASH读写 驱动代码
//STM32H7工程模板-HAL库函数版本
//DevEBox 大越创新
//淘宝店铺mcudev.taobao.com
//淘宝店铺shop389957290.taobao.com
/**************************************************************************/
//////////////////////////////////////////////////////////////////////////////////
//FLASH起始地址
#define STM32_FLASH_BASE 0x08000000 //STM32 FLASH的起始地址
#define FLASH_WAITETIME 50000 //FLASH等待超时时间
//STM32H7 FLASH 扇区的起始地址
//BANK1
#define ADDR_FLASH_SECTOR_0_BANK1 ((uint32_t)0x08000000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_1_BANK1 ((uint32_t)0x08020000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_2_BANK1 ((uint32_t)0x08040000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_3_BANK1 ((uint32_t)0x08060000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_4_BANK1 ((uint32_t)0x08080000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_5_BANK1 ((uint32_t)0x080A0000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_6_BANK1 ((uint32_t)0x080C0000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_7_BANK1 ((uint32_t)0x080E0000) //扇区0起始地址, 128 Kbytes
//BANK2
#define ADDR_FLASH_SECTOR_0_BANK2 ((uint32_t)0x08100000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_1_BANK2 ((uint32_t)0x08120000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_2_BANK2 ((uint32_t)0x08140000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_3_BANK2 ((uint32_t)0x08160000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_4_BANK2 ((uint32_t)0x08180000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_5_BANK2 ((uint32_t)0x081A0000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_6_BANK2 ((uint32_t)0x081C0000) //扇区0起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_7_BANK2 ((uint32_t)0x081E0000) //扇区0起始地址, 128 Kbytes
u32 STMFLASH_ReadWord(u32 faddr); //读出字
void STMFLASH_Write(u32 WriteAddr,u32 *pBuffer,u32 NumToWrite); //从指定地址开始写入指定长度的数据
void STMFLASH_Read(u32 ReadAddr,u32 *pBuffer,u32 NumToRead); //从指定地址开始读出指定长度的数据
#endif
/**************************************************************************/
//FLASH模拟EEPROM 实验
//STM32H7工程模板-HAL库函数版本
//DevEBox 大越创新
//淘宝店铺mcudev.taobao.com
//淘宝店铺shop389957290.taobao.com
/**************************************************************************/