在线时间0 小时
UID229017
ST金币0
蝴蝶豆0
注册时间2010-10-12
新手上路
- 最后登录
- 1970-1-1
|
a0a.1 0b0c
在做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
}
……
}
高手指点下 |
|