diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 14c1ae6a..973e4771 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -463,7 +463,7 @@ void Thread::Switch() // 检查新栈的xPSR //uint* psr = newStack + (STACK_Size >> 2) - 1; - //if(*psr != 0x01000000L) debug_printf("可能出错 xPSR=0x%08x\r\n", *psr); + //if(*psr != 0x01000000L) debug_printf("可能出错 xPSR=%p\r\n", *psr); // 触发PendSV异常,引发上下文切换 OnSwitch(); diff --git a/Net/Dhcp.cpp b/Net/Dhcp.cpp index f6f588da..a6a6ec1b 100644 --- a/Net/Dhcp.cpp +++ b/Net/Dhcp.cpp @@ -128,7 +128,7 @@ void Dhcp::Start() uint randnum = (ran.Next() << 16) & 0xffff0000; dhcpid = (uint)now + randnum; - net_printf("Dhcp::Start ExpiredTime=%dms DhcpID=0x%08x\r\n", ExpiredTime, dhcpid); + net_printf("Dhcp::Start ExpiredTime=%dms DhcpID=%p\r\n", ExpiredTime, dhcpid); // 使用DHCP之前最好清空本地IP地址,KWF等软路由要求非常严格 // 严格路由要求默认请求的IP必须在本网段,否则不予处理 @@ -167,7 +167,7 @@ void Dhcp::Stop() Running = false; Sys.SetTask(taskID, false); - net_printf("Dhcp::Stop Result=%d DhcpID=0x%08x Times=%d MaxTimes=%d\r\n", Result, dhcpid, Times, MaxTimes); + net_printf("Dhcp::Stop Result=%d DhcpID=%p Times=%d MaxTimes=%d\r\n", Result, dhcpid, Times, MaxTimes); auto& host = Host; if (Result) diff --git a/Platform/CortexM/Sys.cpp b/Platform/CortexM/Sys.cpp index 26ca68d1..4ebccae1 100644 --- a/Platform/CortexM/Sys.cpp +++ b/Platform/CortexM/Sys.cpp @@ -288,13 +288,13 @@ void TSys::OnShowInfo() const #endif uint end = SRAM_BASE + (RAMSize << 10); uint size = end - start; - debug_printf("Heap :(0x%08x, 0x%08x) = 0x%x (%dk)\r\n", start, end, size, size >> 10); + debug_printf("Heap :(%p, %p) = 0x%x (%dk)\r\n", start, end, size, size >> 10); #if defined(STM32F4) if(start < 0x20000000) start = 0x20000000; #endif //end = 0x20000000 + (RAMSize << 10); size = end - start; - debug_printf("Stack:(0x%08x, 0x%08x) = 0x%x (%dk)\r\n", start, end, size, size >> 10); + debug_printf("Stack:(%p, %p) = 0x%x (%dk)\r\n", start, end, size, size >> 10); if(IsGD) debug_printf("ChipType:%p %s\r\n", *(uint*)0x40022100, (cstring)0x40022100); #endif diff --git a/Platform/CortexM/Thread.cpp b/Platform/CortexM/Thread.cpp index d51ccad2..7b40956f 100644 --- a/Platform/CortexM/Thread.cpp +++ b/Platform/CortexM/Thread.cpp @@ -37,7 +37,7 @@ INROOT void Thread::CheckStack() uint stackBottom = (uint)StackTop - StackSize; if(p < stackBottom) - debug_printf("Thread::CheckStack %d %s Overflow, Stack 0x%08x < 0x%08x\r\n", ID, Name, p, stackBottom); + debug_printf("Thread::CheckStack %d %s Overflow, Stack %p < %p\r\n", ID, Name, p, stackBottom); assert(stackBottom <= p, "StackSize"); #endif } diff --git a/Platform/GD32F1x0/Flash.cpp b/Platform/GD32F1x0/Flash.cpp index 0676c297..b6a9cc08 100644 --- a/Platform/GD32F1x0/Flash.cpp +++ b/Platform/GD32F1x0/Flash.cpp @@ -47,7 +47,7 @@ bool Flash::WriteBlock(uint address, const byte* buf, uint len, bool inc) const *s = *p; while (FLASH->SR & FLASH_SR_BSY); if (*s != *p) { - debug_printf("Flash::WriteBlock 失败 0x%08x, 写 0x%04x, 读 0x%04x\r\n", s, *p, *s); + debug_printf("Flash::WriteBlock 失败 %p, 写 0x%04x, 读 0x%04x\r\n", s, *p, *s); return false; } } @@ -72,7 +72,7 @@ bool Flash::EraseBlock(uint address) const if(address < Start || address + Block > Start + Size) return false; #if FLASH_DEBUG - debug_printf("\tFlash::EraseBlock(0x%08x)\r\n", address); + debug_printf("\tFlash::EraseBlock(%p)\r\n", address); #endif // 进行闪存编程操作时(写或擦除),必须打开内部的RC振荡器(HSI) diff --git a/Platform/GD32F1x0/Interrupt.cpp b/Platform/GD32F1x0/Interrupt.cpp index b19e89c8..337423c6 100644 --- a/Platform/GD32F1x0/Interrupt.cpp +++ b/Platform/GD32F1x0/Interrupt.cpp @@ -40,10 +40,10 @@ extern "C" */ void FAULT_SubHandler(uint* registers, uint exception) { - debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x SP=0x%08x\r\n", registers[13], registers[14], registers[15], registers[16]); + debug_printf("LR=%p PC=%p PSR=%p SP=%p\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]); + debug_printf("R%d=%p\r\n", i, registers[i]); } TInterrupt::Halt(); diff --git a/Platform/STM32F0/Interrupt.cpp b/Platform/STM32F0/Interrupt.cpp index 1eca17e9..d938d91f 100644 --- a/Platform/STM32F0/Interrupt.cpp +++ b/Platform/STM32F0/Interrupt.cpp @@ -76,12 +76,12 @@ extern "C" { void FAULT_SubHandler(uint* registers, uint exception) { - debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x\r\n", registers[5], registers[6], registers[7]); + debug_printf("LR=%p PC=%p PSR=%p\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("R%d=%p\r\n", i, registers[i]); } - debug_printf("R12=0x%08x\r\n", registers[4]); + debug_printf("R12=%p\r\n", registers[4]); TInterrupt::Halt(); } diff --git a/Platform/STM32F1/Flash.cpp b/Platform/STM32F1/Flash.cpp index afed808d..a362d334 100644 --- a/Platform/STM32F1/Flash.cpp +++ b/Platform/STM32F1/Flash.cpp @@ -47,7 +47,7 @@ bool Flash::WriteBlock(uint address, const byte* buf, int len, bool inc) const *s = *p; while (FLASH->SR & FLASH_SR_BSY); if (*s != *p) { - debug_printf("Flash::WriteBlock 失败 0x%08x, 写 0x%04x, 读 0x%04x\r\n", s, *p, *s); + debug_printf("Flash::WriteBlock 失败 %p, 写 0x%04x, 读 0x%04x\r\n", s, *p, *s); return false; } } @@ -72,7 +72,7 @@ bool Flash::EraseBlock(uint address) const if (address < Start || address + Block > Start + Size) return false; #if FLASH_DEBUG - debug_printf("\tFlash::EraseBlock(0x%08x)\r\n", address); + debug_printf("\tFlash::EraseBlock(%p)\r\n", address); #endif // 进行闪存编程操作时(写或擦除),必须打开内部的RC振荡器(HSI) diff --git a/Platform/STM32F1/Interrupt.cpp b/Platform/STM32F1/Interrupt.cpp index 7c4572fe..df60feb1 100644 --- a/Platform/STM32F1/Interrupt.cpp +++ b/Platform/STM32F1/Interrupt.cpp @@ -76,10 +76,10 @@ extern "C" { void FAULT_SubHandler(uint* registers, uint exception) { - debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x SP=0x%08x\r\n", registers[13], registers[14], registers[15], registers[16]); + debug_printf("LR=%p PC=%p PSR=%p SP=%p\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]); + debug_printf("R%d=%p\r\n", i, registers[i]); } TInterrupt::Halt(); diff --git a/Platform/STM32F4/Interrupt.cpp b/Platform/STM32F4/Interrupt.cpp index 7c4572fe..df60feb1 100644 --- a/Platform/STM32F4/Interrupt.cpp +++ b/Platform/STM32F4/Interrupt.cpp @@ -76,10 +76,10 @@ extern "C" { void FAULT_SubHandler(uint* registers, uint exception) { - debug_printf("LR=0x%08x PC=0x%08x PSR=0x%08x SP=0x%08x\r\n", registers[13], registers[14], registers[15], registers[16]); + debug_printf("LR=%p PC=%p PSR=%p SP=%p\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]); + debug_printf("R%d=%p\r\n", i, registers[i]); } TInterrupt::Halt(); diff --git a/Storage/Storage.cpp b/Storage/Storage.cpp index 752ae3cf..15c249fa 100644 --- a/Storage/Storage.cpp +++ b/Storage/Storage.cpp @@ -1,7 +1,7 @@ #include "Storage.h" -//#define STORAGE_DEBUG DEBUG -#define STORAGE_DEBUG 0 +#define STORAGE_DEBUG DEBUG +//#define STORAGE_DEBUG 0 #if STORAGE_DEBUG #define st_printf debug_printf #else @@ -16,7 +16,7 @@ bool BlockStorage::Read(uint address, Buffer& bs) const if(address < Start || address + len > Start + Size) return false; #if STORAGE_DEBUG - st_printf("BlockStorage::Read(0x%08x, %d, 0x%08x)\r\n", address, len, bs.GetBuffer()); + st_printf("BlockStorage::Read(%p, %d, %p)\r\n", address, len, bs.GetBuffer()); #endif bs.Copy(0, (byte*)address, -1); @@ -35,7 +35,7 @@ bool BlockStorage::Write(uint address, const Buffer& bs) const if(address < Start || address + len > Start + Size) return false; #if STORAGE_DEBUG - st_printf("BlockStorage::Write(0x%08x, %d, 0x%08x)", address, len, buf); + st_printf("BlockStorage::Write(%p, %d, %p)", address, len, buf); int len2 = 0x10; if(len < len2) len2 = len; //st_printf(" Data: "); @@ -148,7 +148,7 @@ bool BlockStorage::Memset(uint address, byte data, int len) const if(address < Start || address + len > Start + Size) return false; #if STORAGE_DEBUG - st_printf("BlockStorage::Memset(0x%08x, %d, 0x%02x)\r\n", address, len, data); + st_printf("BlockStorage::Memset(%p, %d, 0x%02x)\r\n", address, len, data); #endif // 这里还没有考虑超过一块的情况,将来补上 @@ -163,7 +163,7 @@ bool BlockStorage::Erase(uint address, int len) const if(address < Start || address + len > Start + Size) return false; #if STORAGE_DEBUG - st_printf("BlockStorage::Erase(0x%08x, %d)\r\n", address, len); + st_printf("BlockStorage::Erase(%p, %d)\r\n", address, len); #endif if(len == 0) len = Start + Size - address; @@ -198,7 +198,7 @@ bool BlockStorage::IsErased(uint address, int len) const if(address < Start || address + len > Start + Size) return false; #if STORAGE_DEBUG - //st_printf("BlockStorage::IsErased(0x%08x, %d)\r\n", address, len); + //st_printf("BlockStorage::IsErased(%p, %d)\r\n", address, len); #endif ushort* p = (ushort*)address; diff --git a/Test/CrcTest.cpp b/Test/CrcTest.cpp index e47dacf3..cb98842b 100644 --- a/Test/CrcTest.cpp +++ b/Test/CrcTest.cpp @@ -71,7 +71,7 @@ void TestCrc() uint crc = Crc::Hash(bs, 0); uint crc2 = Crc::Hash(bs, 4); bs.Show(); - debug_printf("\r\n\tSoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); + debug_printf("\r\n\tSoftCrc:%p HardCrc:%p \r\n", crc, crc2); // 无初值时,两者一样 uint temp = crc; @@ -80,7 +80,7 @@ void TestCrc() crc2 = Crc::Hash(Buffer(&crc2, 4)); ByteArray(&temp, 4).Show(); debug_printf("\r\n\t"); - debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); + debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2); // 结果相同,但都不是0 // 连续测试。构建8字节,前面是data,后面是前面的crc @@ -92,7 +92,7 @@ void TestCrc() crc2 = Crc::Hash(bs2); bs2.Show(); debug_printf("\r\n\t"); - debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); + debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2); // 结果相同,但都不是0 // 实际应用中,先计算数据的校验,然后接着附加校验码部分,跟直接连续计算效果应该一致 @@ -101,16 +101,16 @@ void TestCrc() crc = Crc::Hash(bs3, data); //crc2 = HardCrc(bs3, data); bs3.Show(); - debug_printf(" <= 0x%08x\r\n\t", data); - debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); + debug_printf(" <= %p\r\n\t", data); + debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2); // 结果不同,HardCrc结果跟8字节测试相同 ByteArray bs4(&temp, 4); crc = Crc::Hash(bs4, temp); //crc2 = HardCrc(bs4, temp); bs4.Show(); - debug_printf(" <= 0x%08x\r\n\t", temp); - debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); + debug_printf(" <= %p\r\n\t", temp); + debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2); // 结果不同,SoftCrc结果跟8字节测试相同 // 对大数据块进行校验 @@ -121,7 +121,7 @@ void TestCrc() crc2 = Crc::Hash(bs5); bs5.Show(); debug_printf("\r\n\t"); - debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); + debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2); // 无初值时,两者一样 temp = crc; @@ -131,8 +131,8 @@ void TestCrc() crc = Crc::Hash(bs6, temp); //crc2 = HardCrc(bs6, temp); bs6.Show(); - debug_printf(" <= 0x%08x\r\n\t", temp); - debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); + debug_printf(" <= %p\r\n\t", temp); + debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2); // 有初值时,两者不一样 // 增量计算CRC @@ -143,8 +143,8 @@ void TestCrc() //crc2 = HardCrc(bs7, 0); //crc2 = HardCrc(Buffer(&crc2, 4), crc2); bs7.Show(); - debug_printf(" <= 0x%08x\r\n\t", temp); - debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); + debug_printf(" <= %p\r\n\t", temp); + debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2); // 测试Crc16,数据和crc部分一起计算crc16,结果为0 debug_printf("\r\n"); diff --git a/Test/FlashTest.cpp b/Test/FlashTest.cpp index 9bc121d7..174ce4e3 100644 --- a/Test/FlashTest.cpp +++ b/Test/FlashTest.cpp @@ -12,9 +12,9 @@ void TestFlash() Flash flash; // 凑一个横跨两页的地址 uint addr = 0x0800C000 + flash.Block - size + 7; - debug_printf("Address: 0x%08x 凑一个横跨两页的地址\r\n", addr); + debug_printf("Address: %p 凑一个横跨两页的地址\r\n", addr); - debug_printf("FlashSize: %d(0x%08x) Bytes Block: %d Bytes\r\n", flash.Size, flash.Size, flash.Block); + debug_printf("FlashSize: %d(%p) Bytes Block: %d Bytes\r\n", flash.Size, flash.Size, flash.Block); flash.Erase(addr, 0x100); byte bb[0x100]; diff --git a/TinyIP/Tcp.cpp b/TinyIP/Tcp.cpp index f36bd0de..5006d445 100644 --- a/TinyIP/Tcp.cpp +++ b/TinyIP/Tcp.cpp @@ -386,7 +386,7 @@ bool TcpSocket::Send(const Buffer& bs) #if NET_DEBUG debug_printf("Tcp::Send "); Remote.Show(); - debug_printf(" buf=0x%08x len=%d ...... \r\n", bs.GetBuffer(), bs.Length()); + debug_printf(" buf=%p len=%d ...... \r\n", bs.GetBuffer(), bs.Length()); #endif //Stream ms(sizeof(ETH_HEADER) + sizeof(IP_HEADER) + sizeof(TCP_HEADER) + bs.Length()); diff --git a/TinyNet/TinyController.cpp b/TinyNet/TinyController.cpp index dadf6328..b8f0e00c 100644 --- a/TinyNet/TinyController.cpp +++ b/TinyNet/TinyController.cpp @@ -588,7 +588,7 @@ void TinyController::Loop() Buffer bs(node.Data, node.Length); if(node.Length <= 0 || node.Length > 32) { - debug_printf("node=0x%08x Length=%d Seq=0x%02X Times=%d Next=%d EndTime=%d\r\n", (uint)&node, node.Length, node.Seq, node.Times, (uint)node.Next, (uint)node.EndTime); + debug_printf("node=%p Length=%d Seq=0x%02X Times=%d Next=%d EndTime=%d\r\n", (uint)&node, node.Length, node.Seq, node.Times, (uint)node.Next, (uint)node.EndTime); } if(node.Mac[0]) Port->Write(bs, &node.Mac[1]);