Difference between revisions of "Ozone"

From SEGGER Wiki
Jump to: navigation, search
(Watch window expression examples)
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__TOC__
 
__TOC__
=Ozone automated test example=
+
=Automated test example=
 
Ozone features an advanced Scripting interface which can be used for automated tests as well.
 
Ozone features an advanced Scripting interface which can be used for automated tests as well.
 
A simple example of such a setup will be shown in the following article. This can then be used as baseline to e.g. export Code Profile or Instruction Trace reports.
 
A simple example of such a setup will be shown in the following article. This can then be used as baseline to e.g. export Code Profile or Instruction Trace reports.
Line 27: Line 27:
 
'''Note:''' This is only an example test automation and it can be adjusted to individual needs using the extensive scripting interface of Ozone. More information can be found in the Ozone user manual.
 
'''Note:''' This is only an example test automation and it can be adjusted to individual needs using the extensive scripting interface of Ozone. More information can be found in the Ozone user manual.
   
=Ozone dual core debugging example based on NXP LPC4350=
+
=Dual core debugging example based on NXP LPC4350=
   
 
This article describes how to setup dual core debugging with Ozone the J-Link debugger.
 
This article describes how to setup dual core debugging with Ozone the J-Link debugger.
Line 100: Line 100:
 
<pre>
 
<pre>
 
unsigned int PC;
 
unsigned int PC;
unsigned int CPSR;
 
 
 
 
PC = Elf.GetBaseAddr();
 
PC = Elf.GetBaseAddr();
Line 129: Line 128:
 
== Example project ==
 
== Example project ==
 
Example projects can be found for the following devices:
 
Example projects can be found for the following devices:
  +
*[https://wiki.segger.com/NRF52_Series_Devices#Sample_project Nordic Semiconductor nRF52]
  +
  +
=Watch window expression examples=
  +
The watch window is a powerful tool in Ozone that can not only be used to display static symbol information but the live update feature and support for expressions make it a great companion during debugging.
  +
  +
In most debug cases all symbol information is available so the symbol can directly be displayed with its name.
  +
However in some cases symbol information is not available and only addresses are known. Then the variable value can be displayed with an expression by only knowing the address location.
  +
The following example will showcase this. More information can be found in the Ozone user guide UM08025 in section Debugging with Ozone/Working With Expressions.
  +
  +
== Watch window example ==
  +
This example will show how to display an array by its symbol name, by only its address and via a pointer.
  +
  +
The array is defined as: static int _aCnt[10];
  +
  +
The used pointer is defined as: int* p;
  +
  +
Per default all values are initialized to 0. To display the values in _aCnt in the watch window the following expressions can be used:
  +
* _aCnt
  +
* (int[10])<_aCntAddress>
  +
* (int[10])p;
  +
  +
The resulting watch window will be as follows:
  +
  +
[[File:Ozone_Watch_Array.PNG]]

Revision as of 14:24, 12 March 2019

Automated test example

Ozone features an advanced Scripting interface which can be used for automated tests as well. A simple example of such a setup will be shown in the following article. This can then be used as baseline to e.g. export Code Profile or Instruction Trace reports.

Example Setup Requirements

For the automated test example that will be shown in this article the following minimum requirements must be met:

  • J-Link software V6.30h or later
  • Ozone V2.56f or later
  • Any J-Link/J-Trace model (Base or higher) that can be used with Ozone
  • SEGGER Cortex-M Trace Reference Board with a STM32F407 target device

Example project

The following sample project is designed to be used with J-Link/J-Trace and Ozone to demonstrate automation with Ozone. The project has been tested with the minimum requirements mentioned above and a Cortex-M Trace Reference Board. The sample project comes with a pre-configured project file for Ozone that runs out-of-the box. In order to rebuild the sample project, SEGGER Embedded Studio can be used. The example project can be downloaded here:

Ozone_Automation_Demo_ST_STM32F407.zip

The following steps will be executed in the example:

  1. Load test application
  2. Set a breakpoint
  3. Run to the breakpoint
  4. Execute a function that has been set to run when breakpoint is hit
  5. Close Ozone

Note: This is only an example test automation and it can be adjusted to individual needs using the extensive scripting interface of Ozone. More information can be found in the Ozone user manual.

Dual core debugging example based on NXP LPC4350

This article describes how to setup dual core debugging with Ozone the J-Link debugger.

Required soft- and hardware

The sample project has been tested with the following components:

  • J-Link
  • Arrow LPC-4350-DB1 Rev.B evaluation board
  • J-Link software version V6.32g or later
  • SEGGER Embedded Studio V3.40
  • Ozone V2.56s

Running the sample project

The Cortex-M4 simply sends a defined command to the Cortex-M0 using shared memory and waits for the response before it resumes execution. The Cortex-M0 waits for command reception from the Cortex-M4 and simply sends back a "received-response" using shared memory.

To run the sample project at first open the project Ozone_Multicore_LPC4350_CM4.jdebug with Ozone and start a debug session. Then open a second instance of Ozone with the project Ozone_Multicore_LPC4350_CM0.jdebug and start the debug session. Now you can independently run, halt and step both cores. Please note that starting the Cortex-M4 will issue a system reset and affect both cores, so the Cortex-M4 always has to be started before the Cortex-M0.

Included files

Filename Content
Readme.txt Readme file with instructions for debugging
LPC4350_CortexM0_SES\LPC4350_CortexM0_SES.emProject Cortex M0 core project file
LPC4350_CortexM0_SES\Src\* Cortex M0 core project source files
LPC4350_CortexM4_SES\LPC4350_CortexM4_SES.emProject Cortex M4 core project file
LPC4350_CortexM4_SES\Src\* Cortex M4 core project source files
Ozone_Multicore_LPC4350_CM0.jdebug Cortex M0 Ozone project
Ozone_Multicore_LPC4350_CM4.jdebug Cortex M4 Ozone project

NXP LPC4350 Embedded Studio Projects

LPC4350_DualCore_Debug_ES340_Ozone.zip

Start debug session with bootloader

Whenever a new project is created with Ozone, Ozone will assume that the .elf file you opened also points to the starting point of your application. This is usually the case. However should you have e.g. a bootloader that needs to be executed first the Ozone project must be edited accordingly.

How to

Each Ozone project is saved as a .jebug file. The Ozone project itself is written in a C-like scripting language and can be edited if needed. Per default functions AfterTargetDownload() and AfterTargetReset() will be populated with the following code lines for Cortex-M:

unsigned int SP;                                                
unsigned int PC;                                                
unsigned int VectorTableAddr;                                   
                                                                  
VectorTableAddr = Elf.GetBaseAddr();                            
                                                                 
if (VectorTableAddr == 0xFFFFFFFF) {                            
  Util.Log("Project file error: failed to get program base"); 
} else {                                                        
  SP = Target.ReadU32(VectorTableAddr);                         
  Target.SetReg("SP", SP);                                    
                                                                
  PC = Target.ReadU32(VectorTableAddr + 4);                     
  Target.SetReg("PC", PC);                                    
}

And the following for ARM or Cortex-A/R:

unsigned int PC; 
                                                                 
PC = Elf.GetBaseAddr();                                         
                                                                  
if (PC != 0xFFFFFFFF) {                                         
  Target.SetReg("PC", PC);                                    
} else {                                                        
  Util.Log("Project file error: failed to get program base"); 
}

Either way the PC will be set to a wrong position if first a bootloader needs to be executed. To counter this the .jdebug default values need to be edited as follows:

unsigned int SP;                            
unsigned int PC;                            
                                            
SP = Target.ReadU32(<SPLocation>);     
Target.SetReg("SP", SP);                
                                            
PC = Target.ReadU32(<PCLocation>);
Target.SetReg("PC", PC);   

Where <PCLocation> and <SPLocation> are the addresses (e.g. 0x00000000) where PC and SP are stored. For Cortex-M target this is usually at BootloaderBaseAddr + 0x0 for SP and BootloaderBaseAddr + 0x4 for PC.

Example project

Example projects can be found for the following devices:

Watch window expression examples

The watch window is a powerful tool in Ozone that can not only be used to display static symbol information but the live update feature and support for expressions make it a great companion during debugging.

In most debug cases all symbol information is available so the symbol can directly be displayed with its name. However in some cases symbol information is not available and only addresses are known. Then the variable value can be displayed with an expression by only knowing the address location. The following example will showcase this. More information can be found in the Ozone user guide UM08025 in section Debugging with Ozone/Working With Expressions.

Watch window example

This example will show how to display an array by its symbol name, by only its address and via a pointer.

The array is defined as: static int _aCnt[10];

The used pointer is defined as: int* p;

Per default all values are initialized to 0. To display the values in _aCnt in the watch window the following expressions can be used:

  • _aCnt
  • (int[10])<_aCntAddress>
  • (int[10])p;

The resulting watch window will be as follows:

Ozone Watch Array.PNG