[LM3S8962+Keil+编译问题]IntMasterDisable()返回类型的问题 [已解决]

2019-03-24 15:34发布

今天编译一个工程出现一个奇怪的问题,发上来大家给点意见, QQ截图未命名12.jpg
[ 本帖最后由 Study_Stellaris 于 2011-10-11 20:55 编辑 ] 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
6条回答
David_Lee
2019-03-25 01:51
< :TI_MSP430_内容页_SA7 -->

原帖由 Study_Stellaris 于 2011-10-11 20:06 发表 今天编译一个工程出现一个奇怪的问题,发上来大家给点意见,74052

 

 

是不是跟使用的编译器有关咧?

IntMasterEnable()函数是在interrupt.c里定义的,如下:

tBoolean
IntMasterEnable(void)
{
    //
    // Enable processor interrupts.
    //
    return(CPUcpsie());

}

 

CPUcpsie()是在cpu.c里定义的,如下:

//*****************************************************************************
//
// Wrapper function for the CPSIE instruction.  Returns the state of PRIMASK
// on entry.
//
//*****************************************************************************
#if defined(codered) || defined(gcc) || defined(sourcerygxx)
unsigned long __attribute__((naked))
CPUcpsie(void)
{
    unsigned long ulRet;

    //
    // Read PRIMASK and enable interrupts.
    //
    __asm("    mrs     %0, PRIMASK "
          "    cpsie   i "
          "    bx      lr "
          : "=r" (ulRet));

    //
    // The return is handled in the inline assembly, but the compiler will
    // still complain if there is not an explicit return here (despite the fact
    // that this does not result in any code being produced because of the
    // naked attribute).
    //
    return(ulRet);
}
#endif
#if defined(ewarm)
unsigned long
CPUcpsie(void)
{
    //
    // Read PRIMASK and enable interrupts.
    //
    __asm("    mrs     r0, PRIMASK "
          "    cpsie   i ");

    //
    // "Warning[Pe940]: missing return statement at end of non-void function"
    // is suppressed here to avoid putting a "bx lr" in the inline assembly
    // above and a superfluous return statement here.
    //
#pragma diag_suppress=Pe940
}
#pragma diag_default=Pe940
#endif
#if defined(rvmdk) || defined(__ARMCC_VERSION)
__asm unsigned long
CPUcpsie(void)
{
    //
    // Read PRIMASK and enable interrupts.
    //
    mrs     r0, PRIMASK;
    cpsie   i;
    bx      lr
}
#endif

 

在使用EWARM或RVMDK时,CPUcpsie()是没有返回值的,换换开发环境测试下。

一周热门 更多>

相关问题

    相关文章