RTEMS board-level debugging

Source: Internet
Author: User
Tags jlink

It's too busy recently. It's really a short time. A friend raised an issue of board-level debugging at 9260. I think this question is very well raised and universal. So, how can I take the time to write this blog.

RTEMS board-level debugging is not as easy as using qemu mini2440. It is still complicated. There are many small technical details. Let's start with the qemu mini2440 debugging. I suggest you use DDD for debugging. For debugging of DDD, you can refer to rickleaf's blog RTEMS tips for development in Linux. This guy prefers Ubuntu and I prefer fedora. Take fedora8 as an example. After logging on with the root permission, enter the following command in the control terminal:

Yum install ddd

Enter
DDD -- debugger arm-rtems4.9-gdb

(Note that the path of the arm-rtems4.9-gdb must be in the environment variable) It starts DDD, cool.
We start the qemu mini2440 simulator on another terminal. Open qemu/mini2440/mini2440_start.sh

Cmd = "$ base/../ARM-softmmu/qemu-system-Arm \
-M mini2440 $ *\
-Drive file = $ name_snapshots, snapshot = on \
-Serial stdio \
-Kernel uimage \
-Mtdblock "$ name_nand "\
-Show-cursor \
-USB device keyboard-USB device mouse \
-Net Nic, VLAN = 0 \
-Net tap, VLAN = 0, ifname = tap0 \
-Monitor telnet: 5555, server, Nowait"

To:

Cmd = "$ base/../ARM-softmmu/qemu-system-Arm \
-S-s \
-M mini2440 $ *\
-Drive file = $ name_snapshots, snapshot = on \
-Serial stdio \
-Kernel/tftpboot/uimage \
-Mtdblock "$ name_nand "\
-Show-cursor \
-USB device keyboard-USB device mouse \
-Net Nic, VLAN = 0 \
-Net tap, VLAN = 0, ifname = tap0 \
-Monitor telnet: 5555, server, Nowait"

After saving, enter the command in the path qemu:
./Mini2440/mini2440_start.sh

Note that you must enter the command in the qemu/path. Otherwise, the script will not run normally. After the mini2440_start.sh script is executed, it will stop at a location and return to the DDD interface. On the command line interface, enter:
File ~ /Work/network-demos-4.9.5/telnetd/o-optimize/telnetd.exe
Target remote 127.0.0.1: 1234

Load

(File address ~ /Work/network-demos-4.9.5/telnetd/o-optimize/telnetd.exe address should also be changed according to your situation, you know)


In this way, you can.Note: Do not enter the Run Command in DDD. Otherwise, it will cause abnormal GDB action, causing the launch of the mini2440 simulator and failure. You can manually enter the C and step commands. You can use the shortcut commands on the DDD panel on the right. However, you cannot click the Run Command. If you click, the simulation fails. Special attention.


You can double-click the code area to set breakpoints. As shown in, you can select information and click display. The information address is displayed in the box. Select the displayed information and Click Display again. The system also lists the details of the information structure. Very powerful. Enjoy it. This tracing is much better than using GDB manually. It is much simpler.


After talking about the simulation debugging of mini2440, let's take a look at how to perform real hardware simulation. In fact, this problem is very complicated, and my level is limited. GDB debugging is diverse. I have seen a paper that allows you to perform one-step Debugging Using code + UART. The idea is to use the arm exception trap to go to the single step. Write UART communication code in an abnormal service. I have carefully read the thesis. If something has not been put into practice, let alone it. Here I will talk about using J-link of segger to debug arm91sam9260.


Jlink must be of the full version and support for GDB server. If it does not support the jlink of GDB server, there is no way to conduct RTEMS board-level debugging. The qemu mini2440 simulation we discussed above uses DDD debugging. In fact, there is no big difference in nature. The only difference is that a real Board may not be suitable for running programs in the current Board status. The simulation can be successful only when the board is adjusted to the running environment suitable for running the program to be debugged. Simulation of mini2440 does not have this problem, because the simulation code does not consider some hardware factors. However, the real board cannot be ignored. For arm9260, after power-on, link jlink to open GDB
Server, enter the following in DDD:Target remote 127.0.0.1: 2331.(This IP address needs to be changed according to the actual situation, but the port number does not need to be changed)Other operations are the same. The simulation may fail. Why? The steps are correct. Where is the problem?

In fact, the working status of arm9260 may not be suitable for running the current simulation code. Because after 9260 is powered on, the secondary clock is working. If Bootstrap or bootloader is not running, it may appear, or the secondary clock is working. Instead of working on the main clock, there is no initialization of related hardware resources, such as SDRAM and other peripherals. The program goes up directly and may not be able to see anything, just like it is dead.

In this way, if we simulate a program, we only use some of the chip resources of 9260, and SDRAM, the simplest way is. Use Atmel official SAM-BA tools, select at9260ek, select jlink, as long as the main interface of Sam-Ba appears OK. Because when the SAM-BA starts, A jlink script is run to initialize 9260. The main task is to close the watch dog, start the main clock, and configure the SDRAM and reset circuit. Then close the SAM-BA, and then open the segger's GDB server, so that the following steps are similar to the mini2440. In this way, the simulation is okay. In this process, the target board cannot be powered off.

If 9260 of the internal hardware is used and some external hardware is used, the situation is slightly more complicated. The official Sam-Ba tool of ATMEL may not be able to solve the problem (in most cases, the above method can be done, and there are always exceptions ). We can use the uboot tool to write Bootstrap to the target board, install uboot, and configure uboot to stop running the uboot command line instead of starting the application. Use the command line to control the uboot initialization of 9260 hardware and off-chip hardware. The following steps are the same as those of mini2440.

The first method is a dedicated solution of ATMEL chip. The second method is a general method, and the effect is very good. During the learning process, children's shoes should pay attention to their experiences on multiple platforms. The process is not difficult, but there are a lot of details. We should practice it over and over again and learn more.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.