RTX5: added support for Event Recorder initialization and filter setup (RTOS can also be used as Event Recorder Time Stamp)
diff --git a/ARM.CMSIS.pdsc b/ARM.CMSIS.pdsc
index a4b31a0..d7d87cb 100644
--- a/ARM.CMSIS.pdsc
+++ b/ARM.CMSIS.pdsc
@@ -8,6 +8,10 @@
<url>http://www.keil.com/pack/</url>
<releases>
+ <release version="5.3.1-dev2">
+ CMSIS-RTOS2:
+ - RTX 5.4.0 (see revision history for details)
+ </release>
<release version="5.3.1-dev1">
CMSIS-Core(M): 5.1.2 (see revision history for details)
CMSIS-Core(A): 1.1.2 (see revision history for details)
@@ -2740,7 +2744,7 @@
</component>
<!-- CMSIS-RTOS Keil RTX5 component -->
- <component Cclass="CMSIS" Cgroup="RTOS" Csub="Keil RTX5" Cversion="5.3.1" Capiversion="1.0.0" condition="RTOS RTX5">
+ <component Cclass="CMSIS" Cgroup="RTOS" Csub="Keil RTX5" Cversion="5.4.0" Capiversion="1.0.0" condition="RTOS RTX5">
<description>CMSIS-RTOS RTX5 implementation for Cortex-M, SC000, and SC300</description>
<RTE_Components_h>
<!-- the following content goes into file 'RTE_Components.h' -->
@@ -2756,7 +2760,7 @@
</component>
<!-- CMSIS-RTOS2 Keil RTX5 component -->
- <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Library" Cversion="5.3.1" Capiversion="2.1.2" condition="RTOS2 RTX5 Lib">
+ <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Library" Cversion="5.4.0" Capiversion="2.1.2" condition="RTOS2 RTX5 Lib">
<description>CMSIS-RTOS2 RTX5 for Cortex-M, SC000, C300 and Armv8-M (Library)</description>
<RTE_Components_h>
<!-- the following content goes into file 'RTE_Components.h' -->
@@ -2771,7 +2775,7 @@
<file category="header" name="CMSIS/RTOS2/RTX/Include/rtx_os.h"/>
<!-- RTX configuration -->
- <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.3.0"/>
+ <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.4.0"/>
<file category="source" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.c" version="5.1.0"/>
<!-- RTX templates -->
@@ -2825,7 +2829,7 @@
<file category="library" condition="CM7_FP_LE_IAR" name="CMSIS/RTOS2/RTX/Library/IAR/RTX_CM4F.a" src="CMSIS/RTOS2/RTX/Source"/>
</files>
</component>
- <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Library_NS" Cversion="5.3.1" Capiversion="2.1.2" condition="RTOS2 RTX5 NS">
+ <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Library_NS" Cversion="5.4.0" Capiversion="2.1.2" condition="RTOS2 RTX5 NS">
<description>CMSIS-RTOS2 RTX5 for Armv8-M Non-Secure Domain (Library)</description>
<RTE_Components_h>
<!-- the following content goes into file 'RTE_Components.h' -->
@@ -2841,7 +2845,7 @@
<file category="header" name="CMSIS/RTOS2/RTX/Include/rtx_os.h"/>
<!-- RTX configuration -->
- <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.3.0"/>
+ <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.4.0"/>
<file category="source" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.c" version="5.1.0"/>
<!-- RTX templates -->
@@ -2876,7 +2880,7 @@
<file category="library" condition="ARMv8MML_FP_LE_GCC" name="CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMFN.a" src="CMSIS/RTOS2/RTX/Source"/>
</files>
</component>
- <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Source" Cversion="5.3.1" Capiversion="2.1.2" condition="RTOS2 RTX5">
+ <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Source" Cversion="5.4.0" Capiversion="2.1.2" condition="RTOS2 RTX5">
<description>CMSIS-RTOS2 RTX5 for Cortex-M, SC000, C300 and Armv8-M (Source)</description>
<RTE_Components_h>
<!-- the following content goes into file 'RTE_Components.h' -->
@@ -2892,7 +2896,7 @@
<file category="header" name="CMSIS/RTOS2/RTX/Include/rtx_os.h"/>
<!-- RTX configuration -->
- <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.3.0"/>
+ <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.4.0"/>
<file category="source" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.c" version="5.1.0"/>
<!-- RTX templates -->
@@ -2965,7 +2969,7 @@
<file category="source" name="CMSIS/RTOS2/Source/os_systick.c"/>
</files>
</component>
- <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Source" Cversion="5.3.1" Capiversion="2.1.2" condition="RTOS2 RTX5 v7-A">
+ <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Source" Cversion="5.4.0" Capiversion="2.1.2" condition="RTOS2 RTX5 v7-A">
<description>CMSIS-RTOS2 RTX5 for Armv7-A (Source)</description>
<RTE_Components_h>
<!-- the following content goes into file 'RTE_Components.h' -->
@@ -2981,7 +2985,7 @@
<file category="header" name="CMSIS/RTOS2/RTX/Include/rtx_os.h"/>
<!-- RTX configuration -->
- <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.3.0"/>
+ <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.4.0"/>
<file category="source" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.c" version="5.1.0"/>
<file category="source" attr="config" name="CMSIS/RTOS2/RTX/Config/handlers.c" version="5.1.0"/>
@@ -3022,7 +3026,7 @@
<file category="source" name="CMSIS/RTOS2/RTX/Source/IAR/irq_ca.s" condition="CA_IAR"/>
</files>
</component>
- <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Source_NS" Cversion="5.3.1" Capiversion="2.1.2" condition="RTOS2 RTX5 NS">
+ <component Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Source_NS" Cversion="5.4.0" Capiversion="2.1.2" condition="RTOS2 RTX5 NS">
<description>CMSIS-RTOS2 RTX5 for Armv8-M Non-Secure Domain (Source)</description>
<RTE_Components_h>
<!-- the following content goes into file 'RTE_Components.h' -->
@@ -3039,7 +3043,7 @@
<file category="header" name="CMSIS/RTOS2/RTX/Include/rtx_os.h"/>
<!-- RTX configuration -->
- <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.3.0"/>
+ <file category="header" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.h" version="5.4.0"/>
<file category="source" attr="config" name="CMSIS/RTOS2/RTX/Config/RTX_Config.c" version="5.1.0"/>
<!-- RTX templates -->
diff --git a/CMSIS/DoxyGen/RTOS2/src/history.txt b/CMSIS/DoxyGen/RTOS2/src/history.txt
index f809a05..abfee2b 100644
--- a/CMSIS/DoxyGen/RTOS2/src/history.txt
+++ b/CMSIS/DoxyGen/RTOS2/src/history.txt
@@ -92,8 +92,10 @@
<th>Description</th>
</tr>
<tr>
- <td>V5.3.1</td>
+ <td>V5.4.0</td>
<td>
+ - Added support for Event Recorder initialization and filter setup.
+ - Added support to use RTOS as Event Recorder Time Stamp source.
- Fixed optimization issue when using GCC optimization level 3.
- Fixed osMemoryPoolAlloc to avoid potential race condition.
- Minor code optimizations (removed unnecessary checks).
diff --git a/CMSIS/RTOS2/RTX/Config/RTX_Config.h b/CMSIS/RTOS2/RTX/Config/RTX_Config.h
index 4ba2de8..2366e2d 100644
--- a/CMSIS/RTOS2/RTX/Config/RTX_Config.h
+++ b/CMSIS/RTOS2/RTX/Config/RTX_Config.h
@@ -17,7 +17,7 @@
*
* -----------------------------------------------------------------------------
*
- * $Revision: V5.3.0
+ * $Revision: V5.4.0
*
* Project: CMSIS-RTOS RTX
* Title: RTX Configuration definitions
@@ -40,9 +40,9 @@
// <h>System Configuration
// =======================
-// <o>Global Dynamic Memory size [bytes] <0-1073741824:8>
-// <i> Defines the combined global dynamic memory size.
-// <i> Default: 4096
+// <o>Global Dynamic Memory size [bytes] <0-1073741824:8>
+// <i> Defines the combined global dynamic memory size.
+// <i> Default: 4096
#ifndef OS_DYNAMIC_MEM_SIZE
#define OS_DYNAMIC_MEM_SIZE 4096
#endif
@@ -79,67 +79,8 @@
#define OS_ISR_FIFO_QUEUE 16
#endif
-// <h>Event Recording
-// <i> Configures events recording.
-
-// <q>Memory Management
-// <i> Enables Memory Management events recording.
-#ifndef OS_EVR_MEMORY
-#define OS_EVR_MEMORY 1
-#endif
-
-// <q>Kernel
-// <i> Enables Kernel events recording.
-#ifndef OS_EVR_KERNEL
-#define OS_EVR_KERNEL 1
-#endif
-
-// <q>Thread
-// <i> Enables Thread events recording.
-#ifndef OS_EVR_THREAD
-#define OS_EVR_THREAD 1
-#endif
-
-// <q>Timer
-// <i> Enables Timer events recording.
-#ifndef OS_EVR_TIMER
-#define OS_EVR_TIMER 1
-#endif
-
-// <q>Event Flags
-// <i> Enables Event Flags events recording.
-#ifndef OS_EVR_EVFLAGS
-#define OS_EVR_EVFLAGS 1
-#endif
-
-// <q>Mutex
-// <i> Enables Mutex events recording.
-#ifndef OS_EVR_MUTEX
-#define OS_EVR_MUTEX 1
-#endif
-
-// <q>Semaphore
-// <i> Enables Semaphore events recording.
-#ifndef OS_EVR_SEMAPHORE
-#define OS_EVR_SEMAPHORE 1
-#endif
-
-// <q>Memory Pool
-// <i> Enables Memory Pool events recording.
-#ifndef OS_EVR_MEMPOOL
-#define OS_EVR_MEMPOOL 1
-#endif
-
-// <q>Message Queue
-// <i> Enables Message Queue events recording.
-#ifndef OS_EVR_MSGQUEUE
-#define OS_EVR_MSGQUEUE 1
-#endif
-
-// </h>
-
// <q>Object Memory usage counters
-// <i> Enables object memory usage counters.
+// <i> Enables object memory usage counters (requires RTX source variant).
#ifndef OS_OBJ_MEM_USAGE
#define OS_OBJ_MEM_USAGE 0
#endif
@@ -202,14 +143,14 @@
#endif
// <q>Stack overrun checking
-// <i> Enable stack overrun checks at thread switch.
+// <i> Enables stack overrun check at thread switch.
// <i> Enabling this option increases slightly the execution time of a thread switch.
#ifndef OS_STACK_CHECK
#define OS_STACK_CHECK 1
#endif
// <q>Stack usage watermark
-// <i> Initialize thread stack with watermark pattern for analyzing stack usage.
+// <i> Initializes thread stack with watermark pattern for analyzing stack usage.
// <i> Enabling this option increases significantly the execution time of thread creation.
#ifndef OS_STACK_WATERMARK
#define OS_STACK_WATERMARK 0
@@ -396,6 +337,199 @@
// </h>
+// <h>Event Recorder Configuration
+// ===============================
+
+// <e>Global Initialization
+// <i> Initialize Event Recorder during 'osKernelInitialize'.
+#ifndef OS_EVR_INIT
+#define OS_EVR_INIT 0
+#endif
+
+// <q>Start recording
+// <i> Start event recording after initialization.
+#ifndef OS_EVR_START
+#define OS_EVR_START 1
+#endif
+
+// <h>Global Event Filter Setup
+// <i> Initial event filter settings applied to all components.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_LEVEL
+#define OS_EVR_LEVEL 0x00U
+#endif
+
+// <h>RTOS Event Filter Setup
+// <i> Event filter settings for RTX components.
+
+// <e.7>Memory Management
+// <i> Filter enable settings for Memory Management events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </e>
+#ifndef OS_EVR_MEMORY_FILTER
+#define OS_EVR_MEMORY_FILTER 0x81U
+#endif
+
+// <e.7>Kernel
+// <i> Filter enable settings for Kernel events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </e>
+#ifndef OS_EVR_KERNEL_FILTER
+#define OS_EVR_KERNEL_FILTER 0x81U
+#endif
+
+// <e.7>Thread
+// <i> Filter enable settings for Thread events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </e>
+#ifndef OS_EVR_THREAD_FILTER
+#define OS_EVR_THREAD_FILTER 0x85U
+#endif
+
+// <e.7>Timer
+// <i> Filter enable settings for Timer events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </e>
+#ifndef OS_EVR_TIMER_FILTER
+#define OS_EVR_TIMER_FILTER 0x81U
+#endif
+
+// <e.7>Event Flags
+// <i> Filter enable settings for Event Flags events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </e>
+#ifndef OS_EVR_EVFLAGS_FILTER
+#define OS_EVR_EVFLAGS_FILTER 0x81U
+#endif
+
+// <e.7>Mutex
+// <i> Filter enable settings for Mutex events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </e>
+#ifndef OS_EVR_MUTEX_FILTER
+#define OS_EVR_MUTEX_FILTER 0x81U
+#endif
+
+// <e.7>Semaphore
+// <i> Filter enable settings for Semaphore events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </e>
+#ifndef OS_EVR_SEMAPHORE_FILTER
+#define OS_EVR_SEMAPHORE_FILTER 0x81U
+#endif
+
+// <e.7>Memory Pool
+// <i> Filter enable settings for Memory Pool events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </e>
+#ifndef OS_EVR_MEMPOOL_FILTER
+#define OS_EVR_MEMPOOL_FILTER 0x81U
+#endif
+
+// <e.7>Message Queue
+// <i> Filter enable settings for Message Queue events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </e>
+#ifndef OS_EVR_MSGQUEUE_FILTER
+#define OS_EVR_MSGQUEUE_FILTER 0x81U
+#endif
+
+// </h>
+
+// </e>
+
+// <h>RTOS Event Generation
+// <i> Enables event generation for RTX components (requires RTX source variant).
+
+// <q>Memory Management
+// <i> Enables Memory Management event generation.
+#ifndef OS_EVR_MEMORY
+#define OS_EVR_MEMORY 1
+#endif
+
+// <q>Kernel
+// <i> Enables Kernel event generation.
+#ifndef OS_EVR_KERNEL
+#define OS_EVR_KERNEL 1
+#endif
+
+// <q>Thread
+// <i> Enables Thread event generation.
+#ifndef OS_EVR_THREAD
+#define OS_EVR_THREAD 1
+#endif
+
+// <q>Timer
+// <i> Enables Timer event generation.
+#ifndef OS_EVR_TIMER
+#define OS_EVR_TIMER 1
+#endif
+
+// <q>Event Flags
+// <i> Enables Event Flags event generation.
+#ifndef OS_EVR_EVFLAGS
+#define OS_EVR_EVFLAGS 1
+#endif
+
+// <q>Mutex
+// <i> Enables Mutex event generation.
+#ifndef OS_EVR_MUTEX
+#define OS_EVR_MUTEX 1
+#endif
+
+// <q>Semaphore
+// <i> Enables Semaphore event generation.
+#ifndef OS_EVR_SEMAPHORE
+#define OS_EVR_SEMAPHORE 1
+#endif
+
+// <q>Memory Pool
+// <i> Enables Memory Pool event generation.
+#ifndef OS_EVR_MEMPOOL
+#define OS_EVR_MEMPOOL 1
+#endif
+
+// <q>Message Queue
+// <i> Enables Message Queue event generation.
+#ifndef OS_EVR_MSGQUEUE
+#define OS_EVR_MSGQUEUE 1
+#endif
+
+// </h>
+
+// </h>
+
// Number of Threads which use standard C/C++ library libspace
// (when thread specific memory allocation is not used).
#if (OS_THREAD_OBJ_MEM == 0)
diff --git a/CMSIS/RTOS2/RTX/Include/rtx_evr.h b/CMSIS/RTOS2/RTX/Include/rtx_evr.h
index b70991e..42dd5d9 100644
--- a/CMSIS/RTOS2/RTX/Include/rtx_evr.h
+++ b/CMSIS/RTOS2/RTX/Include/rtx_evr.h
@@ -30,6 +30,25 @@
#include "RTX_Config.h" // RTX Configuration
#include "rtx_os.h" // RTX OS definitions
+#include "RTE_Components.h"
+#ifdef RTE_Compiler_EventRecorder
+#include "EventRecorder.h"
+#include "EventRecorderConf.h"
+#if ((defined(OS_EVR_INIT) && (OS_EVR_INIT != 0)) || (EVENT_TIMESTAMP_SOURCE == 2))
+#ifndef EVR_RTX_KERNEL_GET_STATE_DISABLE
+#define EVR_RTX_KERNEL_GET_STATE_DISABLE
+#endif
+#endif
+#if (EVENT_TIMESTAMP_SOURCE == 2)
+#ifndef EVR_RTX_KERNEL_GET_SYS_TIMER_COUNT_DISABLE
+#define EVR_RTX_KERNEL_GET_SYS_TIMER_COUNT_DISABLE
+#endif
+#ifndef EVR_RTX_KERNEL_GET_SYS_TIMER_FREQ_DISABLE
+#define EVR_RTX_KERNEL_GET_SYS_TIMER_FREQ_DISABLE
+#endif
+#endif
+#endif
+
/// Extended Status codes
#define osRtxErrorKernelNotReady (-7)
diff --git a/CMSIS/RTOS2/RTX/Include/rtx_os.h b/CMSIS/RTOS2/RTX/Include/rtx_os.h
index 0afbb41..05a4c44 100644
--- a/CMSIS/RTOS2/RTX/Include/rtx_os.h
+++ b/CMSIS/RTOS2/RTX/Include/rtx_os.h
@@ -38,8 +38,8 @@
/// Kernel Information
#define osRtxVersionAPI 20010002 ///< API version (2.1.2)
-#define osRtxVersionKernel 50030001 ///< Kernel version (5.3.1)
-#define osRtxKernelId "RTX V5.3.1" ///< Kernel identification string
+#define osRtxVersionKernel 50040000 ///< Kernel version (5.4.0)
+#define osRtxKernelId "RTX V5.4.0" ///< Kernel identification string
// ==== Common definitions ====
diff --git a/CMSIS/RTOS2/RTX/Source/rtx_evr.c b/CMSIS/RTOS2/RTX/Source/rtx_evr.c
index 4148efa..81f5eb6 100644
--- a/CMSIS/RTOS2/RTX/Source/rtx_evr.c
+++ b/CMSIS/RTOS2/RTX/Source/rtx_evr.c
@@ -27,16 +27,10 @@
#include "cmsis_compiler.h"
#include "rtx_evr.h" // RTX Event Recorder definitions
-#ifndef RTE_COMPONENTS_H
-#include "RTE_Components.h"
-#endif
-
#ifdef RTE_Compiler_EventRecorder
//lint -e923 -e9074 -e9078 -emacro((835,845),EventID) [MISRA Note 13]
-#include "EventRecorder.h" // Keil::Compiler:Event Recorder
-
/// RTOS component number
#define EvtRtxMemoryNo (0xF0U)
#define EvtRtxKernelNo (0xF1U)
@@ -171,8 +165,8 @@
#define EvtRtxMutexGetName EventID(EventLevelAPI, EvtRtxMutexNo, 0x04U)
#define EvtRtxMutexGetName_Detail EventID(EventLevelDetail, EvtRtxMutexNo, 0x05U)
#define EvtRtxMutexAcquire EventID(EventLevelAPI, EvtRtxMutexNo, 0x06U)
-#define EvtRtxMutexAcquirePending EventID(EventLevelError, EvtRtxMutexNo, 0x07U)
-#define EvtRtxMutexAcquireTimeout EventID(EventLevelError, EvtRtxMutexNo, 0x08U)
+#define EvtRtxMutexAcquirePending EventID(EventLevelOp, EvtRtxMutexNo, 0x07U)
+#define EvtRtxMutexAcquireTimeout EventID(EventLevelOp, EvtRtxMutexNo, 0x08U)
#define EvtRtxMutexAcquired EventID(EventLevelOp, EvtRtxMutexNo, 0x09U)
#define EvtRtxMutexNotAcquired EventID(EventLevelOp, EvtRtxMutexNo, 0x0AU)
#define EvtRtxMutexRelease EventID(EventLevelAPI, EvtRtxMutexNo, 0x0BU)
diff --git a/CMSIS/RTOS2/RTX/Source/rtx_kernel.c b/CMSIS/RTOS2/RTX/Source/rtx_kernel.c
index 21cbf73..4cdfa36 100644
--- a/CMSIS/RTOS2/RTX/Source/rtx_kernel.c
+++ b/CMSIS/RTOS2/RTX/Source/rtx_kernel.c
@@ -528,12 +528,23 @@
//lint --flb "Library End"
+// ==== Library functions ====
+
+/// RTOS Kernel Pre-Initialization Hook
+//lint -esym(759,osRtxKernelPreInit) "Prototype in header"
+//lint -esym(765,osRtxKernelPreInit) "Global scope (can be overridden)"
+//lint -esym(522,osRtxKernelPreInit) "Can be overridden (do not lack side-effects)"
+__WEAK void osRtxKernelPreInit (void) {
+}
+
+
// ==== Public API ====
/// Initialize the RTOS Kernel.
osStatus_t osKernelInitialize (void) {
osStatus_t status;
+ osRtxKernelPreInit();
EvrRtxKernelInitialize();
if (IsIrqMode() || IsIrqMasked()) {
EvrRtxKernelError((int32_t)osErrorISR);
diff --git a/CMSIS/RTOS2/RTX/Source/rtx_lib.c b/CMSIS/RTOS2/RTX/Source/rtx_lib.c
index b08b04d..e573877 100644
--- a/CMSIS/RTOS2/RTX/Source/rtx_lib.c
+++ b/CMSIS/RTOS2/RTX/Source/rtx_lib.c
@@ -27,6 +27,11 @@
#include "RTX_Config.h"
#include "rtx_os.h"
+#ifdef RTE_Compiler_EventRecorder
+#include "EventRecorder.h"
+#include "EventRecorderConf.h"
+#endif
+
// System Configuration
// ====================
@@ -106,8 +111,8 @@
// Stack overrun checking
#if (OS_STACK_CHECK == 0)
// Override library function
-void osRtxThreadStackCheck (void);
-void osRtxThreadStackCheck (void) {}
+extern void osRtxThreadStackCheck (void);
+ void osRtxThreadStackCheck (void) {}
#endif
@@ -347,6 +352,55 @@
#endif // (OS_MSGQUEUE_OBJ_MEM != 0)
+// Event Recorder Configuration
+// ============================
+
+#if (defined(OS_EVR_INIT) && (OS_EVR_INIT != 0))
+
+#if defined(RTE_Compiler_EventRecorder)
+
+// Event Recorder Initialize
+__STATIC_INLINE void evr_initialize (void) {
+
+ (void)EventRecorderInitialize(OS_EVR_LEVEL, (uint32_t)OS_EVR_START);
+
+#if ((OS_EVR_MEMORY_FILTER & 0x80U) != 0U)
+ (void)EventRecorderEnable(OS_EVR_MEMORY_FILTER & 0x0FU, 0xF0U, 0xF0U);
+#endif
+#if ((OS_EVR_KERNEL_FILTER & 0x80U) != 0U)
+ (void)EventRecorderEnable(OS_EVR_KERNEL_FILTER & 0x0FU, 0xF1U, 0xF1U);
+#endif
+#if ((OS_EVR_THREAD_FILTER & 0x80U) != 0U)
+ (void)EventRecorderEnable(OS_EVR_THREAD_FILTER & 0x0FU, 0xF2U, 0xF2U);
+#endif
+#if ((OS_EVR_TIMER_FILTER & 0x80U) != 0U)
+ (void)EventRecorderEnable(OS_EVR_TIMER_FILTER & 0x0FU, 0xF3U, 0xF3U);
+#endif
+#if ((OS_EVR_EVFLAGS_FILTER & 0x80U) != 0U)
+ (void)EventRecorderEnable(OS_EVR_EVFLAGS_FILTER & 0x0FU, 0xF4U, 0xF4U);
+#endif
+#if ((OS_EVR_MUTEX_FILTER & 0x80U) != 0U)
+ (void)EventRecorderEnable(OS_EVR_MUTEX_FILTER & 0x0FU, 0xF5U, 0xF5U);
+#endif
+#if ((OS_EVR_SEMAPHORE_FILTER & 0x80U) != 0U)
+ (void)EventRecorderEnable(OS_EVR_SEMAPHORE_FILTER & 0x0FU, 0xF6U, 0xF6U);
+#endif
+#if ((OS_EVR_MEMPOOL_FILTER & 0x80U) != 0U)
+ (void)EventRecorderEnable(OS_EVR_MEMPOOL_FILTER & 0x0FU, 0xF7U, 0xF7U);
+#endif
+#if ((OS_EVR_MSGQUEUE_FILTER & 0x80U) != 0U)
+ (void)EventRecorderEnable(OS_EVR_MSGQUEUE_FILTER & 0x0FU, 0xF8U, 0xF8U);
+#endif
+}
+
+#else
+#warning "Event Recorder cannot be initialized (Event Recorder component is not selected)!"
+#define evr_initialize()
+#endif
+
+#endif // (OS_EVR_INIT != 0)
+
+
// OS Configuration
// ================
@@ -607,6 +661,20 @@
#endif
+// OS Hooks
+// ========
+
+// RTOS Kernel Pre-Initialization Hook
+void osRtxKernelPreInit (void);
+void osRtxKernelPreInit (void) {
+#if (defined(OS_EVR_INIT) && (OS_EVR_INIT != 0))
+ if (osKernelGetState() == osKernelInactive) {
+ evr_initialize();
+ }
+#endif
+}
+
+
// C/C++ Standard Library Multithreading Interface
// ===============================================
diff --git a/CMSIS/RTOS2/RTX/Source/rtx_lib.h b/CMSIS/RTOS2/RTX/Source/rtx_lib.h
index 1fd876c..cd223ed 100644
--- a/CMSIS/RTOS2/RTX/Source/rtx_lib.h
+++ b/CMSIS/RTOS2/RTX/Source/rtx_lib.h
@@ -173,6 +173,9 @@
// ==== Library functions ====
+// Kernel Library functions
+extern void osRtxKernelPreInit (void);
+
// Thread Library functions
extern void osRtxThreadListPut (os_object_t *object, os_thread_t *thread);
extern os_thread_t *osRtxThreadListGet (os_object_t *object);
diff --git a/CMSIS/RTOS2/RTX/Source/rtx_thread.c b/CMSIS/RTOS2/RTX/Source/rtx_thread.c
index 6ffe19a..113cf4e 100644
--- a/CMSIS/RTOS2/RTX/Source/rtx_thread.c
+++ b/CMSIS/RTOS2/RTX/Source/rtx_thread.c
@@ -182,9 +182,16 @@
return thread;
}
+#if (!defined(EVR_RTX_DISABLE) && \
+ (((OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_WAIT_TIMEOUT_DISABLE)) || \
+ ((OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_ACQUIRE_TIMEOUT_DISABLE)) || \
+ ((OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_ACQUIRE_TIMEOUT_DISABLE)) || \
+ ((OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_ALLOC_TIMEOUT_DISABLE)) || \
+ ((OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_GET_TIMEOUT_DISABLE)) || \
+ ((OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_PUT_TIMEOUT_DISABLE))))
+
/// Retrieve Thread list root.
/// \param[in] thread thread object.
-#ifndef EVR_RTX_DISABLE
static void *osRtxThreadListRoot (os_thread_t *thread) {
os_thread_t *thread0;
@@ -194,6 +201,7 @@
}
return thread0;
}
+
#endif
/// Re-sort a Thread in linked Object list by Priority (Highest at Head).