首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在IAR RL78 V2.20中达到了程序出口

在IAR RL78 V2.20中达到了程序出口
EN

Stack Overflow用户
提问于 2016-08-24 22:13:59
回答 1查看 632关注 0票数 0

我正在使用YRDKRL78 G13 board。我使用IAR v.2.20进行编译,ı已经在上面创建了一个C++项目。我使用的是一个框架。无论如何,我已经实现了我的所有代码,这些代码工作正常,但两分钟后,IAR给出了“应用程序已中止”和“程序退出已到达”的信息。我真的很困惑,我使用了非常大的堆栈,因为512和近是1024,远是4096。

这是我的main.cpp

代码语言:javascript
复制
#include "System.h"
extern "C"

{
#include "r_cg_macrodriver.h"
}

#pragma location = "OPTBYTE"
__root const uint8_t opbyte0 = 0x7EU;
#pragma location = "OPTBYTE"
__root const uint8_t opbyte1 = 0xFFU;
#pragma location = "OPTBYTE"
__root const uint8_t opbyte2 = 0xE8U;
#pragma location = "OPTBYTE"
__root const uint8_t opbyte3 = 0x85U;

/* Set security ID */
#pragma location = "SECUID"
__root const uint8_t secuid[10] =
{0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U};

void main(void)
{

System::SystemInstance().SYS_vInit();
System::SystemInstance().SYS_vStart();
System::SystemInstance().SYS_vRun();

while(1)
{
;
}


}

这是iar的输出。IAR Output Console

如果有人遇到这样的问题,或者如果有人有任何解决方案或想法,请在这里与我分享

感谢您的帮助:)

编辑:@rjp首先感谢您的回复。我在我的主板上使用了Quantum leaps的特殊框架。这3个函数正在调用框架函数,而SYS_vRUN正在调用无限循环

代码语言:javascript
复制
int_t QF::run(void) {
onStartup(); // startup callback

// the combined event-loop and background-loop of the QV kernel
for (;;) {
    R_WDT_Restart();
    RepaintLCD();
    delay_ms(50); /* Leave some room for the system to respond */
    QF_INT_DISABLE();
    if (QV_readySet_.notEmpty()) {
        uint_fast8_t p = QV_readySet_.findMax();
        QMActive *a = active_[p];
        QF_INT_ENABLE();

        // perform the run-to-completion (RTS) step...
        // 1. retrieve the event from the AO's event queue, which by this
        //    time must be non-empty and The "Vanialla" kernel asserts it.
        // 2. dispatch the event to the AO's state machine.
        // 3. determine if event is garbage and collect it if so
        //
        QEvt const *e = a->get_();
        a->dispatch(e);
        gc(e);
    }
    else {
        // QV::onIdle() must be called with interrupts DISABLED because
        // the determination of the idle condition (no events in the
        // queues) can change at any time by an interrupt posting events
        // to a queue. QV::onIdle() MUST enable interrupts internally,
        // perhaps at the same time as putting the CPU into a power-saving
        // mode.
        QP::QV::onIdle();
    }
}
}

最后,我搜索了所有的exit()函数的代码,没有任何一个。但是你提到了另一个关于断言的问题。在这里你可以看到断言宏和自定义实现的断言函数。

代码语言:javascript
复制
    #define Q_ASSERT_ID(id_, test_) ((test_) \
    ? (void)0 : Q_onAssert(&Q_this_module_[0], (int_t)(id_)))

函数;

代码语言:javascript
复制
    void Q_onAssert(char const Q_ROM * const file, int line) {
// implement the error-handling policy for your application!!!
QF_INT_DISABLE(); // disable all interrupts

// cause the reset of the CPU...
//WDTCTL = WDTPW | WDTHOLD;
//__asm("    push &0xFFFE");
// return from function does the reset
} 

EDIT2:大多数动态内存过程都是在LedFactory类中完成的。标题

代码语言:javascript
复制
/*
 * LedFactory.h
 *
 *  Created on: Aug 3, 2016
 *      Author: Dev
 */

 #ifndef APPLICATION_LED_LEDFACTORY_H_
 #define APPLICATION_LED_LEDFACTORY_H_

 #include "LedController.h"
 class LedFactory {
 public:
   typedef enum{
    LED1,
    LED2,
    LED3,
    LED4,
    LED5,
    LED6,
}LedTypes;
public:
LedFactory();
virtual ~LedFactory();
LedController * FirstLedFactory(LedTypes ledtype);
LedController * SecondLedFactory(LedTypes ledtype);
LedController * ThirdLedFactory(LedTypes ledtype);
LedController * FourthLedFactory(LedTypes ledtype);
LedController * FifthLedFactory(LedTypes ledtype);
LedController * SixthLedFactory(LedTypes ledtype);
public:
static LedFactory& instance();
};

#endif /* APPLICATION_LED_LEDFACTORY_H_ */

源文件。

代码语言:javascript
复制
/*
 * LedFactory.cpp
 *
 *  Created on: Aug 3, 2016
 *      Author: Dev
 */

 #include <LedFactory.h>
 #include "FirstLed.h"
 #include "SecondLed.h"
 #include "ThirdLed.h"
 #include "FourthLed.h"
 #include "FifthLed.h"
 #include "SixthLed.h"

 LedFactory::LedFactory() {
    // TODO Auto-generated constructor stub

 }

 LedFactory::~LedFactory() {
    // TODO Auto-generated destructor stub
 }

 LedFactory& LedFactory::instance()
 {
    static LedFactory instance;

    return instance;
 }
 LedController * LedFactory::FirstLedFactory(LedTypes ledtype)
 {
    if(ledtype == (LedTypes)LED1)
    {
       return new FirstLed;
    }
    return NULL;
 }
 LedController * LedFactory::SecondLedFactory(LedTypes ledtype)
 {
    if(ledtype == (LedTypes)LED2)
       return new SecondLed;
    return NULL;
 }

 LedController * LedFactory::ThirdLedFactory(LedTypes ledtype)
 {
    if(ledtype == (LedTypes)LED3)
    {
       return new ThirdLed;
    }
    return NULL;
 }

 LedController * LedFactory::FourthLedFactory(LedTypes ledtype)
 {
    if(ledtype == (LedTypes)LED4)
    {
       return new FourthLed;
    }
    return NULL;
 }


 LedController * LedFactory::FifthLedFactory(LedTypes ledtype)
 {
    if(ledtype == (LedTypes)LED5)
    {
       return new FifthLed;
    }
    return NULL;
 }

 LedController * LedFactory::SixthLedFactory(LedTypes ledtype)
 {
    if(ledtype ==(LedTypes)LED6)
    {
       return new SixthLed;
    }
    return NULL;
 }

我是否应该删除该类以增加动态分配内存问题?或者我如何修复这个类?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-07 22:24:10

问题已经解决了。主要原因是在工厂类中使用的动态内存分配进程。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39125787

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档