Course contentsShow
← Embedded Systems & Computer Architecture
Lesson 574 of 9368. Advanced Debugging and Hardware VerificationFree lesson

Debug Access Port and Memory Access Unit

Learners will map internal debug registers to system memory addresses to perform direct hardware reads and writes during execution.

In this lesson, you will learn how to map internal debug registers to the system memory map to perform direct hardware reads and writes during live execution.

The Bridge Between Debugger and Hardware

When you attach a debugger to an embedded system, you aren't just sending magic signals; you are interacting with the Debug Access Port (DAP). The DAP acts as the gatekeeper, translating external protocols like JTAG or Serial Wire Debug (SWD) into internal bus transactions.

The heart of this operation is the Memory Access Unit (MAU). The MAU is a specialized hardware component that allows the DAP to act as a "bus master." Because the MAU is integrated into the system bus matrix, it can access any addressable location—CPU registers, peripheral control registers, or RAM—as if it were just another piece of memory.

Mapping Debug Registers

To perform live hardware verification, the DAP allows us to map the debug resources directly into the system’s memory space. By writing to specific, reserved memory addresses, the DAP can manipulate the processor’s state without stopping the core.

For example, if you want to trigger a hardware read on a peripheral register without hitting a breakpoint, you can issue an access through the MAU:

// Conceptually, accessing a hardware peripheral through the MAU
// The address 0xE000ED00 is often the DHCSR (Debug Halting Control and Status Register)
uint32_t* dhcsr_ptr = (uint32_t*)0xE000ED00;

// Direct write via DAP/MAU to force a core halt or examine registers
*dhcsr_ptr |= (1 << 0); // Logic to halt the core via memory-mapped debug register

Why This Matters

By mapping these registers into memory, you bypass the need for traditional software instrumentation (like printf debugging) that alters timing. The MAU allows the external debugger to "peek" and "poke" at the system state in real-time. This is essential for verifying hardware behavior under load, as the processor continues to execute code while the MAU performs these background memory transactions. You are essentially creating a side-channel into the CPU's internal logic, providing visibility into the hardware even when the software has crashed or entered an infinite loop.

Key Takeaway: The Memory Access Unit allows the Debug Access Port to treat system registers as memory addresses, enabling non-intrusive, direct hardware inspection during live runtime.