你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

查看: 10922|回复: 4

关于STM8S中FLASH块擦除和块写怎么不行呀!【悬赏问答】

[复制链接]

3

主题

16

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
发表于 2012-7-19 10:55:04 | 显示全部楼层 |阅读模式
在做IAP升级中,用IAR编译环境,对FLASH只能是字节编程,对块擦和块写一操作就死循环了,我们的配置如下:
  //Unlock PROG memory
  FLASH-&gtUKR = 0x56;
  FLASH-&gtUKR = 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
    }
……
}
高手指点下
回复

使用道具 举报

2

主题

240

回帖

0

蝴蝶豆

中级会员

最后登录
2020-8-11
发表于 2012-7-19 11:25:37 | 显示全部楼层

RE:关于STM8S中FLASH块擦除和块写怎么不行呀!

ST官方不是提供了例程和应用手册了吗,你可以好好的看一下官方的程序。。
回复 支持 反对

使用道具 举报

3

主题

16

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
 楼主| 发表于 2012-9-6 11:50:36 | 显示全部楼层

回复:关于STM8S中FLASH块擦除和块写怎么不行呀!【悬赏问答】

回复第 2 楼 于2012-07-19 11:25:37发表:
ST官方不是提供了例程和应用手册了吗,你可以好好的看一下官方的程序。。 

就是用官方的库来操作。
回复 支持 反对

使用道具 举报

0

主题

3

回帖

0

蝴蝶豆

新手上路

最后登录
2019-4-9
发表于 2012-9-8 14:51:33 | 显示全部楼层

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.
回复 支持 反对

使用道具 举报

3

主题

16

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
 楼主| 发表于 2012-9-14 13:43:58 | 显示全部楼层

回复:关于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. 

具体怎么操作?
 
回复 支持 反对

使用道具 举报

关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版