Kernel debug

Embedded Linux projects examples

This chapter covers the basics of Linux Kernel projects including creating and debugging a static Kernel.

Note:

  • To debug Kernel Debugging applications with QEMU emulator, please install the xplor-studio-kernel blueprint first. Please refer to Guidelines for more information.
  • In this release, Debugging Kernel feature is only available on Ubuntu.

Create a new project

Select “File > New > C/C++ Project”, choose Linux Kernel Project and Next.

example image

Enter the Project name and select Embedded Linux XploR Toolchain for RISC-V in the Toolchains box, then click Next.

example image

Select Kernel Source Path then click Finish.

example image

Update build settings

With build settings, users can switch from 32 bits to 64 bits as well as different floating point ABI options (except Single Precision). The kernels are specified via those options.

example image

Please refer to the below table to select the correct options for each target.

PlatformCoreArchitectureFloating Point
QEMURISC-V emulatorRV32None
QEMURISC-V emulatorRV32RVFD
QEMURISC-V emulatorRV64None
QEMURISC-V emulatorRV64RVFD

Build project

Warning: The Static Kernel project does not need to be built because the XploR Studio uses a pre-build kernel image for debugging.

example image

Running the kernel with QEMU emulator

Note: XploR Studio does not support to the run Static Kernel project!

Debugging the kernel with QEMU emulator

Note: Before debugging the kernel, the users should select the architecture and floating point options. By default, the combine (RV64, None) is selected. Please refer to Section 2: Update build settings

There are two ways to debug the kernel:

  • On the Project explorer, right-click on the project name and select Debug as > RISC-V Kernel application with QEMU.

example image

  • Create the new RISC-V Kernel Debugging configurations: Right-click on the project name then select Debug As > Debug Configurations.

example image

Double-click on RISC-V Kernel Debugging, then click Debug to start the Kernel debugging session.

example image

When starting kernel debugging, the kernel is suspended in the start_kernel function and the terminal/console pauses at kernel booting.

example image

To debug an embedded Linux applications, the kernel should be booted completely.