在做IAP升级中,用IAR编译环境,对FLASH只能是字节编程,对块擦和块写一操作就死循环了,我们的配置如下: //Unlock PROG memory FLASH->UKR = 0x56; FLASH->UKR = 0xAE; 然后用STM8S的库来块擦和块写就不行; IN_RAM(void FLASH_EraseBlock(uint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType)) { …… *pwFlash = (uint32_t)0;//调试跟踪就一直在那里循环 …… } IN_RAM(void FLASH_ProgramBlock(uint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType, FLASH_ProgramMode_TypeDef FLASH_ProgMode, uint8_t *Buffer)) { …… for (Count = 0; Count < FLASH_BLOCK_SIZE; Count++)//调试跟踪就一直在那里循环,而且Count的值不变 { #if defined (STM8S208) || defined(STM8S207) || defined(STM8S105) || defined (STM8AF62Ax) ||\ defined (STM8AF52Ax) || defined (STM8AF626x) *((PointerAttr uint8_t*) (uint16_t)startaddress + Count) = ((uint8_t)(Buffer[Count])); #elif defined (STM8S103) || defined (STM8S903) *((PointerAttr uint8_t*) (uint16_t)startaddress + Count) = ((uint8_t)(Buffer[Count])); #endif } …… } 高手指点下 |
从零开始操作STM8寄存器(风驰iCreate奉献)
【中文资料】初学STM8库函数的中文帮助软件
绝对经典的中文STM8学习手册,淘宝上学习板资料,友情大放送!
【原创教程】风驰iCreate独家开源STM8 27个例程和10多万字的pdf教程
STM8的LCD1602 4线驱动,为什么不工作
【精华资料】由零开始开发STM8
STM8S 的触摸库是如何在主程序中查询键的呢、
【精华资料】STM8的C语言编程1-14讲完整版
【精品教程】STM8系列单片机入门教程系列
STM8 第一次进中断不准【悬赏问答】
RE:关于STM8S中FLASH块擦除和块写怎么不行呀!
回复:关于STM8S中FLASH块擦除和块写怎么不行呀!【悬赏问答】
ST官方不是提供了例程和应用手册了吗,你可以好好的看一下官方的程序。。
就是用官方的库来操作。
RE:关于STM8S中FLASH块擦除和块写怎么不行呀!【悬赏问答】
- For IAR Compiler:
1- Use the __ramfunc keyword in the function declaration to specify that it
can be executed from RAM.
This is done within the stm8l15x_flash.c file, and it's conditioned by
RAM_EXECUTION definition.
2- Uncomment the "#define RAM_EXECUTION (1)" line in the stm8l15x.h file, or
define it in IAR compiler preprocessor to enable the access for the
__ramfunc functions.
回复:关于STM8S中FLASH块擦除和块写怎么不行呀!【悬赏问答】
要在stm8l15x.h中使能RAM_EXECUTION宏,见stm8l15x_flash.c中的文档:
- For IAR Compiler:
1- Use the __ramfunc keyword in the function declaration to specify that it
can be executed from RAM.
This is done within the stm8l15x_flash.c file, and it's conditioned by
RAM_EXECUTION definition.
2- Uncomment the "#define RAM_EXECUTION (1)" line in the stm8l15x.h file, or
define it in IAR compiler preprocessor to enable the access for the
__ramfunc functions.
具体怎么操作?