The NXP device S32R41 has accelerators that can be programmed. The S32 Debugger included within the S32 Design Studio for S32 Platform IDE with the S32 Debug Probe provides the ability to debug these accelerators. The accelerator covered in this document: Signal Processing Toolbox (SPT).
Section map:
Preparation
Setup the software tools
Setup the hardware
Procedure
Create A New Debug Configuration
Start A Debug Session
Multi-Core
Preparation
- Setup the software tools
- Install S32 Design Studio for S32 Platform
- Install the S32R41 development package and the Radar extension package for S32R41. Both of these are required for the SPT3.5 accelerator.
- Setup the hardware
- Confirm the setup of the S32R41 evaluation board.
- Connect the power supply cable
- Setup the S32 Debug Probe. Refer to the S32 Debug Probe User Guide for installation instructions.
- Connect the S32 Debug Probe to the evaluation board via JTAG cable.
- Connect the S32 Debug Probe to the host PC via USB cable OR via Ethernet cable (via LAN or directly connected and configured for static IP address) and power supply connected to USB port.
- Launch S32 Design Studio for S32 Platform
- Open existing project or create a new project and check that it successfully builds. If creating a new project, be sure the S32 Debugger is selected in the New Project Wizard.
Procedure
The procedure for starting a debug session and accessing the associated accelerator-specific registers is detailed here.
Debugging SPT is only conducted through the multi-core method. The SPT executable is included within A53 executable, the A53 application loads the SPT executable to the SPT core and both A53 and SPT core are available for debugging. The debug connection is made to the two cores through the Baremetal/Bareboard method. The debugger connects to both the A53 and SPT cores using the probe over JTAG.
Before a debug session can be started a debug configuration must exist.
Create A New Debug Configuration
If the New Project Wizard was used to create the project using the S32DS Application Project option, then there was an opportunity to select the desired debugger from within the wizard. If the desired debugger option was selected at this time, then the needed configuration already exists and will only require adjustments to the hardware connection settings.
If the New Project Wizard was not used to create the project OR the currently desired debugger was not the one selected at the time of project creation, a new debug configuration must be created.
- With the existing project selected in Project Explorer, open the Debug Configurations Menu: Run -> Debug Configurations
Having the existing project selected in the Project Explorer view will make the creation of a new launch configuration easier as many settings will be imported from the selected project. To select a project, click on it so it becomes highlighted.
- Next, select the debugger for which the new debug configuration will be created.
- To create the new configuration, either click on the ‘New launch configuration’ button from the toolbar at the top and to the left, or right-click on the ‘S32 Debugger’ and select ‘New Configuration’ from the menu.
- Once the configuration is created it will be displayed and any errors with the configuration will be shown. If the project was selected in the Project Explorer, then the Name of the debug configuration will contain the project’s name and the Project and C/C++ Application fields may be populated as well. The C/C++ Application field will only be populated if the build output executable exists. Confirm these values are correct before moving on. If the C/C++ Application field is empty, just click ‘Browse..’ button (The ‘Search Project…’ button is setup to identify standard executable file types, not the SPT’s ‘aspt’ file type) and navigate to the folder containing the build output <project name>.aspt. If you like, the tool already knows the project directory path, so you could shorten the path to start with from the ‘Debug’ folder, as shown here.
- There is an error showing that the Device core ID is not specified on the Debugger tab. Switch to the Debugger tab and click on the button ‘Select device and core’.
- From the Select Target Device and Core window, expand the listing until all cores are listed. Notice that all supported cores on the S32R41 are listed. Select the SPT35 core and click OK.
- Now that the device and core are selected, the attach script is selected automatically. The attach script will allow to start debugging on a core that is already initialized. This is correct for the SPT core as it is always launched in multicore scenario. Refer to the document 'README.txt' located in the same folder as these script files for details on all of the provided scripts.
- Confirm the setting of the ‘Initial core’ checkbox. This box should be checked within the debug configuration that establishes the first connection to the target device via S32 Debug Probe. When this box is checked, the Debug Probe Connection interface and GDB Server settings become available. The probe connection only needs to be configured once and only one GDB Server needs to be running for each debug session. When debugging the SPT3.5 core, the A53 core will always launch first, so this box should be checked for the A53 debug configuration and should not be checked for the SPT debug configuration.
- Check that the GDB Client section has the correct path to the SPT GDB executable. It should point to the variable ‘S32DS_R41_GDB_SPT_PATH’.
- Startup tab check the following settings
- Load image is NOT checked for multicore debugging. Basically, if it is loaded by A53 core (SPT executable is contained within A53 ELF file), then it does not need to be loaded.
- Load symbols is NOT checked. The SPT source file is assembly code, so there are no symbols to load.
- Set breakpoint at main and Resume are NOT checked for multicore debugging.
- After saving the new configuration with the ‘Apply’ button, SPT debugging can be performed.
Start A Debug Session
For convenience, the S32DS Application Project wizard was used to create a new project for demonstrating multi-core A53/SPT debugging. The SPT core does not support standalone debugging. For instructions on loading this example project to your workspace, see ‘HOWTO: S32 Design Studio - Create New Application Project’, selecting instead the Processor option Family S32R41 -> S32R41xxx Cortex-A53 SPT3 from the wizard menu.
A53 / SPT Multi-Core
For multi-core debugging, the A53 core is running an executable which also contains the SPT code. The A53 code will make a call into the SPT to load the SPT code to memory and to start the SPT execution. So the A53 must be started first. The EVB settings are irrelevant as the debugger will take control of the target via the JTAG connection.
- Before beginning the debug sessions, be sure each project is built clean.
- Start A53 debug. From the menu at the top, select Run -> Debug Configurations…
- In the Debug Configurations menu, from the configuration list, look for the ‘S32 Debugger’ group and select the A53 Debug_RAM configuration for the project to be debugged. In the case of our example, the ‘New_S32R41_SPT_Project_A53_Debug_RAM_S32Debug’ configuration.
- On the Debugger tab, check that the Debug Probe Connection settings match with the current hardware connection configuration for the S32 Debug Probe.
- Use the ‘Test connection’ button to confirm.
- Click Debug to start debugging on the A53 core.
- The debugger will launch and execute until the first executable line in main(). See Debugger tab in Debug Configurations menu to adjust this setting.
- Once the A53 debug session is running, advance the program counter to a line after the desired SPT kernel is loaded to memory but before the SPT kernel is launched. In the example here, this would be in ‘main.c’, line 57, where ‘StartSptProgram()’ function is called. This can be done by setting a breakpoint on the line and clicking Resume.
- After the breakpoint is reached, the SPT debug session can be started.
- Return to the Debug Configurations menu, select the SPT debug configuration. In the case of this example, ‘New_S32R41_SPT_Project_SPT35_Debug_S32Debug’, and click Debug.
- Wait for the SPT debug session to launch and stop in the disassembly. Use the Step Over command one time in the A53 debug thread to complete the SPT launch.
- Select the SPT debug thread to change the context of the Disassembly, Registers and etc.views.
Notice the SPT code is not loaded yet.
- Enable Instruction Stepping Mode and step one time. Notice the SPT code is now loaded.
- Now you can step through the assembly code, access registers, etc.