IAR RL78 V2.20 中达到程序退出
Program exit is reached in IAR RL78 V2.20
我正在使用 YRDKRL78 G13 开发板。我正在使用 IAR v.2.20 作为编译器,我已经在其上创建了一个 C++ 项目。我正在使用一个框架。无论如何,我已经实现了我所有的代码并且工作正常但是 2 分钟后 IAR 给出了 "The Application is aborted" 和 "Program exit is reached." 的信息我真的很困惑我使用了非常大的堆栈,如 512 和 near 是 1024 far是4096。
这是我的 main.cpp
#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 飞跃的特殊框架。这 3 个函数正在调用框架函数,SYS_vRUN 正在调用无限循环
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()函数的所有代码,没有。但是你提到了另一个关于断言的问题。在这里你可以看到断言宏和客户实现的断言函数。
#define Q_ASSERT_ID(id_, test_) ((test_) \
? (void)0 : Q_onAssert(&Q_this_module_[0], (int_t)(id_)))
函数;
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
}
编辑2:
大多数动态内存过程都在 LedFactory Class 中完成。
Header
/*
* 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_ */
源文件。
/*
* 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;
}
我是否应该删除 class 以增加动态分配内存问题?
或者我该如何解决这个 class ?
问题已解决。主要原因是工厂使用的动态内存分配过程class。
我正在使用 YRDKRL78 G13 开发板。我正在使用 IAR v.2.20 作为编译器,我已经在其上创建了一个 C++ 项目。我正在使用一个框架。无论如何,我已经实现了我所有的代码并且工作正常但是 2 分钟后 IAR 给出了 "The Application is aborted" 和 "Program exit is reached." 的信息我真的很困惑我使用了非常大的堆栈,如 512 和 near 是 1024 far是4096。
这是我的 main.cpp
#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 飞跃的特殊框架。这 3 个函数正在调用框架函数,SYS_vRUN 正在调用无限循环
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()函数的所有代码,没有。但是你提到了另一个关于断言的问题。在这里你可以看到断言宏和客户实现的断言函数。
#define Q_ASSERT_ID(id_, test_) ((test_) \
? (void)0 : Q_onAssert(&Q_this_module_[0], (int_t)(id_)))
函数;
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
}
编辑2: 大多数动态内存过程都在 LedFactory Class 中完成。 Header
/*
* 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_ */
源文件。
/*
* 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;
}
我是否应该删除 class 以增加动态分配内存问题? 或者我该如何解决这个 class ?
问题已解决。主要原因是工厂使用的动态内存分配过程class。