Skip to content

Commit

Permalink
v2.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Oct 19, 2023
1 parent d9557b5 commit f6bf640
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 14 deletions.
8 changes: 7 additions & 1 deletion GorgonMeducer.perf_counter.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>

<releases>
<release date="2023-08-30" version="2.2.3" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.2.2.3.pack">
<release date="2023-10-19" version="2.2.4" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.2.2.4.pack">
- Add support for RT-Thread-nano
- Add an API for checking stack overflow
- Improve the support for the Arm Compiler 6.21
- Other minor updates
</release>
<release date="2023-08-30" version="2.2.3" url="https://github.com/GorgonMeducer/perf_counter/raw/5660b13ea30005e31fa713cb4e6c6d7dbe0bcaa3/cmsis-pack/GorgonMeducer.perf_counter.2.2.3.pack">
- Mitigate time-rolling-back issue when calling get_system_ticks in exception handlers that have higher priorities than the SysTick_Handler.
- Other minor updates
</release>
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# perf_counter (v2.2.4-dev)
# perf_counter (v2.2.4)
A dedicated performance counter for Cortex-M Systick. It shares the SysTick with users' original SysTick function(s) without interfering with it. This library will bring new functionalities, such as performance counter,` delay_us` and `clock()` service defined in `time.h`.

### Features:
Expand Down Expand Up @@ -31,7 +31,8 @@ A dedicated performance counter for Cortex-M Systick. It shares the SysTick with
- **Support both RTOS and bare-metal environments**
- Support SysTick Reconfiguration
- Support changing System Frequency

- **[new]** Support stack-overflow detection in RTOS environment via `perfc_check_task_stack_canary_safe()`

- **Utilities for C language enhancement**
- Macros to detect compilers, e.g. `__IS_COMPILER_ARM_COMPILER_6__`, `__IS_COMPILER_LLVM__` etc.
- Macro to create atomicity for specified code block, i.e. `__IRQ_SAFE{...}`
Expand Down
Binary file not shown.
8 changes: 7 additions & 1 deletion cmsis-pack/GorgonMeducer.perf_counter.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>

<releases>
<release date="2023-08-30" version="2.2.3" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.2.2.3.pack">
<release date="2023-10-19" version="2.2.4" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.2.2.4.pack">
- Add support for RT-Thread-nano
- Add an API for checking stack overflow
- Improve the support for the Arm Compiler 6.21
- Other minor updates
</release>
<release date="2023-08-30" version="2.2.3" url="https://github.com/GorgonMeducer/perf_counter/raw/5660b13ea30005e31fa713cb4e6c6d7dbe0bcaa3/cmsis-pack/GorgonMeducer.perf_counter.2.2.3.pack">
- Mitigate time-rolling-back issue when calling get_system_ticks in exception handlers that have higher priorities than the SysTick_Handler.
- Other minor updates
</release>
Expand Down
4 changes: 2 additions & 2 deletions cmsis-pack/GorgonMeducer.pidx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<index schemaVersion="1.0.0" xs:noNamespaceSchemaLocation="PackIndex.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<vendor>GorgonMeducer</vendor>
<url>https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/</url>
<timestamp>2023-06-12T08:36:00</timestamp>
<timestamp>2023-10-19T22:47:00</timestamp>
<pindex>
<pdsc url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/" vendor="GorgonMeducer" name="perf_counter" version="2.2.2"/>
<pdsc url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/" vendor="GorgonMeducer" name="perf_counter" version="2.2.4"/>
</pindex>
</index>
1 change: 1 addition & 0 deletions example/example.uvmpw
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<project>
<PathAndName>.\example.uvprojx</PathAndName>
<NodeIsActive>1</NodeIsActive>
<NodeIsExpanded>1</NodeIsExpanded>
</project>

<project>
Expand Down
6 changes: 3 additions & 3 deletions example/example.uvoptx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
Expand Down Expand Up @@ -297,7 +297,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
Expand Down
6 changes: 3 additions & 3 deletions example/gcc_example.uvoptx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
Expand Down Expand Up @@ -278,9 +278,9 @@
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
Expand Down
Binary file modified lib/libperf_counter_gcc.a
Binary file not shown.
9 changes: 8 additions & 1 deletion lib/perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern "C" {
#define __PERF_COUNTER_VER_MINOR__ 2
#define __PERF_COUNTER_VER_REVISE__ 4

#define __PERF_COUNTER_VER_STR__ "dev"
#define __PERF_COUNTER_VER_STR__ ""

#define __PER_COUNTER_VER__ (__PERF_COUNTER_VER_MAJOR__ * 10000ul \
+__PERF_COUNTER_VER_MINOR__ * 100ul \
Expand Down Expand Up @@ -722,6 +722,13 @@ bool __perfc_is_time_out(int64_t lPeriod, int64_t *plTimestamp, bool bAutoReload
*/
extern void init_task_cycle_counter(void);

/*! \brief check whether the task stack canary is safe or not
* \retval false likely to be a stack-overflow
* \retval true task stack is safe
*/
extern
bool perfc_check_task_stack_canary_safe(void);

/*! \brief provide cycle information for target task
* \details Support RTOS List:
* - RTX5
Expand Down
Binary file modified lib/perf_counter.lib
Binary file not shown.
18 changes: 18 additions & 0 deletions perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,24 @@ void init_task_cycle_counter(void)
ptRootAgent->wMagicWord = MAGIC_WORD_CANARY;
}

bool perfc_check_task_stack_canary_safe(void)
{
struct __task_cycle_info_t * ptRootAgent =
(struct __task_cycle_info_t *)get_rtos_task_cycle_info();
do {
if (NULL == ptRootAgent) {
break;
}

if ( (ptRootAgent->wMagicWord = MAGIC_WORD_CANARY)
|| (ptRootAgent->wMagicWord = MAGIC_WORD_AGENT_LIST_VALID)) {
return true;
}
} while(0);

return false;
}

task_cycle_info_t *init_task_cycle_info(task_cycle_info_t *ptInfo)
{
do {
Expand Down
9 changes: 8 additions & 1 deletion perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern "C" {
#define __PERF_COUNTER_VER_MINOR__ 2
#define __PERF_COUNTER_VER_REVISE__ 4

#define __PERF_COUNTER_VER_STR__ "dev"
#define __PERF_COUNTER_VER_STR__ ""

#define __PER_COUNTER_VER__ (__PERF_COUNTER_VER_MAJOR__ * 10000ul \
+__PERF_COUNTER_VER_MINOR__ * 100ul \
Expand Down Expand Up @@ -722,6 +722,13 @@ bool __perfc_is_time_out(int64_t lPeriod, int64_t *plTimestamp, bool bAutoReload
*/
extern void init_task_cycle_counter(void);

/*! \brief check whether the task stack canary is safe or not
* \retval false likely to be a stack-overflow
* \retval true task stack is safe
*/
extern
bool perfc_check_task_stack_canary_safe(void);

/*! \brief provide cycle information for target task
* \details Support RTOS List:
* - RTX5
Expand Down

0 comments on commit f6bf640

Please sign in to comment.