输出堆栈信息
This commit is contained in:
parent
88ef493e48
commit
d4da8d7859
|
@ -211,7 +211,7 @@ void FAULT_SubHandler()
|
||||||
int i;
|
int i;
|
||||||
if(exception==3)
|
if(exception==3)
|
||||||
{
|
{
|
||||||
uint n = *(uint*)(0xE000ED2C);
|
uint n = *(uint*)(SCB_BASE + 0x2C);
|
||||||
debug_printf("\r\n硬件错误 %d\r\n", n);
|
debug_printf("\r\n硬件错误 %d\r\n", n);
|
||||||
if(n & (1<<1))
|
if(n & (1<<1))
|
||||||
{
|
{
|
||||||
|
@ -228,7 +228,7 @@ void FAULT_SubHandler()
|
||||||
}
|
}
|
||||||
else if(exception==5)
|
else if(exception==5)
|
||||||
{
|
{
|
||||||
i = *(byte*)(0xE000ED29);
|
i = *(byte*)(SCB_BASE + 0x29);
|
||||||
#ifdef STM32F10X
|
#ifdef STM32F10X
|
||||||
debug_printf("\r\nBus Fault %d 0x%08x: \r\n", i, SCB->BFAR);
|
debug_printf("\r\nBus Fault %d 0x%08x: \r\n", i, SCB->BFAR);
|
||||||
#endif
|
#endif
|
||||||
|
@ -260,7 +260,7 @@ void FAULT_SubHandler()
|
||||||
}
|
}
|
||||||
else if(exception==4)
|
else if(exception==4)
|
||||||
{
|
{
|
||||||
i = *(byte*)(0xE000ED28);
|
i = *(byte*)(SCB_BASE + 0x28);
|
||||||
#ifdef STM32F10X
|
#ifdef STM32F10X
|
||||||
debug_printf("\r\nMemManage Fault %d 0x%08x: \r\n", i, SCB->MMFAR);
|
debug_printf("\r\nMemManage Fault %d 0x%08x: \r\n", i, SCB->MMFAR);
|
||||||
#endif
|
#endif
|
||||||
|
@ -288,7 +288,7 @@ void FAULT_SubHandler()
|
||||||
}
|
}
|
||||||
else if(exception==6)
|
else if(exception==6)
|
||||||
{
|
{
|
||||||
i = *(byte*)(0xE000ED2A);
|
i = *(byte*)(SCB_BASE + 0x2A);
|
||||||
debug_printf("\r\nUsage Fault %d: \r\n", i);
|
debug_printf("\r\nUsage Fault %d: \r\n", i);
|
||||||
if(i & (1<<0))
|
if(i & (1<<0))
|
||||||
{
|
{
|
||||||
|
|
16
Sys.cpp
16
Sys.cpp
|
@ -6,6 +6,9 @@
|
||||||
TSys Sys;
|
TSys Sys;
|
||||||
TTime Time;
|
TTime Time;
|
||||||
|
|
||||||
|
extern uint __heap_base;
|
||||||
|
extern uint __heap_limit;
|
||||||
|
|
||||||
#ifndef BIT
|
#ifndef BIT
|
||||||
#define BIT(x) (1 << (x))
|
#define BIT(x) (1 << (x))
|
||||||
#endif
|
#endif
|
||||||
|
@ -258,7 +261,10 @@ TSys::TSys()
|
||||||
_Index = 0;
|
_Index = 0;
|
||||||
FlashSize = *(__IO ushort *)(0x1FFFF7E0); // 容量
|
FlashSize = *(__IO ushort *)(0x1FFFF7E0); // 容量
|
||||||
if(FlashSize == 0xFFFF)
|
if(FlashSize == 0xFFFF)
|
||||||
FlashSize = RAMSize = 0;
|
{
|
||||||
|
FlashSize = MemSizes[0];
|
||||||
|
RAMSize = RamSizes[0];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RAMSize = FlashSize >> 3; // 通过Flash大小和MCUID识别型号后得知内存大小
|
RAMSize = FlashSize >> 3; // 通过Flash大小和MCUID识别型号后得知内存大小
|
||||||
|
@ -397,6 +403,14 @@ void TSys::ShowInfo()
|
||||||
for(int i=1; i<ArrayLength(ID); i++) debug_printf("%c", ID[i]);
|
for(int i=1; i<ArrayLength(ID); i++) debug_printf("%c", ID[i]);
|
||||||
#endif
|
#endif
|
||||||
debug_printf("\r\n");
|
debug_printf("\r\n");
|
||||||
|
|
||||||
|
// 输出堆信息
|
||||||
|
uint start = (uint)&__heap_base;
|
||||||
|
uint end = (uint)&__heap_limit;
|
||||||
|
debug_printf("Heap :(0x%08x, 0x%08x) = 0x%x\r\n", start, end, end - start);
|
||||||
|
start = end;
|
||||||
|
end = 0x20000000 + (RAMSize << 10);
|
||||||
|
debug_printf("Stack:(0x%08x, 0x%08x) = 0x%x\r\n", start, end, end - start);
|
||||||
|
|
||||||
debug_printf("\r\n");
|
debug_printf("\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue