关于STM8S中FLASH块擦除和块写怎么不行呀!【悬赏问答】
在做IAP升级中,用IAR编译环境,对FLASH只能是字节编程,对块擦和块写一操作就死循环了,我们的配置如下://Unlock PROG memory
FLASH->PUKR = 0x56;
FLASH->PUKR = 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));
#elif defined (STM8S103) || defined (STM8S903)
*((PointerAttr uint8_t*) (uint16_t)startaddress + Count) = ((uint8_t)(Buffer));
#endif
}
……
}
高手指点下
RE:关于STM8S中FLASH块擦除和块写怎么不行呀!
ST官方不是提供了例程和应用手册了吗,你可以好好的看一下官方的程序。。回复:关于STM8S中FLASH块擦除和块写怎么不行呀!【悬赏问答】
回复第 2 楼 于2012-07-19 11:25:37发表:ST官方不是提供了例程和应用手册了吗,你可以好好的看一下官方的程序。。
就是用官方的库来操作。
RE:关于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.
回复:关于STM8S中FLASH块擦除和块写怎么不行呀!【悬赏问答】
回复第 4 楼 于2012-09-08 14:51:33发表:要在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.
具体怎么操作?
页:
[1]