打印
[STM8]

IAR IN_RAM 的函数都报Warning

[复制链接]
3618|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
cosxpeach|  楼主 | 2014-6-2 00:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
IN_RAM(FLASH_Status_TypeDef FLASH_WaitForLastOperation(FLASH_MemType_TypeDef FLASH_MemType))
IN_RAM(void FLASH_EraseBlock(uint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType))
IN_RAM(void FLASH_ProgramBlock(uint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType,
                        FLASH_ProgramMode_TypeDef FLASH_ProgMode, uint8_t *Buffer))
stm8s_flash.c这三个函数下的assert_param都报警告。有遇到同样情况的吗?
我看过帖子说是吧assert_param也加上IN_RAM,但警告依旧。
IN_RAM(void FLASH_ProgramBlock(uint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType, 
                        FLASH_ProgramMode_TypeDef FLASH_ProgMode, uint8_t *Buffer))
{
    uint16_t Count = 0;
    uint32_t startaddress = 0;

    /* Check parameters */
    assert_param(IS_MEMORY_TYPE_OK(FLASH_MemType));
    assert_param(IS_FLASH_PROGRAM_MODE_OK(FLASH_ProgMode));
    if (FLASH_MemType == FLASH_MEMTYPE_PROG)
    {
        assert_param(IS_FLASH_PROG_BLOCK_NUMBER_OK(BlockNum));
        startaddress = FLASH_PROG_START_PHYSICAL_ADDRESS;
    }
    else
    {
        assert_param(IS_FLASH_DATA_BLOCK_NUMBER_OK(BlockNum));
        startaddress = FLASH_DATA_START_PHYSICAL_ADDRESS;
    }

    /* Point to the first block address */
    startaddress = startaddress + ((uint32_t)BlockNum * FLASH_BLOCK_SIZE);

    /* Selection of Standard or Fast programming mode */
    if (FLASH_ProgMode == FLASH_PROGRAMMODE_STANDARD)
    {
        /* Standard programming mode */ /*No need in standard mode */
        FLASH->CR2 |= FLASH_CR2_PRG;
        FLASH->NCR2 &= (uint8_t)(~FLASH_NCR2_NPRG);
    }
    else
    {
        /* Fast programming mode */
        FLASH->CR2 |= FLASH_CR2_FPRG;
        FLASH->NCR2 &= (uint8_t)(~FLASH_NCR2_NFPRG);
    }

    /* Copy data bytes from RAM to FLASH memory */
    for (Count = 0; Count < FLASH_BLOCK_SIZE; Count++)
    {
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
    defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
  *((PointerAttr uint8_t*) (uint16_t)startaddress + Count) = ((uint8_t)(Buffer[Count]));
#elif defined(STM8S103) || defined(STM8S003) ||  defined (STM8S903)
  *((PointerAttr uint8_t*) (uint16_t)startaddress + Count) = ((uint8_t)(Buffer[Count]));
#endif      
    }
}
Warning[Ta007]: Call to a non __ramfunc function (assert_failed) from within a __ramfunc function

沙发
pofu007| | 2014-6-11 10:29 | 只看该作者
stm8s.h里面有这么一段话

/* Uncomment the line below to enable the FLASH functions execution from RAM */
#if !defined (RAM_EXECUTION)
/*#define RAM_EXECUTION  (1)*/
#endif /* RAM_EXECUTION */

是不是取消注释#define RAM_EXECUTION  (1)了呢?

使用特权

评论回复
板凳
zhongquan| | 2014-9-30 16:15 | 只看该作者
不是#define RAM_EXECUTION这个问题,问题在于你在RAM中的函数去调用了一个在CODE中的函数,虽然这个CODE中的函数是由编译器生成的,你可以查看一下你的汇编代码,看看里面是不是有一条CALL的指令,此CALL指令是否跳到CODE区里了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

18

主题

54

帖子

1

粉丝