标准化指针符号

This commit is contained in:
大石头X2 2017-03-01 02:57:55 +08:00
parent c156bc9d34
commit 1eff827d45
15 changed files with 42 additions and 42 deletions

View File

@ -463,7 +463,7 @@ void Thread::Switch()
// 检查新栈的xPSR // 检查新栈的xPSR
//uint* psr = newStack + (STACK_Size >> 2) - 1; //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异常引发上下文切换 // 触发PendSV异常引发上下文切换
OnSwitch(); OnSwitch();

View File

@ -128,7 +128,7 @@ void Dhcp::Start()
uint randnum = (ran.Next() << 16) & 0xffff0000; uint randnum = (ran.Next() << 16) & 0xffff0000;
dhcpid = (uint)now + randnum; 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等软路由要求非常严格 // 使用DHCP之前最好清空本地IP地址KWF等软路由要求非常严格
// 严格路由要求默认请求的IP必须在本网段否则不予处理 // 严格路由要求默认请求的IP必须在本网段否则不予处理
@ -167,7 +167,7 @@ void Dhcp::Stop()
Running = false; Running = false;
Sys.SetTask(taskID, 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; auto& host = Host;
if (Result) if (Result)

View File

@ -288,13 +288,13 @@ void TSys::OnShowInfo() const
#endif #endif
uint end = SRAM_BASE + (RAMSize << 10); uint end = SRAM_BASE + (RAMSize << 10);
uint size = end - start; 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 defined(STM32F4)
if(start < 0x20000000) start = 0x20000000; if(start < 0x20000000) start = 0x20000000;
#endif #endif
//end = 0x20000000 + (RAMSize << 10); //end = 0x20000000 + (RAMSize << 10);
size = end - start; 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); if(IsGD) debug_printf("ChipType:%p %s\r\n", *(uint*)0x40022100, (cstring)0x40022100);
#endif #endif

View File

@ -37,7 +37,7 @@ INROOT void Thread::CheckStack()
uint stackBottom = (uint)StackTop - StackSize; uint stackBottom = (uint)StackTop - StackSize;
if(p < stackBottom) 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"); assert(stackBottom <= p, "StackSize");
#endif #endif
} }

View File

@ -47,7 +47,7 @@ bool Flash::WriteBlock(uint address, const byte* buf, uint len, bool inc) const
*s = *p; *s = *p;
while (FLASH->SR & FLASH_SR_BSY); while (FLASH->SR & FLASH_SR_BSY);
if (*s != *p) { 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; return false;
} }
} }
@ -72,7 +72,7 @@ bool Flash::EraseBlock(uint address) const
if(address < Start || address + Block > Start + Size) return false; if(address < Start || address + Block > Start + Size) return false;
#if FLASH_DEBUG #if FLASH_DEBUG
debug_printf("\tFlash::EraseBlock(0x%08x)\r\n", address); debug_printf("\tFlash::EraseBlock(%p)\r\n", address);
#endif #endif
// 进行闪存编程操作时(写或擦除)必须打开内部的RC振荡器(HSI) // 进行闪存编程操作时(写或擦除)必须打开内部的RC振荡器(HSI)

View File

@ -40,10 +40,10 @@ extern "C"
*/ */
void FAULT_SubHandler(uint* registers, uint exception) 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++) 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(); TInterrupt::Halt();

View File

@ -76,12 +76,12 @@ extern "C"
{ {
void FAULT_SubHandler(uint* registers, uint exception) 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++) 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(); TInterrupt::Halt();
} }

View File

@ -47,7 +47,7 @@ bool Flash::WriteBlock(uint address, const byte* buf, int len, bool inc) const
*s = *p; *s = *p;
while (FLASH->SR & FLASH_SR_BSY); while (FLASH->SR & FLASH_SR_BSY);
if (*s != *p) { 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; return false;
} }
} }
@ -72,7 +72,7 @@ bool Flash::EraseBlock(uint address) const
if (address < Start || address + Block > Start + Size) return false; if (address < Start || address + Block > Start + Size) return false;
#if FLASH_DEBUG #if FLASH_DEBUG
debug_printf("\tFlash::EraseBlock(0x%08x)\r\n", address); debug_printf("\tFlash::EraseBlock(%p)\r\n", address);
#endif #endif
// 进行闪存编程操作时(写或擦除)必须打开内部的RC振荡器(HSI) // 进行闪存编程操作时(写或擦除)必须打开内部的RC振荡器(HSI)

View File

@ -76,10 +76,10 @@ extern "C"
{ {
void FAULT_SubHandler(uint* registers, uint exception) 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++) 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(); TInterrupt::Halt();

View File

@ -76,10 +76,10 @@ extern "C"
{ {
void FAULT_SubHandler(uint* registers, uint exception) 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++) 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(); TInterrupt::Halt();

View File

@ -1,7 +1,7 @@
#include "Storage.h" #include "Storage.h"
//#define STORAGE_DEBUG DEBUG #define STORAGE_DEBUG DEBUG
#define STORAGE_DEBUG 0 //#define STORAGE_DEBUG 0
#if STORAGE_DEBUG #if STORAGE_DEBUG
#define st_printf debug_printf #define st_printf debug_printf
#else #else
@ -16,7 +16,7 @@ bool BlockStorage::Read(uint address, Buffer& bs) const
if(address < Start || address + len > Start + Size) return false; if(address < Start || address + len > Start + Size) return false;
#if STORAGE_DEBUG #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 #endif
bs.Copy(0, (byte*)address, -1); 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(address < Start || address + len > Start + Size) return false;
#if STORAGE_DEBUG #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; int len2 = 0x10;
if(len < len2) len2 = len; if(len < len2) len2 = len;
//st_printf(" Data: "); //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(address < Start || address + len > Start + Size) return false;
#if STORAGE_DEBUG #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 #endif
// 这里还没有考虑超过一块的情况,将来补上 // 这里还没有考虑超过一块的情况,将来补上
@ -163,7 +163,7 @@ bool BlockStorage::Erase(uint address, int len) const
if(address < Start || address + len > Start + Size) return false; if(address < Start || address + len > Start + Size) return false;
#if STORAGE_DEBUG #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 #endif
if(len == 0) len = Start + Size - address; 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(address < Start || address + len > Start + Size) return false;
#if STORAGE_DEBUG #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 #endif
ushort* p = (ushort*)address; ushort* p = (ushort*)address;

View File

@ -71,7 +71,7 @@ void TestCrc()
uint crc = Crc::Hash(bs, 0); uint crc = Crc::Hash(bs, 0);
uint crc2 = Crc::Hash(bs, 4); uint crc2 = Crc::Hash(bs, 4);
bs.Show(); 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; uint temp = crc;
@ -80,7 +80,7 @@ void TestCrc()
crc2 = Crc::Hash(Buffer(&crc2, 4)); crc2 = Crc::Hash(Buffer(&crc2, 4));
ByteArray(&temp, 4).Show(); ByteArray(&temp, 4).Show();
debug_printf("\r\n\t"); 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 // 结果相同但都不是0
// 连续测试。构建8字节前面是data后面是前面的crc // 连续测试。构建8字节前面是data后面是前面的crc
@ -92,7 +92,7 @@ void TestCrc()
crc2 = Crc::Hash(bs2); crc2 = Crc::Hash(bs2);
bs2.Show(); bs2.Show();
debug_printf("\r\n\t"); 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 // 结果相同但都不是0
// 实际应用中,先计算数据的校验,然后接着附加校验码部分,跟直接连续计算效果应该一致 // 实际应用中,先计算数据的校验,然后接着附加校验码部分,跟直接连续计算效果应该一致
@ -101,16 +101,16 @@ void TestCrc()
crc = Crc::Hash(bs3, data); crc = Crc::Hash(bs3, data);
//crc2 = HardCrc(bs3, data); //crc2 = HardCrc(bs3, data);
bs3.Show(); bs3.Show();
debug_printf(" <= 0x%08x\r\n\t", data); debug_printf(" <= %p\r\n\t", data);
debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2);
// 结果不同HardCrc结果跟8字节测试相同 // 结果不同HardCrc结果跟8字节测试相同
ByteArray bs4(&temp, 4); ByteArray bs4(&temp, 4);
crc = Crc::Hash(bs4, temp); crc = Crc::Hash(bs4, temp);
//crc2 = HardCrc(bs4, temp); //crc2 = HardCrc(bs4, temp);
bs4.Show(); bs4.Show();
debug_printf(" <= 0x%08x\r\n\t", temp); debug_printf(" <= %p\r\n\t", temp);
debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2);
// 结果不同SoftCrc结果跟8字节测试相同 // 结果不同SoftCrc结果跟8字节测试相同
// 对大数据块进行校验 // 对大数据块进行校验
@ -121,7 +121,7 @@ void TestCrc()
crc2 = Crc::Hash(bs5); crc2 = Crc::Hash(bs5);
bs5.Show(); bs5.Show();
debug_printf("\r\n\t"); 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; temp = crc;
@ -131,8 +131,8 @@ void TestCrc()
crc = Crc::Hash(bs6, temp); crc = Crc::Hash(bs6, temp);
//crc2 = HardCrc(bs6, temp); //crc2 = HardCrc(bs6, temp);
bs6.Show(); bs6.Show();
debug_printf(" <= 0x%08x\r\n\t", temp); debug_printf(" <= %p\r\n\t", temp);
debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2);
// 有初值时,两者不一样 // 有初值时,两者不一样
// 增量计算CRC // 增量计算CRC
@ -143,8 +143,8 @@ void TestCrc()
//crc2 = HardCrc(bs7, 0); //crc2 = HardCrc(bs7, 0);
//crc2 = HardCrc(Buffer(&crc2, 4), crc2); //crc2 = HardCrc(Buffer(&crc2, 4), crc2);
bs7.Show(); bs7.Show();
debug_printf(" <= 0x%08x\r\n\t", temp); debug_printf(" <= %p\r\n\t", temp);
debug_printf("SoftCrc:0x%08x HardCrc:0x%08x \r\n", crc, crc2); debug_printf("SoftCrc:%p HardCrc:%p \r\n", crc, crc2);
// 测试Crc16数据和crc部分一起计算crc16结果为0 // 测试Crc16数据和crc部分一起计算crc16结果为0
debug_printf("\r\n"); debug_printf("\r\n");

View File

@ -12,9 +12,9 @@ void TestFlash()
Flash flash; Flash flash;
// 凑一个横跨两页的地址 // 凑一个横跨两页的地址
uint addr = 0x0800C000 + flash.Block - size + 7; 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); flash.Erase(addr, 0x100);
byte bb[0x100]; byte bb[0x100];

View File

@ -386,7 +386,7 @@ bool TcpSocket::Send(const Buffer& bs)
#if NET_DEBUG #if NET_DEBUG
debug_printf("Tcp::Send "); debug_printf("Tcp::Send ");
Remote.Show(); 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 #endif
//Stream ms(sizeof(ETH_HEADER) + sizeof(IP_HEADER) + sizeof(TCP_HEADER) + bs.Length()); //Stream ms(sizeof(ETH_HEADER) + sizeof(IP_HEADER) + sizeof(TCP_HEADER) + bs.Length());

View File

@ -588,7 +588,7 @@ void TinyController::Loop()
Buffer bs(node.Data, node.Length); Buffer bs(node.Data, node.Length);
if(node.Length <= 0 || node.Length > 32) 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]) if(node.Mac[0])
Port->Write(bs, &node.Mac[1]); Port->Write(bs, &node.Mac[1]);