Skip to content

Commit

Permalink
Reformatted ARM debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
azonenberg committed Jul 3, 2018
1 parent 40e4a5f commit 5925c48
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
19 changes: 10 additions & 9 deletions ARMCortexA9.cpp
Expand Up @@ -49,7 +49,8 @@ using namespace std;
ARMCortexA9::ARMCortexA9(ARMDebugMemAccessPort* ap, uint32_t address, ARMDebugPeripheralIDRegisterBits idreg)
: ARMAPBDevice(ap, address, idreg)
{
LogDebug("Cortex-A9 initializing at %08x\n", address);
LogDebug("Found ARM Cortex-A9 at %08x, probing...\n", address);
LogIndenter li;

//Read the Debug ID register and extract flags
ARMv7DebugIDRegister did;
Expand Down Expand Up @@ -131,7 +132,7 @@ string ARMCortexA9::GetDescription()

void ARMCortexA9::PrintIDRegister(ARMv7DebugIDRegister did)
{
LogDebug(" Rev %u variant %u\n", did.bits.revision, did.bits.variant);
LogDebug("CPU rev %u variant %u\n", did.bits.revision, did.bits.variant);

const char* arches[]=
{
Expand All @@ -153,23 +154,23 @@ void ARMCortexA9::PrintIDRegister(ARMv7DebugIDRegister did)
"reserved f"
};

LogDebug(" Arch %s\n", arches[did.bits.debug_arch_version]);
LogDebug("Arch %s\n", arches[did.bits.debug_arch_version]);


if(did.bits.sec_ext)
{
LogDebug(" Security extensions\n");
LogDebug("Security extensions\n");
if(did.bits.sec_ext && did.bits.no_secure_halt)
LogDebug(" (but no secure halt)\n");
LogDebug(" (but no secure halt)\n");
}
if(did.bits.pcsr_legacy_addr)
LogDebug(" PCSR is at legacy address\n");
LogDebug("PCSR is at legacy address\n");
if(did.bits.has_dbgdevid)
LogDebug(" Has debug device ID\n");
LogDebug("Has debug device ID\n");
//TODO: arch version
LogDebug(" %d breakpoints (%d with context matching)\n",
LogDebug("%d breakpoints (%d with context matching)\n",
did.bits.bpoints_minus_one+1, did.bits.context_bpoints_minus_one+1);
LogDebug(" %d watchpoints\n", did.bits.wpoints_minus_one + 1);
LogDebug("%d watchpoints\n", did.bits.wpoints_minus_one + 1);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions ARMDebugMemAccessPort.cpp
Expand Up @@ -262,15 +262,15 @@ void ARMDebugMemAccessPort::LoadROMTable(uint32_t baseAddress)
//Additional ROM table
case CLASS_ROMTABLE:
{
LogDebug("Found extra ROM table at 0x%08x, loading\n", address);
LogDebug("Found extra ROM table at %08x, loading\n", address);
LogIndenter li;
LoadROMTable(address);
}
break;

//Don't know what to do with anything else
default:
LogWarning("Found unknown component class 0x%x, skipping\n", ccls);
LogWarning("Found unknown component class %x, skipping\n", ccls);
throw JtagExceptionWrapper(
"Unknown debug component class",
"");
Expand Down Expand Up @@ -316,7 +316,7 @@ void ARMDebugMemAccessPort::ProcessDebugBlock(uint32_t base_address)
}

unsigned int blockcount = (1 << reg.bits.log_4k_blocks);
LogDebug("Found debug component at %08x (rev/mod/step %u/%u/%u, %u 4KB pages)\n",
LogDebug("Found debug component at %08x (rev %u.%u.%u, %u 4KB pages)\n",
base_address, reg.bits.revnum, reg.bits.cust_mod, reg.bits.revand, blockcount);
LogIndenter li;

Expand Down
15 changes: 9 additions & 6 deletions ARMDebugPort.cpp
Expand Up @@ -62,12 +62,13 @@ ARMDebugPort::ARMDebugPort(
EnableDebugging();

//Figure out how many APs we have
LogDebug("Found ARM JTAG-DP, probing...\n");
LogIndenter li;
LogDebug("Searching for APs...\n");
uint8_t nap = 0;
for(; nap<255; nap++)
{
LogIndenter li;

ARMDebugPortIDRegister idr;
idr.word = APRegisterRead(nap, REG_IDR);
if(idr.word == 0)
Expand Down Expand Up @@ -99,7 +100,9 @@ ARMDebugPort::ARMDebugPort(
//(this seems to be fpga config?)
if(!idr.bits.is_mem_ap)
{
LogDebug("Found JTAG-AP at index %d\n", nap);
LogDebug("Found JTAG-AP rev %d at index %d\n", idr.bits.revision, nap);
LogIndenter li;
LogDebug("Not supported yet, ignoring\n");
continue;
}

Expand All @@ -110,9 +113,9 @@ ARMDebugPort::ARMDebugPort(
m_aps[nap] = ap;

if(ap->GetBusType() == ARMDebugAccessPort::DAP_AHB)
LogDebug("Found AHB MEM-AP at index %d\n", nap);
LogDebug("Found AHB MEM-AP rev %d at index %d\n", idr.bits.revision, nap);
else if(ap->GetBusType() == ARMDebugAccessPort::DAP_APB)
LogDebug("Found APB MEM-AP at index %d\n", nap);
LogDebug("Found APB MEM-AP rev %d at index %d\n", idr.bits.revision, nap);

//If it's an AHB Mem-AP, and we don't have a default Mem-AP, this one is probably RAM.
//Use it as our default AP.
Expand All @@ -123,12 +126,12 @@ ARMDebugPort::ARMDebugPort(
m_defaultMemAP = ap;
}

//If it's an APB Mem-AP, and we don't have a default Mem-AP, this one is probably debug registers.
//If it's an APB Mem-AP, and we don't have a default Mem-AP, this one is probably CoreSight debug registers.
//Use it as our default AP.
if( (ap->GetBusType() == ARMDebugAccessPort::DAP_APB) && (m_defaultRegisterAP == NULL) )
{
LogIndenter li;
LogDebug("Using as default register Mem-AP\n");
LogDebug("Using as default CoreSight Mem-AP\n");
m_defaultRegisterAP = ap;
}
}
Expand Down
5 changes: 3 additions & 2 deletions JtagInterface.cpp
Expand Up @@ -247,6 +247,8 @@ void JtagInterface::PrintChainFaultMessage()
*/
void JtagInterface::InitializeChain()
{
LogIndenter li;

unsigned char lots_of_ones[128];
memset(lots_of_ones, 0xff, sizeof(lots_of_ones));
unsigned char lots_of_zeros[128];
Expand Down Expand Up @@ -312,8 +314,7 @@ void JtagInterface::InitializeChain()
break;
}
}

//printf("DEBUG: Got %d devices\n", (int)m_devicecount);
LogDebug("Found %d total devices\n", (int) m_devicecount);

//Now we know how many devices we have! Reset the TAP
ResetToIdle();
Expand Down

0 comments on commit 5925c48

Please sign in to comment.