6.10.5 About debugging PikeOS

DS-5 supports source level debugging of PikeOS.

From a debugging perspective, PikeOS consists of mainly these parts:

  • PikeOS kernel.
  • PikeOS System Software (PSSW).
  • Applications which run on the operating system.

All these parts have separate symbol files and you must ensure that the symbols for the relevant parts are loaded at the correct address spaces.

Debugging PikeOS after the MMU is enabled

  1. Load the PikeOS image onto the target. You can use the DS-5 restore command to load the image into the target RAM.

    Note:

    • The PikeOS image does not contain debug information, even if using the PikeOS ELF boot strategy.
    • Loading the image on to your target depends on your boot strategy and target. Check the PikeOS documentation for instructions.
    • If using the CODEO tool, the boot image is the output of an Integration Project.
  2. Load the kernel debug information. You can use the DS-5 add-symbol-file command to load the kernel debug information into the debugger.

    Note:

    • The address space where the kernel runs might differ from the current address space, especially if stopped during the boot process. Ensure that the kernel debug image is loaded to the address space that the kernel runs in, for example, EL1N.
    • Do not enable OS awareness before the MMU is enabled. If you want to debug PikeOS, before the MMU is enabled, see the Debugging PikeOS before the MMU is enabled section later in this topic.
    • The kernel debug image must exactly match the kernel with which the loaded image was compiled. Loading this information is necessary for the OS Awareness to function.
    • If using the CODEO tool, you can determine the kernel that is used from the PikeOS Kernel section of the Integration Project's Project Configuration. The debug image is typically stored with a .elf or .unstripped file extension.
  3. Load the debug information for your application or the PikeOS System Software using the add-symbol-file command. Ensure that they are loaded to the correct address space.

    Note:

    If using the CODEO tool, you can determine the location of files containing debug information from the relevant sections of the Integration Project's Project Configuration. The debug images are typically stored with a .elf or .unstripped file extension.

    This step is not required or used by the OS awareness, but improves your experience if you plan to debug either of these components.

Note:

When debugging PikeOS, if you inspect unscheduled OS threads, their current Program Counter might point to an address which is not currently mapped in by the MMU.

Debugging PikeOS before the MMU is enabled

The initial enablement of the MMU is done by the Platform Support Package (PSP) during its early initialization. The point at which the MMU is enabled differs by platform. Some PSPs provide explicit symbols to mark the first virtual instructions, while others do not. To find the first point at which the MMU is enabled, inspection of the specific platform's PSP is required.

The MMU is enabled by the time the PSP starts the kernel and the kernel entry point P4Main is passed. When the MMU is enabled, it is safe to enable OS awareness.

The kernel debug image contains debug symbols for both the kernel and the PSP. All symbols have virtual addresses and require the MMU to be enabled. The early PSP initialization occurs before the MMU is enabled. To debug the early PSP initialization, load the kernel symbols with an offset so that their offset virtual addresses align with their physical counterparts.

Since the MMU is currently off, DS-5 Debugger's OS support must be disabled before the kernel debug symbols are loaded. This is to avoid the debugger from trying to read the kernel structures before they are set up (and possibly resulting in Data Aborts). To disable OS awareness, enter set os enabled off in the DS-5 Command view and click Submit or press Enter.

To calculate the required load offset, calculate the difference (P-V) between the physical start address of the boot image (P) and the virtual start address of the kernel image (V).

For example, if the kernel is linked at virtual address 0x80000000 and is loaded at physical address 0x20000000, the offset is -0x60000000, which is 0x20000000 - 0x80000000 (P-V).

Note:

Early PSP initialization typically runs at a higher Exception level than the rest of the kernel. You must take care to ensure that the offset symbols are also loaded in the correct address space. An example of a full offset for an ARMv8 target is EL2:-0xFFFFFF7F80000000.

See About loading debug information into the debugger for information on loading debug symbols into the debugger. Also, see the documentation for the DS-5 add-symbol-file command for information about loading the debug symbols into the debugger from the command line.

When the MMU is enabled, the previously loaded debug information must be reloaded at the unadjusted virtual addresses. To reload the debug information, first, enter file in the DS-5 Command view to discard currently loaded symbols. Then, use the add-symbol-file command to load the kernel debug information into the debugger, but this time with zero offset.

Non-ConfidentialPDF file icon PDF versionARM 100953_0527_00_en
Copyright © 2010–2017 ARM Limited or its affiliates. All rights reserved.