STM32中将常量存储在FLASH中(CONST关键字)
前提:我用的是STM32F103ZE单片机,
本文引用地址:https://www.eepw.com.cn/article/201611/316820.htm- FLASH的存储范围为:0x08000000~0x0807ffff,
- RAM的存储范围:0x20000000~0x200007ff
失败例子:
#include.....
。。。。
int main(void)
{
u8 constc[]="somen";
while(1);
}
通过调试,查看c[]数组的存储位置为0x200*****的位置,常量仍旧处在RAM中。
成功的例子:
#include.....
u8 constc[]="somen";
int main(void)
{
while(1);
}
通过调试,可以发现c[]数组的存储位置为0x08******的位置,常量在FLASH中。
评论