Stm32 如何在代码中找到闪存的大小?
我想得到代码本身中闪存的限制地址,或者至少是这个闪存的大小 我在Stm32 如何在代码中找到闪存的大小?,stm32,hal,Stm32,Hal,我想得到代码本身中闪存的限制地址,或者至少是这个闪存的大小 我在stm32f302xc.h文件中只找到了闪存的开始地址,但没有找到结束地址 /** @addtogroup Peripheral_memory_map * @{ */ #define FLASH_BASE 0x08000000UL /*!< FLASH base address in the alias region */ #define SRAM_BASE 0x2000
stm32f302xc.h
文件中只找到了闪存的开始地址,但没有找到结束地址
/** @addtogroup Peripheral_memory_map
* @{
*/
#define FLASH_BASE 0x08000000UL /*!< FLASH base address in the alias region */
#define SRAM_BASE 0x20000000UL /*!< SRAM base address in the alias region */
#define PERIPH_BASE 0x40000000UL /*!< Peripheral base address in the alias region */
#define SRAM_BB_BASE 0x22000000UL /*!< SRAM base address in the bit-band region */
#define PERIPH_BB_BASE 0x42000000UL /*!< Peripheral base address in the bit-band region */
/**@addtogroup外围设备\u内存\u映射
* @{
*/
#在别名区域中定义闪存基址0x0800000UL/*!<闪存基址*/
#在别名区域中定义SRAM_BASE 0x200000UL/*!
是什么定义导致了这一点,谢谢。参考手册第29.2节“内存大小数据寄存器”中描述了您需要什么 ST提供了这种功能,但由于某些原因,它们并不总是提供一种在标题中访问它的简单方法 此寄存器的地址是
FLASHSIZE\u BASE
。您必须在运行时读取它,例如:
uint16_t flash_size_kb = *(const uint16_t*)FLASHSIZE_BASE;