Ozone
Introduction
Hardware
Software
Subarctic
Prepare and build b2init
Build the application
How to debug?
Download
 

Introduction

Here I will show you how to use Ozone to debug a Cortex-A8 application.

Ozone is a full-featured graphical debugger for embedded applications. With Ozone it is possible to debug any embedded application on C source and assembly level. Ozone can load applications built with any toolchain / IDE or debug the target's resident application without any source. Ozone includes all needed debug information windows and makes use of the best performance of J-Link debug probes. The user interface is designed to be used intuitively and is fully configurable. All windows can be moved, re-sized and closed to fit the need of any developer. (Source: SEGGER)

Some preparations are needed for debugging in the external RAM of the BeagleBone. Before the debugging session can start in the RAM, the memory interface and the CPU must be initialized. This is not limited to the BeagleBone itself, this is normal for the CPU architecture where external RAM is used. E.g. in case of Linux, a so called "first level" bootloader and "U-Boot" is used to initialize the CPU and the memory interface. After this process an application, Linux, can be executed in the external RAM.

Here I want to debug a "Bare Metal" application. Unfortunately the "first level" bootloader and "U-Boot" is not available. Therefore the debugger must do the job and initialize the CPU before the start of the application. But Ozone itself cannot handle this task alone.

Therefore, a program is started before the actual debug session which will handle the initialisation process of the CPU. This must be supported by the debugger too.

Hardware

This solution based on the "Optional JTAG Header" but without the Samtec connector. A direct connection is soldered to the bottom of the circuit board. It looks like:

More information about JTAG and BeagleBone can be find here.

Software

At the time of updating this tutorial, the following software was installed:

If you do not have a working Bare Metal ARM built environment install the "xPack Windows Build Tools" and "GNU ARM Embedded Toolchain" before.

Subarctic

If the internal bootloader is active on the BeagleBone, you will be asked for a SUBARCTIC driver by the Windows system. This is the case for example when the SD card is not used. It is annoying and I could not find any official driver. That is why I decided to create a dummy driver with libusb-win. You will find the dummy driver in the download section. The driver is for VID: 0451 and PID: 6141.

Prepare and build b2init

The StarterWare will be used to create b2init the "first level" bootloader which is executed in the internal SRAM of the CPU before the actual debug session. As mentioned before, the "first level" bootloader is needed to initialize further parts of the CPU. The internal SRAM starts at address 0x402F0400 and has a size of about 127 KB.

StarterWare provides C-based no-OS platform support for TI's ARM9™ and ARM® Cortex™ A8 based devices. StarterWare provides device abstraction layer libraries, peripheral programming examples such as Ethernet, graphics and USB, and board level example applications. StarterWare can be used stand-alone or with an RTOS (with appropriate changes to work in RTOS environment). (Source: Texas Instruments)

Unfortunately the StarterWare source cannot compile, because of some bugs in version v2.00.01.01. Here a patch is needed. which is available in the download section.

The following external components was used to build b2init:

  • StarterWare for ARM based TI Sitara Processors v2.00.01.01

Assuming you are using "C:\BeagleBone" for the project folder. Download the StarterWare and install it into the project folder. The result should look like:

Now download my StarterWare patch and extract it. Copy the content from the patch into the existing "AM335X_StarterWare_02_00_01_01" folder of the project folder.

Download my b2init and b2test projects, and extract both inside the project folder. The result should look like:

Open the command line, change to the b2init folder and use make:

After the build process the content of the b2init folder should look like:

Congratulation, you have created successful the "first level" bootloader b2init.

Build the application

b3test is the application here. Open the command line, change to the b2test folder and use make. The content of the b2test folder should look like after the build process:

The application has been successfully created, and we can start the debug session.

How to debug?

Connect the J-Link to the PC and to the BeagleBone (do not forget to power the target) and start Ozone. Use "File / Open..."

and select the "b2test.jdebug" file inside the b2test folder. Ozone should look like:

(Click inside the picture to expand)

Here you can see main.c from the b2test application. Ozone is prepared to start the debug session of b2test now. Press the "Start" button or F5 to start the debugger:

Ozone should look like:

(Click inside the picture to expand)

Now we are ready to debug the b2test application. To be sure take a look at the window caption :o)
You can step through the code with the following buttons:

Step Over (F10)

Step Into (F11)

Take a look at the "Local Data" window. After seven steps (F10) the windows should look like:

And the source window:

With the seven steps from above, the variables was set. And the next line will be
fa = fa + fd.

Note: The line which is highlighted is not yet executed This will be done with the next step.

How to set a breakpoint?

Setting a breakpoint is very easy. Click at the gray dot at the left of the line number:

Click at the gray dot in line 89, fa = fa + 2.6, a breakpoint will be set:

The red dot is the new breakpoint. You can remove the breakpoint by clicking on it again. Now we want to resume, press the "Resume" button or (F5):

The program will be executed and it will stop at the breakpoint:

The value of the variables was changed to a = 0x11, b = 0x3, c = 0x14.

You can stop the debug session by pressing the "Stop" button:

This was now a quick introduction how to use Ozone to debug a Cortex-A8 application.

Download

b2init and b2test can be used for the BeagleBone and BeagleBone Black too.

SUBARCTIC Dummy v20131013

StarterWare v2.00.01.01 patch v20151114

b2init v20230911 (13 KB)

b2test v20230911 (9 KB)