static void Halt(); // 系统挂起
This commit is contained in:
parent
5c17fb3716
commit
dee50c83de
|
@ -65,6 +65,20 @@ void TInterrupt::Process(uint num) const
|
|||
isr(num - 16, param);
|
||||
}
|
||||
|
||||
// 系统挂起
|
||||
void TInterrupt::Halt()
|
||||
{
|
||||
#if DEBUG
|
||||
TraceStack::Show();
|
||||
|
||||
//auto sp = SerialPort::GetMessagePort();
|
||||
//if(sp) sp->Flush();
|
||||
#endif
|
||||
while(true);
|
||||
}
|
||||
|
||||
/******************************** SmartIRQ ********************************/
|
||||
|
||||
// 智能IRQ,初始化时备份,销毁时还原
|
||||
SmartIRQ::SmartIRQ(bool enable)
|
||||
{
|
||||
|
@ -92,7 +106,7 @@ SmartIRQ::~SmartIRQ()
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/*================================ 锁 ================================*/
|
||||
/******************************** Lock ********************************/
|
||||
|
||||
#include "TTime.h"
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ public:
|
|||
|
||||
static bool IsHandler(); // 是否在中断里面
|
||||
|
||||
static void Halt(); // 系统挂起
|
||||
|
||||
private:
|
||||
void OnInit() const;
|
||||
bool OnActivate(short irq);
|
||||
|
|
|
@ -150,9 +150,7 @@ void assert_failed2(cstring msg, cstring file, unsigned int line)
|
|||
{
|
||||
debug_printf("%s Line %d, %s\r\n", msg, line, file);
|
||||
|
||||
TraceStack::Show();
|
||||
|
||||
while (1) { }
|
||||
TInterrupt::Halt();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,9 +20,7 @@ void assert_failed(uint8_t* file, unsigned int line)
|
|||
{
|
||||
debug_printf("Assert Failed! Line %d, %s\r\n", line, file);
|
||||
|
||||
TraceStack::Show();
|
||||
|
||||
while (1) { }
|
||||
TInterrupt::Halt();
|
||||
}
|
||||
|
||||
bool assert_ptr_(const void* p)
|
||||
|
|
|
@ -98,13 +98,7 @@ extern "C"
|
|||
}
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
TraceStack::Show();
|
||||
|
||||
//auto sp = SerialPort::GetMessagePort();
|
||||
//if(sp) sp->Flush();
|
||||
#endif
|
||||
while(true);
|
||||
TInterrupt::Halt();
|
||||
}
|
||||
|
||||
#if defined ( __CC_ARM )
|
||||
|
|
|
@ -77,34 +77,16 @@ void TInterrupt::DecodePriority (uint priority, uint priorityGroup, uint* pPreem
|
|||
|
||||
extern "C"
|
||||
{
|
||||
/* 在GD32F130C8中时常有一个FAULT_SubHandler跳转的错误,
|
||||
经查是因为FAULT_SubHandler和FaultHandler离得太远,导致b跳转无法到达,
|
||||
因此把这两个函数指定到同一个段中,使得它们地址分布上紧挨着
|
||||
*/
|
||||
void FAULT_SubHandler(uint* registers, uint exception)
|
||||
{
|
||||
#ifdef STM32F0
|
||||
debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x\r\n", registers[5], registers[6], registers[7]);
|
||||
for(int i=0; i<=7; i++)
|
||||
{
|
||||
debug_printf("R%d=0x%08x\r\n", i, registers[i]);
|
||||
}
|
||||
debug_printf("R12=0x%08x\r\n", registers[4]);
|
||||
#else
|
||||
debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x SP=0x%08x\r\n", registers[13], registers[14], registers[15], registers[16]);
|
||||
for(int i=0; i<=12; i++)
|
||||
{
|
||||
debug_printf("R%d=0x%08x\r\n", i, registers[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
TraceStack::Show();
|
||||
|
||||
//auto sp = SerialPort::GetMessagePort();
|
||||
//if(sp) sp->Flush();
|
||||
#endif
|
||||
while(true);
|
||||
TInterrupt::Halt();
|
||||
}
|
||||
|
||||
#if defined ( __CC_ARM )
|
||||
|
|
|
@ -77,34 +77,15 @@ void TInterrupt::DecodePriority (uint priority, uint priorityGroup, uint* pPreem
|
|||
|
||||
extern "C"
|
||||
{
|
||||
/* 在GD32F130C8中时常有一个FAULT_SubHandler跳转的错误,
|
||||
经查是因为FAULT_SubHandler和FaultHandler离得太远,导致b跳转无法到达,
|
||||
因此把这两个函数指定到同一个段中,使得它们地址分布上紧挨着
|
||||
*/
|
||||
void FAULT_SubHandler(uint* registers, uint exception)
|
||||
{
|
||||
#ifdef STM32F0
|
||||
debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x\r\n", registers[5], registers[6], registers[7]);
|
||||
for(int i=0; i<=7; i++)
|
||||
{
|
||||
debug_printf("R%d=0x%08x\r\n", i, registers[i]);
|
||||
}
|
||||
debug_printf("R12=0x%08x\r\n", registers[4]);
|
||||
#else
|
||||
debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x SP=0x%08x\r\n", registers[13], registers[14], registers[15], registers[16]);
|
||||
for(int i=0; i<=12; i++)
|
||||
{
|
||||
debug_printf("R%d=0x%08x\r\n", i, registers[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
TraceStack::Show();
|
||||
|
||||
//auto sp = SerialPort::GetMessagePort();
|
||||
//if(sp) sp->Flush();
|
||||
#endif
|
||||
while(true);
|
||||
TInterrupt::Halt();
|
||||
}
|
||||
|
||||
#if defined ( __CC_ARM )
|
||||
|
|
|
@ -77,34 +77,15 @@ void TInterrupt::DecodePriority (uint priority, uint priorityGroup, uint* pPreem
|
|||
|
||||
extern "C"
|
||||
{
|
||||
/* 在GD32F130C8中时常有一个FAULT_SubHandler跳转的错误,
|
||||
经查是因为FAULT_SubHandler和FaultHandler离得太远,导致b跳转无法到达,
|
||||
因此把这两个函数指定到同一个段中,使得它们地址分布上紧挨着
|
||||
*/
|
||||
void FAULT_SubHandler(uint* registers, uint exception)
|
||||
{
|
||||
#ifdef STM32F0
|
||||
debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x\r\n", registers[5], registers[6], registers[7]);
|
||||
for(int i=0; i<=7; i++)
|
||||
{
|
||||
debug_printf("R%d=0x%08x\r\n", i, registers[i]);
|
||||
}
|
||||
debug_printf("R12=0x%08x\r\n", registers[4]);
|
||||
#else
|
||||
debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x SP=0x%08x\r\n", registers[13], registers[14], registers[15], registers[16]);
|
||||
for(int i=0; i<=12; i++)
|
||||
{
|
||||
debug_printf("R%d=0x%08x\r\n", i, registers[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
TraceStack::Show();
|
||||
|
||||
//auto sp = SerialPort::GetMessagePort();
|
||||
//if(sp) sp->Flush();
|
||||
#endif
|
||||
while(true);
|
||||
TInterrupt::Halt();
|
||||
}
|
||||
|
||||
#if defined ( __CC_ARM )
|
||||
|
|
|
@ -614,6 +614,7 @@ bool TokenClient::OnPing(TokenMessage& msg, TokenController* ctrl)
|
|||
|
||||
if (!msg.Reply) return false;
|
||||
|
||||
#if DEBUG
|
||||
TokenPingMessage pinMsg;
|
||||
pinMsg.ReadMessage(msg);
|
||||
UInt64 start = pinMsg.LocalTime;
|
||||
|
@ -628,6 +629,8 @@ bool TokenClient::OnPing(TokenMessage& msg, TokenController* ctrl)
|
|||
Delay = cost;
|
||||
|
||||
debug_printf("心跳延迟 %dms / %dms \r\n", cost, Delay);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue