improve compatability

This commit is contained in:
Gabriel Wang 2021-12-20 19:34:01 +00:00
parent a08e7d97de
commit 3c85e0cb0b
4 changed files with 52 additions and 16 deletions

View File

@ -81,10 +81,9 @@
<require Cclass="CMSIS" Cgroup="CORE"/>
</condition>
<condition id="CMSIS-RTOS2-RTX5">
<description>Require CMSIS-RTOS2-RTX5 Support</description>
<require Cclass="CMSIS" Cgroup="CORE"/>
<require Cclass="CMSIS" Cgroup="RTOS2 (API)" Csub="Keil RTX5">
<condition id="RTX5">
<description>Require RTX5 Support</description>
<accept Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Source"/>
</condition>
<condition id="Cortex-M Arm GCC">
@ -150,7 +149,6 @@
<file category="header" name="lib/perf_counter.h"/>
<file category="library" name="lib/perf_counter.lib" condition="Cortex-M Arm Compiler"/>
<file category="library" name="lib/libperf_counter_gcc.a" condition="Cortex-M Arm GCC"/>
<file category="source" name="lib/perf_os_patch_rtx5.c" condition="CMSIS-RTOS2-RTX5"/>
</files>
</component>
@ -161,7 +159,13 @@
<file category="source" name="perf_counter.c" />
<file category="source" name="systick_wrapper_ual.s" condition="Cortex-M Arm Compiler CMSIS-CORE"/>
<file category="source" name="systick_wrapper_gcc.s" condition="Cortex-M Arm GCC CMSIS-CORE"/>
<file category="source" name="lib/perf_os_patch_rtx5.c" condition="CMSIS-RTOS2-RTX5"/>
</files>
</component>
<component Cclass="Utilities" Cgroup="Performance" Csub="RTX5 Patch" Cversion="1.7.0" condition="RTX5">
<description>A Patch for RTX5</description>
<files>
<file category="source" name="lib/perf_os_patch_rtx5.c"/>
</files>
</component>
</components>

View File

@ -138,6 +138,9 @@ fi
# pdsc file is mandatory in base directory:
cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc ${PACK_BUILD}
cp -f ./perf_os_patch_rtx5.c ./lib
cp -f ./perf_counter.h ./lib
# directories
echo Adding directories to pack:
echo $PACK_DIRS
@ -156,6 +159,8 @@ do
cp -f "$f" $PACK_BUILD/
done
# Run Schema Check (for Linux only):
# sudo apt-get install libxml2-utils
@ -200,8 +205,7 @@ if [ $errorlevel -ne 0 ]; then
fi
cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc ${PACK_WAREHOUSE}
cp -f ./perf_os_patch_rtx5.c ./lib
cp -f ./perf_counter.h ./lib
echo "build of pack succeeded"
# Clean up

View File

@ -21,6 +21,8 @@
#include "rtx_os.h"
#include "perf_counter.h"
#include "cmsis_compiler.h"
#include "rtx_evr.h" // RTX Event Recorder definitions
/*============================ MACROS ========================================*/
@ -53,11 +55,10 @@ struct __task_cycle_info_t {
/*============================ IMPLEMENTATION ================================*/
__attribute__((used))
/*! \brief wrapper function for rtos context switching */
void WRAP_FUNC(osRtxThreadSwitch) (osRtxThread_t *thread)
void __on_context_switch (osRtxThread_t *thread)
{
extern void ORIG_FUNC(osRtxThreadSwitch) (osRtxThread_t *thread);
//assert(NULL != ptThread);
do {
@ -88,8 +89,21 @@ void WRAP_FUNC(osRtxThreadSwitch) (osRtxThread_t *thread)
ptFrame->dwLastTimeStamp = dwTimeStamp;
ptFrame->tInfo.wActiveCount++;
} while(0);
}
__attribute__((used))
void EvrRtxThreadSwitched (osThreadId_t thread_id)
{
__on_context_switch((osRtxThread_t *)thread_id);
ORIG_FUNC(osRtxThreadSwitch)(thread);
#if defined(RTE_Compiler_EventRecorder)
# define EvtRtxThreadSwitched \
EventID(EventLevelOp, EvtRtxThreadNo, 0x19U)
(void)EventRecord2(EvtRtxThreadSwitched, (uint32_t)thread_id, 0U);
#else
(void)thread_id;
#endif
}

View File

@ -21,6 +21,8 @@
#include "rtx_os.h"
#include "perf_counter.h"
#include "cmsis_compiler.h"
#include "rtx_evr.h" // RTX Event Recorder definitions
/*============================ MACROS ========================================*/
@ -53,11 +55,10 @@ struct __task_cycle_info_t {
/*============================ IMPLEMENTATION ================================*/
__attribute__((used))
/*! \brief wrapper function for rtos context switching */
void WRAP_FUNC(osRtxThreadSwitch) (osRtxThread_t *thread)
void __on_context_switch (osRtxThread_t *thread)
{
extern void ORIG_FUNC(osRtxThreadSwitch) (osRtxThread_t *thread);
//assert(NULL != ptThread);
do {
@ -88,8 +89,21 @@ void WRAP_FUNC(osRtxThreadSwitch) (osRtxThread_t *thread)
ptFrame->dwLastTimeStamp = dwTimeStamp;
ptFrame->tInfo.wActiveCount++;
} while(0);
}
__attribute__((used))
void EvrRtxThreadSwitched (osThreadId_t thread_id)
{
__on_context_switch((osRtxThread_t *)thread_id);
ORIG_FUNC(osRtxThreadSwitch)(thread);
#if defined(RTE_Compiler_EventRecorder)
# define EvtRtxThreadSwitched \
EventID(EventLevelOp, EvtRtxThreadNo, 0x19U)
(void)EventRecord2(EvtRtxThreadSwitched, (uint32_t)thread_id, 0U);
#else
(void)thread_id;
#endif
}