Task State and ISR Profiling via Instrumentation
In this topic:
•Enable ORTI and OS Timing-Hooks
•Instrument and Generate XML using iTCHi
Task state and ISR profiling via instrumentation utilizes the Vector OS Timing Hooks to instrument task states and ISR executions. This approach provides detailed insights into the system’s behavior by capturing task state transitions and ISR events. This method involves the following steps:
Enabling in DaVinci Configurator: |
a.ORTI file generation
b.OS Timing Hooks generation
Configuring iTCHi to generate instrumentation code and XML file. |
iTCHi is a program that helps users configure the winIDEA Analyzer to record OS and RTE aware hardware traces. You can find the Windows 64-bit executable itchi-bin.exe in the scripts/itchi directory of your winIDEA installation. A graphical-user interface is also available. To launch it, navigate to the OS tab under the Application settings in winIDEA. There, use the iTCHi Wizard button to launch the GUI. Note that the GUI is not necessarily self-explanatory and you probably want to continue reading this document.
You can find more information via iTCHi Readme.
Recompiling the application with the generated instrumentation code. |
Configuring winIDEA to analyze the trace data using the generated XML file. |
Configuring hardware tracing to record the instrumentation variables. |
Vector Task State Instrumentation Workflow
For OS Task and ISR profiling via instrumentation, you need to enable ORTI file generation and the OS Timing Hooks in your Vector MICROSAR project. Follow these steps:
In DaVinci Configurator, open the Basic Editor. |
In the Basic Editor, expand the OS node. |
Navigate to the OsOS node and select the OsDebug node. |
Activate ORTI Debug Support by selecting ORTI_23_STANDARD or ORTI_23_ADDITIONAL. |
In the OsDebug view, locate the Timing Hooks Include Header setting. |
Add a new header by clicking the plus symbol and name it Os_TimingHooks_isystem.h. |
Regenerate the OS. |
This process generates the OS ORTI file. After generating the OS, you should find a file Os_Trace.ORT in your Appl/GenData directory. It also enables the OS Timing Hooks, which can now be implemented in the specified header file.
To implement the OS hooks and generate the respective Profiler XML, follow these steps:
In the iTCHi wizard, make sure your itchi.json file is selected or create a new one if necessary. |
Ensure your ORTI file and Profiler XML file are specified correctly. |
Select the Task State analysis technique. |
Choose task_state_instrumentation_microsar as the command and press Next. |
Under task_state_inst_microsar, configure the OS instrumentation header and source file. |
a.Point vector_os_timing_hooks_h to the Appl/Include directory of your project.
b.Point vector_os_timing_hooks_c to the Appl/Source directory of your project.
c.Leave the filenames as they are, so the string for the header file would be:
<your_davinci_dir>/Appl/Include/Os_TimingHooks_isystem.h |
Depending on your microcontroller, pick the right instrumentation_type. |
Refer to section Trace Configuration for more information.
•In most cases, data_trace is the best approach.
•For RH850 controllers without data trace capabilities, select software_trace.
oIn this case, also change the sft_dbpush_register to 10.
•For devices that have STM, select stm_trace.
oIn this case, also configure stm_base_address and stm_channel.
oNote that the STM base address is device-specific.
Unselect software_based_coreid_gen. |
This allows the winIDEA analyzer to get the core ID from the trace and usually works best.
Click Generate to create the instrumentation and XML file. |
The process has generated the Os_TimingHooks_isystem.c and Os_TimingHooks_isystem.h source files, as well as the Profiler XML file. These files are now ready to be integrated into your project.
After generating the Profiler XML and instrumentation code, it’s necessary to add the C and H files to the build process of your Vector MICROSAR application.
Copy the generated files to Appl\Source and Appl\Include directory in your project. |
(If you did not generate them to those locations already.)
•Os_TimingHooks_isystem.c
•Os_TimingHooks_isystem.h
Adding Os_TimingHooks_isystem.c is only required for data_trace as it contains the definition of the trace variable. |
When using an Infineon AURIX with multiple cores, edit Os_TimingHooks_isystem.h to map the trace variable into global LMU RAM. There is a comment in the source file that explains how to do that.
Add Os_TimingHooks_isystem.c to one of the makefiles. |
Include the following line in the appropriate section of the makefile:
a.APP_SOURCE_LST += Source\Os_TimingHooks_isystem.c
b.Again, this is only required for data_trace.
Build your application. |
Open a command prompt in the build directory, and execute the following command: .\m.bat
Once the build has finished, download the instrumented application via winIDEA. For data tracing, add the isystem_trace variable to a Watch Window and confirm that it changes when you enable real-time updates. For instrumentation tracing, this step does not apply.
To configure winIDEA to use the generated Profiler XML file, follow these steps:
In winIDEA, navigate to Debug / Configure Session / Applications. |
Configure AUTOSAR. |
Perform a Download or Load Symbols action to apply the changes. |
After configuring the XML for Task State and ISR profiling, you can now use the winIDEA Analyzer to record and profile the instrumentation data.
Create a new Automatic Trace Configuration. |
Enable OS Objects and Threads under OS Objects. |
(recommended) For multi-core systems, change the Context analysis to Core via Advanced button. |
Some architectures might require manual hardware trigger configuration. If you don’t see any data, manually configure the hardware trace to record the isystem_trace variable. Also, check that you have configured the correct Analyzer cycle duration. |
Start the Analyzer session. |
If everything is set up correctly, you should see a trace like the one shown below.
If you don’t see any data or the data does not look plausible, please check the Knowledge Base. |