在 STM8L151G6U6中可支持字节擦写和块擦写,块擦写可一次擦写很所字节。字节擦写比较简单,需要注意的是块擦写,在块擦写中,需要配置一个地方。
对于IAR来说,
Uncomment the line “#define RAM_EXECUTION (1)” in the stm8l15x.h file to enable the FLASH functions execution from RAM through the specific __ramfunc keyword.
之后可在程序中调用Flash_BlockProgram();来进行块擦写。
在main函数前要做以下声明:
#ifdef _RAISONANCE_
/* needed by memcpy for raisonance */
#include <string.h>
extern int __address__FLASH_EraseBlock;
extern int __size__FLASH_EraseBlock;
extern int __address__FLASH_Prog

本文介绍了如何在STM8L151微控制器上使用IAR编译器进行Flash和EEPROM的擦写操作。关键步骤包括在stm8l15x.h文件中启用RAM执行功能,调用__ramfunc关键字的Flash_BlockProgram()函数进行块擦写,并在main函数前进行相应声明。成功案例中,工程设置了支持C标准库。
最低0.47元/天 解锁文章
560

被折叠的 条评论
为什么被折叠?



