This commit is contained in:
Gabriel Wang 2022-04-13 19:40:35 +01:00
parent e2e1c40c33
commit 37dd7f759b
14 changed files with 46 additions and 59 deletions

View File

@ -16,8 +16,9 @@
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
<releases>
<release date="2022-03-22" version="1.9.4-alpha" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.4-alpha.pack">
<release date="2022-04-13" version="1.9.4" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.4.pack">
- Mitigate some clang warnings
- Minor update for RTOS support
</release>
<release date="2022-02-26" version="1.9.3" url="https://github.com/GorgonMeducer/perf_counter/raw/46c4b7057968fae0c0285c8e3a31d6be9fb98ee0/cmsis-pack/GorgonMeducer.perf_counter.1.9.3.pack">
- Fix CONNECT macro cannot connect two parameters issue.
@ -156,7 +157,7 @@
-->
<components>
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.4-alpha">
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.4">
<description>A dedicated performance counter for Cortex-M systick.</description>
<doc></doc>
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true" condition="CMSIS-CORE">

Binary file not shown.

View File

@ -16,8 +16,9 @@
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
<releases>
<release date="2022-03-22" version="1.9.4-alpha" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.4-alpha.pack">
<release date="2022-04-13" version="1.9.4" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.4.pack">
- Mitigate some clang warnings
- Minor update for RTOS support
</release>
<release date="2022-02-26" version="1.9.3" url="https://github.com/GorgonMeducer/perf_counter/raw/46c4b7057968fae0c0285c8e3a31d6be9fb98ee0/cmsis-pack/GorgonMeducer.perf_counter.1.9.3.pack">
- Fix CONNECT macro cannot connect two parameters issue.
@ -156,7 +157,7 @@
-->
<components>
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.4-alpha">
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.4">
<description>A dedicated performance counter for Cortex-M systick.</description>
<doc></doc>
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true" condition="CMSIS-CORE">

View File

@ -1 +1 @@
"C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin\arm-none-eabi-ar" -M <ArInp.Scr
"C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin\arm-none-eabi-ar" -M <ArInp.Scr

View File

@ -16,7 +16,7 @@
*/
#define CMSIS_device_header "ARMCM0.h"
/* GorgonMeducer.Performance Counter::Utilities:perf_counter:Core:Library:1.9.3 */
/* GorgonMeducer.Performance Counter::Utilities:perf_counter:Core:Library:1.9.4-alpha */
#define __PERF_COUNTER__

View File

@ -75,7 +75,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
@ -292,7 +292,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>

View File

@ -10,7 +10,7 @@
<TargetName>example_arm_compiler_6</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6170000::V6.17::.\Arm Compiler 6.17</pCCUsed>
<pCCUsed>6180000::V6.18::.\Arm Compiler 6.18</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>
@ -337,7 +337,7 @@
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls>-Wno-missing-prototypes -Wno-reserved-identifier -Wno-sign-conversion -Wno-c11-extensions -Wno-implicit-int-conversion</MiscControls>
<Define>__PERF_CNT_USE_LONG_CLOCK__</Define>
<Define></Define>
<Undefine></Undefine>
<IncludePath>..</IncludePath>
</VariousControls>
@ -529,7 +529,7 @@
<TargetName>library</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6170000::V6.17::.\Arm Compiler 6.17</pCCUsed>
<pCCUsed>6180000::V6.18::.\Arm Compiler 6.18</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>

View File

@ -20,12 +20,6 @@
#include <cmsis_compiler.h>
#include "perf_counter.h"
#if defined(__clang__)
# pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
#elif defined(__IS_COMPILER_GCC__)
# pragma GCC diagnostic ignored "-Wpedantic"
#endif
#ifndef __PERF_CNT_USE_LONG_CLOCK__
#include <time.h>
@ -74,6 +68,7 @@ static example_lv0_t s_tItem[8] = {
*----------------------------------------------------------------------------*/
int main (void)
{
int32_t iCycleResult = 0;
/*! demo of using() block */
using(int a = 0,printf("========= On Enter =======\r\n"),
@ -91,9 +86,7 @@ int main (void)
printf("Processing item with ID = %d\r\n", _->chID);
}
}
int32_t iCycleResult = 0;
/* measure cycles and store it in a dedicated variable without printf */
__cycleof__("delay_us(1000ul)",
/* insert code to __cycleof__ body, "{}" can be omitted */

Binary file not shown.

View File

@ -104,7 +104,7 @@ extern "C" {
#endif
#ifndef __PLOOC_VA_NUM_ARGS_IMPL
# define __PLOOC_VA_NUM_ARGS_IMPL( _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11, \
# define __PLOOC_VA_NUM_ARGS_IMPL( _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11, \
_12,_13,_14,_15,_16,__N,...) __N
#endif
@ -115,7 +115,7 @@ extern "C" {
#endif
#ifndef UNUSED_PARAM
# define UNUSED_PARAM(__VAR) (__VAR) = (__VAR)
# define UNUSED_PARAM(__VAR) (void)(__VAR)
#endif
#undef __CONNECT2
@ -170,9 +170,6 @@ extern "C" {
#define CONNECT(...) \
ALT_CONNECT2(CONNECT, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
#undef __using1
#undef __using2
#undef __using3

Binary file not shown.

View File

@ -61,14 +61,12 @@
#define __IOM volatile /*! Defines 'read / write' structure member permissions */
/* Memory mapping of Core Hardware */
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
/* SysTick Control / Status Register Definitions */
#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
@ -103,9 +101,6 @@
/*@} end of group CMSIS_SysTick */
#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
@ -200,21 +195,21 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
{
if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
{
return (1UL); /* Reload value impossible */
return (1UL); /* Reload value impossible */
}
//__IRQ_SAFE {
SysTick->CTRL = 0;
SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
//NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
//NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_TICKINT_Msk |
SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
//SCB->ICSR = SCB_ICSR_PENDSTCLR_Msk;
//}
return (0UL); /* Function successful */
return (0UL); /* Function successful */
}
void user_code_insert_to_systick_handler(void)
@ -263,7 +258,8 @@ void init_cycle_counter(bool bSysTickIsOccupied)
#if defined(__IS_COMPILER_ARM_COMPILER_5__) \
|| defined(__IS_COMPILER_ARM_COMPILER_6__) \
|| defined(__IS_COMPILER_GCC__)
|| defined(__IS_COMPILER_GCC__) \
|| defined(__IS_COMPILER_LLVM__)
extern void __ensure_systick_wrapper(void);
__ensure_systick_wrapper();
#endif
@ -657,20 +653,22 @@ int64_t __stop_task_cycle_counter(task_cycle_info_t *ptInfo)
}
int64_t lCycles = 0;
int64_t lCycleUsed;
__IRQ_SAFE {
lCycleUsed = get_system_ticks() - ptRootAgent->lLastTimeStamp;
lCycles = ptRootAgent->tInfo.lUsedTotal + lCycleUsed;
}
if (NULL != ptInfo) {
if (ptInfo->bEnabled) {
ptInfo->nUsedRecent = lCycleUsed;
ptInfo->lUsedTotal += lCycleUsed;
ptInfo->bEnabled = false;
__IRQ_SAFE {
int64_t lCycleUsed = get_system_ticks() - ptRootAgent->lLastTimeStamp;
ptRootAgent->tInfo.lUsedTotal += lCycleUsed;
if (NULL != ptInfo) {
if (ptInfo->bEnabled) {
ptInfo->nUsedRecent = lCycleUsed;
ptInfo->lUsedTotal += lCycleUsed;
ptInfo->bEnabled = false;
}
lCycles = ptInfo->lUsedTotal;
} else {
lCycles = ptRootAgent->tInfo.lUsedTotal;
}
return ptInfo->lUsedTotal;
}
return lCycles;

View File

@ -104,7 +104,7 @@ extern "C" {
#endif
#ifndef __PLOOC_VA_NUM_ARGS_IMPL
# define __PLOOC_VA_NUM_ARGS_IMPL( _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11, \
# define __PLOOC_VA_NUM_ARGS_IMPL( _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11, \
_12,_13,_14,_15,_16,__N,...) __N
#endif
@ -115,7 +115,7 @@ extern "C" {
#endif
#ifndef UNUSED_PARAM
# define UNUSED_PARAM(__VAR) (__VAR) = (__VAR)
# define UNUSED_PARAM(__VAR) (void)(__VAR)
#endif
#undef __CONNECT2
@ -170,9 +170,6 @@ extern "C" {
#define CONNECT(...) \
ALT_CONNECT2(CONNECT, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
#undef __using1
#undef __using2
#undef __using3