Integration Guide For Cesium RTOS
Cesium RTOS provides developers with extensive trace capabilities for monitoring the creation, use, and deletion of tasks and kernel objects. Taking advantage of these capabilities requires that a suitable trace recorder be added to your project. For a seamless experience, Cesium RTOS has been redesigned to support Percepio Tracealyzer® out-of-the-box. This guide will walk you through the steps involved in integrating this powerful tool into your Cesium-based products.
Cs/OS3
For projects using the Cesium Cs/OS3 kernel, verify that you are using v3.09.04 or later.
- Download Weston Embedded's fork of the TraceRecorder repository.
- Copy the .c/.h files from the following folders to your Build. The streamport you choose will depend on your debug environment; in this example we use are using the Jlink_RTT port.
\
\include
\kernelports\Cs-OS3
\kernelports\Cs-OS3\include
\streamports\<*>
\streamports\<*>\include
- Copy the configuration files from the following folders to your application's central config folder.
\config
\kernelports\Cs-OS3\config
\streamports\<*>\config
- Add the appropriate include paths to your preprocessor configuration.

- Modify os_cfg.h to enable kernel tracing by setting OS_CFG_TRACE_EN to 1.

- You may choose to enable Enter and Exit trace points by setting OS_CFG_TRACE_API_ENTER_EN and OS_CFG_TRACE_API_EXIT_EN to 1 respectively.
This will add additional context to your traces, but may overwhelm some debuggers when using streaming trace.
- You may choose to enable Enter and Exit trace points by setting OS_CFG_TRACE_API_ENTER_EN and OS_CFG_TRACE_API_EXIT_EN to 1 respectively.
- In trcConfig.h set TRC_CFG_HARDWARE_PORT to the architecture used. For some hardware ports you need to #include the processor header file by replacing the row #error "Trace Recorder: Please include your processor's header file here and remove this line.". If the error line is removed and your project compiles, the header file isn’t needed. All available hardware ports can be found at the bottom of trcDefines.h.

- In trcKernelPortConfig.h, make sure TRC_CFG_CPU_CLOCK_HZ is set to the CPU clock frequency in Hz and TRC_CFG_USE_TRACEALYZER_RECORDER is set to 1.

- In your application code, insert a call to OS_TRACE_INIT() before the call to OSInit().

- Place a call to OS_TRACE_START() at the point which you wish to start recording trace events. For streaming trace, this is all you need to do.
However, if you use the RingBuffer streamport to take snapshot traces you must include a call to OS_TRACE_STOP() where you wish the snapshot to conclude.
- In certain situations, you may wish to pass an option to the Trace Start function to control when and how tracing begins. You may do so using the native Trace API instead of OS_TRACE_START().

Cs/OS2
For projects using the Cesium Cs/OS2 kernel, verify that you are using v2.93.07 or later.
- Download Weston Embedded's fork of the TraceRecorder repository.
- Copy the .c/.h files from the following folders to your Build. The streamport you choose will depend on your debug environment; in this example we use are using the Jlink_RTT port.
\
\include
\kernelports\Cs-OS2
\kernelports\Cs-OS2\include
\streamports\<*>
\streamports\<*>\include
- Copy the configuration files from the following folders to your application's central config folder.
\config
\kernelports\Cs-OS2\config
\streamports\<*>\config
- Add the appropriate include paths to your preprocessor configuration.

- Modify os_cfg.h to enable kernel tracing by setting OS_TRACE_EN to 1.

- You may choose to enable Enter and Exit trace points by setting OS_TRACE_API_ENTER_EN and OS_TRACE_API_EXIT_EN to 1 respectively.
This will add additional context to your traces, but may overwhelm some debuggers when using streaming trace.
- You may choose to enable Enter and Exit trace points by setting OS_TRACE_API_ENTER_EN and OS_TRACE_API_EXIT_EN to 1 respectively.
- In trcConfig.h set TRC_CFG_HARDWARE_PORT to the architecture used. For some hardware ports you need to #include the processor header file by replacing the row #error "Trace Recorder: Please include your processor's header file here and remove this line.". If the error line is removed and your project compiles, the header file isn’t needed. All available hardware ports can be found at the bottom of trcDefines.h.

- In trcKernelPortConfig.h, make sure TRC_CFG_CPU_CLOCK_HZ is set to the CPU clock frequency in Hz and TRC_CFG_USE_TRACEALYZER_RECORDER is set to 1.

- In your application code, insert a call to OS_TRACE_INIT() before the call to OSInit().

- Place a call to OS_TRACE_START() at the point which you wish to start recording trace events. For streaming trace, this is all you need to do.
However, if you use the RingBuffer streamport to take snapshot traces you must include a call to OS_TRACE_STOP() where you wish the snapshot to conclude.
- In certain situations, you may wish to pass an option to the Trace Start function to control when and how tracing begins. You may do so using the native Trace API instead of OS_TRACE_START().

