stm32 - 如何在代码本身中找出闪存的大小?
问题描述
我想在代码本身中获取闪存的限制地址,或者至少是这个闪存的大小。
我在文件中只找到了flash的起始地址,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 */
什么定义对此负责,谢谢。
解决方案
参考手册RM0366的第29.2 节内存大小数据寄存器中描述了您想要的内容。
ST 提供了这种功能,但由于某种原因,它们并不总是提供一种在标题中访问它的简单方法。
这个寄存器的地址是FLASHSIZE_BASE
。您必须在运行时阅读它,例如:
uint16_t flash_size_kb = *(const uint16_t*)FLASHSIZE_BASE;
推荐阅读
- makefile - 交叉编译时出错 shared so 依赖于另一个 so
- python - 在 Kubernetes 中使用 PySpark 解压和使用外部模块
- javascript - “TypeError:无法读取未定义的属性‘长度’”
- php - 向出租车司机发送推送通知,但每个循环都有延迟 - php laravel
- mysql - 当功能块在主体中时,Cftransaction 未提交
- sql-server - 根据环境创建存储过程
- c# - IShellDispatch.BrowseForFolder 的 iOptions 参数不起作用
- python - 使用 scipy.optimize.curve_fit 的逻辑曲线拟合问题
- python-3.x - 如何修复使用 Lambda 访问 dynamoDB 的错误:ClientError-ValidationException?
- php - 我在 livewire 辅助输入上不断收到 404 错误