Skip to content

Commit

Permalink
fix the SysTick_Handler pollute PMU overflow handler issue
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Feb 29, 2024
1 parent 3183431 commit 3a30d14
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
8 changes: 4 additions & 4 deletions GorgonMeducer.perf_counter.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
</RTE_Components_h>
</component>

<component Cclass="Utilities" Cversion="1.0.2" Cgroup="perf_counter" Csub="Porting" Cvariant="User Defined" isDefaultVariant="false" condition="perf_counter">
<component Cclass="Utilities" Cversion="1.0.3" Cgroup="perf_counter" Csub="Porting" Cvariant="User Defined" isDefaultVariant="false" condition="perf_counter">
<description>A user define system timer</description>
<files>
<file category="sourceC" name="template/perfc_port_user.c" attr="config" version="1.0.2"/>
Expand All @@ -332,15 +332,15 @@
</RTE_Components_h>

<Pre_Include_Global_h>

#define __PERFC_USE_PORTING__ 1
#define __PERFC_USE_USER_CUSTOM_PORTING__ 1
#define __PERFC_CFG_DISABLE_DEFAULT_SYSTICK_PORTING__ 1
#define __PERFC_CFG_PORTING_INCLUDE__ "perfc_port_user.h"

</Pre_Include_Global_h>
</component>

<component Cclass="Utilities" Cversion="1.1.0" Cgroup="perf_counter" Csub="Porting" Cvariant="PMU" isDefaultVariant="true" condition="PMU Devices">
<component Cclass="Utilities" Cversion="1.1.1" Cgroup="perf_counter" Csub="Porting" Cvariant="PMU" isDefaultVariant="true" condition="PMU Devices">
<description>Using the Performande Monitor Unit</description>
<files>
<file category="sourceC" name="perfc_port_pmu.c"/>
Expand All @@ -352,7 +352,7 @@
</RTE_Components_h>

<Pre_Include_Global_h>

#define __PERFC_USE_PORTING__ 1
#define __PERFC_USE_PMU_PORTING__ 1
#define __PERFC_CFG_DISABLE_DEFAULT_SYSTICK_PORTING__ 1
#define __PERFC_CFG_PORTING_INCLUDE__ "perfc_port_pmu.h"
Expand Down
6 changes: 5 additions & 1 deletion perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,17 @@ extern "C" {
__super_loop_monitor__()
#endif

#if defined(__PERF_COUNTER_CFG_USE_SYSTICK_WRAPPER__)
#if defined(__PERF_COUNTER_CFG_USE_SYSTICK_WRAPPER__) \
&& ( !defined(__PERFC_USE_PORTING__) \
|| (defined(__PERFC_USE_PORTING__) && (0 == __PERFC_USE_PORTING__)) )

# if defined(__IS_COMPILER_ARM_COMPILER_5__) && __IS_COMPILER_ARM_COMPILER_5__
# pragma import(__ensure_systick_wrapper)
# elif (defined(__GNUC__) || defined(__clang__)) \
&& (!defined(__IS_COMPILER_IAR__) || !__IS_COMPILER_IAR__)
__asm(".global __ensure_systick_wrapper\n\t");
# endif

#endif
/*! @} */

Expand Down
6 changes: 2 additions & 4 deletions systick_wrapper_gcc.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;/****************************************************************************
;* Copyright 2022 Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
;* Copyright 2024 Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
;* *
;* Licensed under the Apache License, Version 2.0 (the "License"); *
;* you may not use this file except in compliance with the License. *
Expand All @@ -15,7 +15,6 @@
;* *
;****************************************************************************/

#if !__PERFC_CFG_DISABLE_DEFAULT_SYSTICK_PORTING__
.syntax unified
.arch armv6-m

Expand All @@ -42,5 +41,4 @@ __wrap_SysTick_Handler:
.type __ensure_systick_wrapper, %function

__ensure_systick_wrapper:
bx lr
#endif
bx lr
13 changes: 2 additions & 11 deletions systick_wrapper_gnu.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;/****************************************************************************
;* Copyright 2022 Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
;* Copyright 2024 Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
;* *
;* Licensed under the Apache License, Version 2.0 (the "License"); *
;* you may not use this file except in compliance with the License. *
Expand All @@ -14,13 +14,7 @@
;* limitations under the License. *
;* *
;****************************************************************************/
#if defined(_RTE_)
# include "RTE_Components.h"
#endif

#if !defined(__RTE_PERFC_PORTING_USER_DEFINED__) && !defined(__RTE_PERFC_PORTING_PMU__)

#if !__PERFC_CFG_DISABLE_DEFAULT_SYSTICK_PORTING__
.syntax unified
.arch armv6-m

Expand All @@ -47,7 +41,4 @@ $Sub$$SysTick_Handler:
.type __ensure_systick_wrapper, %function

__ensure_systick_wrapper:
bx lr
#endif

#endif
bx lr

0 comments on commit 3a30d14

Please sign in to comment.