I am writing this short blog to help illustrate a great feature we have added to DS-5, available in version 5.19 and later. You can always get the latest version of DS-5 here. We have a new MMU view, as well as associated command line (CLI) commands to help visualize the virtual and physical mapping of the memory system. In the first release, we support all ARMv7-A CPUs, such as Cortex-A9 and Cortex-A15. It is an easy to use feature, requiring no particular configuration of the debugger, as this information is automatically determined by the tools, reading the translation table base register(s) of the CPU, and processing the translation tables accordingly. It is a great utility to help you verify that the MMU has been configured as you wanted, else it can help you to drill down to the reason why if it isn't.
I am using a Zedboard platform, running SMP Linux on the dual-core Cortex-A9MP CPU within the Xilinx Zynq device. I am connected to the target via DSTREAM. However this will work with any suitable CPU configuration, real hardware or even an FVP.
You will first need to locate the MMU pane in the Eclipse GUI of the debugger, as it is not visible by default. Navigate through the Eclipse GUI menu system, from Window → Show View → Other → DS-5 Debugger → MMU, and the window will appear. The easiest use case of the view is to simply enter an address in the Translation tab, specify whether this is a Physical or a Virtual address, and click translate. The debugger will tell you the translated address, as well as some information on how the address was resolved. An easy first test is to translate a virtual to a physical address, and then translate the result back again:
As an aside, note that the translated result is listed as SP:0x01007000. The SP address qualifier refers to a "Secure Physical" address.
From the above, we see that the virtual address 0x8000 maps to physical address 0x01007000, and vice versa. We also see that physical address 0x01007000 also maps to other virtual addresses (0xC1007000 in this case). That is a very common scenario.
From there, we can easily explore deeper into the MMU page tables. Click to the Memory Map tab, and you will see the following:
Click the Show Memory Map button, and the debugger will populate the view, grouping together virtual address ranges and their corresponding physical address ranges, and summarizing the properties of each range:
We see that the virtual memory region starting at 0x8000 maps to the physical region starting at 0x01007000, exactly as the Translation tab said it would. We also see the access permissions and other properties of the addresses. This type of information is useful to help decipher ordering or coherency issues that you may encounter.
If more detailed information on the page table entries is needed, you can go to the Tables tab, and expand this view as needed.
We can also use the MMU view to easily explore alternative scenarios. Click on the MMU Settings button, and you can apply custom settings by changing the parameters to point to alternative translation tables, and examine the new translation state.
The above GUI views are ideal for human interactive debugging. It is also possible for you to generate similar reports from the command line, or hence via DS-5 scripts that you may wish to generate, and for this we have added a new family of mmu commands:
Note that as for all DS-5 commands, you can use Ctrl+Space to help auto-complete the command as well as provide a simple pop-up explaining its use.
Most of the options are somewhat self explanatory. I recommend using the mmu list commands to assist in determining the appropriate parameters to use. For example you may wish to do something like the below.
Note again that this feature is added in DS-5 5.19. If you have an earlier version (which you can determine from the Eclipse Menu in Help → About ARM DS-5), you will need to update your installation from here. In the first release we only support ARMv7-A CPUs. We plan to support ARMv8-A in a future release.