（*1）When playing back video at low resolutions, the text in the video can be difficult to see.
(*2) In order to debug the app, we needed to use a board with a JTAG connector, so we used a Cyclone V SoC Develoment Board. Depending on the board’s Rivision, some jumper settings and soldering may be required.
What is a Debugger
It is a tool for advanced debugging using the debugging capabilities of the CPU and for debugging on systems that do not have the resources to run a debugger on the target.
In a cross-compilation environment, which is common in embedded system development, shortening the compile-execution-code-modify-compile TAT is the first step to efficiency; learn how to use the debugger, because the difference between PRINT statement debugging and debugging with the debugger is noticeable.
What is Lauterbach TRACE32
If you want to know more about Lauterbach, please visit Wiki to learn more about the company! (Isn’t it awesome that a dedicated debugger vendor has a Wikipedia page?
There are three points that are of great benefit in the development of embedded Linux.
- Integrated development environment, not a debugger!
- Compiling is often done with the GNU toolchain, so having a debugger rather than an integrated development environment is an advantage in terms of ease of use and procurement costs.
- In addition, it is independent of GCC versions and Linux distributions, so it is ready to use.
- Debugger works on Linux PC!
- Since it compiles on a Linux PC, a single PC can do everything from compiling to debugging, with the advantage that you don’t need to copy the sources and objects for debugging.
- Easy to see the registers around the SoC!
- Easy GUI access to the Cyclone V SoC’s peripheral registers reduces debugging time significantly by eliminating the need to read the bits while tinkering with the SoC’s reference manual and functional calculator.
Setting up a development environment
Building the Kernel
TRACE32 does not require any debugging patches to the target code and obtains the information needed for debugging from the object’s debug symbols and the kernel.
To do this, you need to build the kernel, which we will discuss in more detail in the next article. We’ll talk more about building the kernel in the next article.
Download the source of the kernel $ git clone https://github.com/altera-opensource/linux-socfpga.git Setting of environment variables in Yocto $ . /opt/poky/2.1.1/environment-setup-cortexa8hf-neon-poky-linux-gnueabi Build $ cd linux-socfpga $ make socfpga_defconfig $ make zImage dtbs Copy the built image to SD card $ cp arch/arm/boot/zImage The mount point of the SD card FAT partition $ cp arch/arm/boot/dts/socfpga_cyclone5_socdk.dtb The mount point of the SD card FAT partition
Install as described in the installation.pdf on the installation media, and for Linux, see the section on PC_LINUX. If your debugger hardware is USB connected, please read the Install Drivers (USB) section as well.
Save the Cyclone V SoC and Linux configuration files to a .cmm file.
Configuration for Cyclone V SoC aps_cyclone5_socdk.cmm SYStem.RESet SYStem.CPU CYCLONEVSOC SYStem.JtagClock 1MHz SYStem.Option IMASKASM ON SYStem.Option IMASKHLL ON SYStem.Option TRST OFF TRACE.DISable
Settings for Linux debugging aps_linux.cmm SYStem.Option DACR ON ; give Debugger global write permissions ; add hardware specific options here TrOnchip.Set DABORT OFF ; used by Linux for page miss! TrOnchip.Set PABORT OFF ; used by Linux for page miss! TrOnchip.Set UNDEF OFF ; may be used by Linux for FPU detection SYStem.Option MMUSPACES ON ; enable space ids to virtual addresses Data.LOAD.Elf ~/work/linux-socfpga.git/vmlinux /GNU /NoCODE TRANSlation.RESet MMU.FORMAT LINUXSWAP3 swapper_pg_dir 0xc0000000--0xdfffffff 0x0 TRANSlation.COMMON 0xbf000000--0xffffffff TRANSlation.TableWalk ON TRANSlation.ON TASK.CONFIG ~~/demo/arm/kernel/linux/linux-3.x/linux3.t32 MENU.ReProgram ~~/demo/arm/kernel/linux/linux-3.x/linux.men TERM.Mode VT100 TERM.METHOD COM /dev/ttyUSB0 115200. 8 NONE 1STOP NONE TERM.SIZE 100. 1000. TERM.SCROLL ON
Ready, let’s launch TRACE32!
$ cd /opt/t32 $ ./bin/pc_linux64/t32marm-qt
Debugging Linux Apps
Watch the video at the beginning for more details!
The LED sample app used in this project is the Altera SoC DK software. “Kit installation (ZIP)” on this page ( Linux).
This time we blinked the LED on HPS, so change the source as follows
// Change blink.c sprintf(dir, "/sys/class/leds/fpga_led%d/trigger", ledno); // ↓ sprintf(dir, "/sys/class/leds/hps_led%d/trigger", ledno);
Or, if you’re on Linux, you can convert it in one shot with the command
$ sed -e 's/fpga_/hps_/g' blink.c > blink_hps.c
The compilation is done as follows
$ . /opt/poky/2.1.1/environment-setup-cortexa8hf-neon-poky-linux-gnueabi $ $CC -g -O0 -Werror -Wall –lpthread –o blink_hps blink_hps.c
Cyclone V SoC-equipped board by Altera
The Altera SoC integrates an Arm-based hard processor system (HPS) consisting of processor, peripherals and memory interfaces with a customizable FPGA fabric on a high-bandwidth interconnector backbone. The hard IP includes PCI Express Gen2, multi-memory ports, ECC, memory protection and high-speed serial transceivers, combining features of low performance and power consumption with programmable logic flexibility. It significantly reduces the system board size, which previously consisted of a CPU and FPGA. In this course, the DE0-Nano-SoC Kit/Atlas-SoC Kit from Terasic will be used.
Japan Altera Corporation
TRACE32 made by Lauterbach
The world’s most used hardware-assisted debugger, TRACE32, which supports more than 70 processor architectures, not to mention Arm as well as Nios II. The multicore support of SMP systems allows you to control multiple cores simultaneously and to use the reference core as a Debugging can proceed seamlessly while switching between them. Another feature is the OS recognition function, which supports debugging of SMP-compatible operating systems such as Linux, as standard equipment. This allows you to smoothly debug a program running in user space without worrying about which core the task to be debugged is assigned to.
Nippon Rotabacher K.K.
Embedded Linux Deployment / Development Support Services
Embedded Linux brings new value to your equipment development.
Fujitsu Computer Technologies
This post is also available in: Japanese