This document holds information about how S32 Design Studio and S32Debugger probe or PE Micro Debug probe can be used to debug applications running on NXP’s S32 family processors from the operating system perspective using FreeRTOS Kernel awareness.
Abbreviation |
Description |
RTOS |
Real Time Operating System |
RTD |
Real-Time Drivers |
FreeRTOS is a market-leading open-source RTOS designed for microcontrollers and small microprocessors. It includes a kernel and a growing set of libraries.
In S32 Design Studio, FreeRTOS Kernel awareness allows you to debug your application from the operating system perspective.
FreeRTOS OS Awareness support in S32 Design Studio is available for:
-S32R45 (Cortex-M7)
OSEK OS Awareness support is available only on Windows.
The FreeRTOS download includes source code for every processor port, and every demo application. Currently, FreeRTOS support is available only for single-core projects.
The core RTOS code is contained in three files, which are called tasks.c, queue.c and list.c. These three files are in the FreeRTOS/Source directory. The same directory contains two optional files called timers.c and croutine.c which implement software timer and co-routine functionality respectively. Each supported processor architecture requires a small amount of architecture specific RTOS code. This is the RTOS portable layer, and it is located in the FreeRTOS/Source/Portable/[compiler]/[architecture] sub directories, where [compiler] and [architecture] are the compiler used to create the port, and the architecture on which the port runs, respectively.
The basic workflow for setting up and managing FreeRTOS OS Awareness projects in S32 Design Studio remains consistent, irrespective of the debug probe used. The universal steps are described in “How to use FreeRTOS OS Awareness with S32 Design Studio and S32Debugger probe” section. For FreeRTOS OS Awareness projects utilizing PE Micro debug probe, only the specific considerations will be highlighted.
Note: This HOWTo Guide describes the required steps for using FreeRTOS on a single-core example project for S32G399A Cortex-M7 in S32 Design Studio. Prerequisites might differ depending on the project hardware type.
Supported boards
Connections
Debugger
While in Design Studio, go to File -> New -> S32DS Project From Example and select one of the existing single core S32 Design Studio Sample applications delivered with the NXP FreeRTOS or import your own S32 Design Studio project.
Select the desired project from the list of examples and click finish
Before running the example a configuration needs to be generated. First go to Project Explorer View in S32 Design Studio and right-click the current project.
Select the "S32 Configuration Tool" menu then click on the desired configuration tool (Pins, Clocks, Peripherals etc...).
Clicking on any one of those will generate all the components. Make the desired changes (if any) then click on the "S32 Configuration Tool → Update Code" button.
Select the project in the S32 Design Studio Workspace and click on Build. Clicking this button will start the build using the preset build type.
Click on Debug Configurations
Setup the Debug Probe Connection for the project. Select either USB or Ethernet, depending upon your hardware setup. If USB is selected, the COM port for the S32 Debug Probe will automatically be detected (unless not connected or more than one probe is connected). If Ethernet is selected, then enter either the hostname (fsl + last 6 digits of MAC address) or IP address. See
‘S32_Debug_Probe_User_Guide.pdf’
({S32DS_installation_directory}/S32DS/tools/S32Debugger/Debugger/Docs/S32_Debug_Probe_User_Guid e.pdf) for more details on the setup of the S32 Debug Probe.
From the OS Awareness tab select “FreeRTOS” from the OS dropdown list and click Debug.
Navigate to go to Window -> Show View -> Other… and select the FreeRTOS view
Using the Heap Usage, Queue List, Task List and Timer list views, Design Studio can display information about the tasks status on the target.
Queues are the primary form of inter-task communications. They can be used to send messages between tasks, and between interrupts and tasks. In most cases they are used as thread safe FIFO (First In First Out) buffers with new data being sent to the back of the queue, although data can also be sent to the front.
A real time application that uses an RTOS can be structured as a set of independent tasks. Each task executes within its own context with no coincidental dependency on other tasks within the system or the RTOS scheduler itself
A software timer (or just a 'timer') allows a function to be executed at a set time in the future. The function executed by the timer is called the timer's callback function. The time between a timer being started, and its callback function being executed, is called the timer's period. Put simply, the timer's callback function is executed when the timer's period expires.
Note, a software timer must be explicitly created before it can be used.
Note: This HOWTo Guide describes the required steps for using FreeRTOS on a single-core example project for S32K396 Cortex-M7 in S32 Design Studio. Prerequisites might differ depending on the project hardware type.
Go to File -> New -> S32DS Project From Example
Select the desired project from the list of examples delivered with PE Micro Debug probe support or import your own S32 Design Studio project and click finish
Please refer to the steps described in the “Generating configuration” section from “How to use FreeRTOS OS Awareness with S32 Design Studio and S32Debugger probe”.
Select the project in the S32 Design Studio Workspace and click on Build. Clicking this button will start the build using the preset build type.
Click on Debug Configurations.
Select the debug configuration associated with your current build configuration and click on the “PEmicro Debugger” tab. Verify proper interface and port and if the device is properly detected.
From the OS Awareness tab select “FreeRTOS” from the OS dropdown list and click Debug.
Navigate to go to Window -> Show View -> Other… and select the FreeRTOS view
Using the Heap Usage, Queue List, Task List and Timer list views, Design Studio can display information about the tasks status on the target.
Further details can be found in the “FreeRTOS views” section from “How to use FreeRTOS OS Awareness with S32 Design Studio and S32Debugger probe”
Revision history:
Revision no. |
Revision date |
Description |
01 |
Nov 2023 |
Created document about how to use FreeRTOS OS Awareness in S32 Design Studio with PE Micro and S32 Debug probes |