Merge branch 'CMSIS-Pack'

This commit is contained in:
Gabriel Wang 2023-02-09 18:11:51 +00:00
commit 1e2c473d3b
16 changed files with 303 additions and 145 deletions

View File

@ -16,7 +16,11 @@
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository> <repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
<releases> <releases>
<release date="2022-11-01" version="1.9.10" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.10.pack"> <release date="2022-11-01" version="1.9.11" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.11.pack">
- Fix the source variant support for Armv8-M processors
- Other minor fixes
</release>
<release date="2022-11-01" version="1.9.10" url="https://github.com/GorgonMeducer/perf_counter/raw/1115e60d61940b7da833c841d2f4e1bbbcb22793/cmsis-pack/GorgonMeducer.perf_counter.1.9.10.pack">
- Fix the support for RT-Thread - Fix the support for RT-Thread
</release> </release>
<release date="2022-09-26" version="1.9.9a" url="https://github.com/GorgonMeducer/perf_counter/raw/77134b23f9259e3ec4215eb30096c3474ed1d01d/cmsis-pack/GorgonMeducer.perf_counter.1.9.9a.pack"> <release date="2022-09-26" version="1.9.9a" url="https://github.com/GorgonMeducer/perf_counter/raw/77134b23f9259e3ec4215eb30096c3474ed1d01d/cmsis-pack/GorgonMeducer.perf_counter.1.9.9a.pack">
@ -85,27 +89,37 @@
<description>GNU Tools for Arm Embedded Processors.</description> <description>GNU Tools for Arm Embedded Processors.</description>
<accept Tcompiler="GCC"/> <accept Tcompiler="GCC"/>
</condition> </condition>
<condition id="Cortex-M Processors">
<description>Support All Cortex-M based processors</description>
<condition id="Armv8-M Processors">
<accept Dcore="ARMV8MBL"/>
<accept Dcore="ARMV8MML"/>
<accept Dcore="ARMV81MML"/>
<accept Dcore="Star-MC1"/>
<accept Dcore="Cortex-M23"/>
<accept Dcore="Cortex-M33"/>
<accept Dcore="Cortex-M35P"/>
<accept Dcore="Cortex-M55"/>
<accept Dcore="Cortex-M85"/>
</condition>
<condition id="Previous Generation Cortex-M Processors">
<accept Dcore="Cortex-M0"/> <accept Dcore="Cortex-M0"/>
<accept Dcore="Cortex-M0+"/> <accept Dcore="Cortex-M0+"/>
<accept Dcore="Cortex-M1"/> <accept Dcore="Cortex-M1"/>
<accept Dcore="Cortex-M3"/> <accept Dcore="Cortex-M3"/>
<accept Dcore="Cortex-M4"/> <accept Dcore="Cortex-M4"/>
<accept Dcore="Cortex-M7"/> <accept Dcore="Cortex-M7"/>
<accept Dcore="Cortex-M23"/>
<accept Dcore="Cortex-M33"/>
<accept Dcore="Cortex-M35P"/>
<accept Dcore="Cortex-M55"/>
<accept Dcore="Cortex-M85"/>
<accept Dcore="Star-MC1"/>
<accept Dcore="SC000"/> <accept Dcore="SC000"/>
<accept Dcore="SC300"/> <accept Dcore="SC300"/>
<accept Dcore="ARMV8MBL"/>
<accept Dcore="ARMV8MML"/>
<accept Dcore="ARMV81MML"/>
</condition> </condition>
<condition id="Cortex-M Processors">
<description>Support All Cortex-M based processors</description>
<accept condition="Previous Generation Cortex-M Processors"/>
<accept condition="Armv8-M Processors"/>
</condition>
<condition id="CMSIS-CORE"> <condition id="CMSIS-CORE">
<description>Require CMSIS-CORE Support</description> <description>Require CMSIS-CORE Support</description>
<require Cclass="CMSIS" Cgroup="CORE"/> <require Cclass="CMSIS" Cgroup="CORE"/>
@ -139,6 +153,18 @@
<require condition="Cortex-M Processors"/> <require condition="Cortex-M Processors"/>
</condition> </condition>
<condition id="Previous Generation Cortex-M Arm Compiler">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm Compiler"/>
<require condition="Previous Generation Cortex-M Processors"/>
</condition>
<condition id="Armv8-M Arm Compiler">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm Compiler"/>
<require condition="Armv8-M Processors"/>
</condition>
<condition id="Cortex-M Arm GCC CMSIS-CORE"> <condition id="Cortex-M Arm GCC CMSIS-CORE">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description> <description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm GCC"/> <require condition="Arm GCC"/>
@ -152,6 +178,19 @@
<require condition="CMSIS-CORE"/> <require condition="CMSIS-CORE"/>
</condition> </condition>
<condition id="Previous Generation Cortex-M Arm Compiler CMSIS-CORE">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm Compiler"/>
<require condition="Previous Generation Cortex-M Processors"/>
<require condition="CMSIS-CORE"/>
</condition>
<condition id="Armv8-M Arm Compiler CMSIS-CORE">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm Compiler"/>
<require condition="Armv8-M Processors"/>
<require condition="CMSIS-CORE"/>
</condition>
</conditions> </conditions>
<!-- apis section (optional - for Application Programming Interface descriptions) --> <!-- apis section (optional - for Application Programming Interface descriptions) -->
@ -185,7 +224,7 @@
--> -->
<components> <components>
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.9a"> <bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.11">
<description>A dedicated performance counter for Cortex-M systick.</description> <description>A dedicated performance counter for Cortex-M systick.</description>
<doc>documents/Doxygen/html/index.html</doc> <doc>documents/Doxygen/html/index.html</doc>
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true" condition="CMSIS-CORE"> <component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true" condition="CMSIS-CORE">
@ -211,8 +250,9 @@
<files> <files>
<file category="header" name="lib/perf_counter.h"/> <file category="header" name="lib/perf_counter.h"/>
<file category="source" name="perf_counter.c" /> <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_ual.s" condition="Previous Generation 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="systick_wrapper_gcc.s" condition="Cortex-M Arm GCC CMSIS-CORE"/>
<file category="source" name="systick_wrapper_gnu.s" condition="Armv8-M Arm Compiler CMSIS-CORE"/>
</files> </files>
<RTE_Components_h> <RTE_Components_h>

View File

@ -1,4 +1,4 @@
# perf_counter (v1.9.9) # perf_counter (v1.9.11)
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`. 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: ### Features:

View File

@ -16,7 +16,11 @@
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository> <repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
<releases> <releases>
<release date="2022-11-01" version="1.9.10" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.10.pack"> <release date="2022-11-01" version="1.9.11" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.9.11.pack">
- Fix the source variant support for Armv8-M processors
- Other minor fixes
</release>
<release date="2022-11-01" version="1.9.10" url="https://github.com/GorgonMeducer/perf_counter/raw/1115e60d61940b7da833c841d2f4e1bbbcb22793/cmsis-pack/GorgonMeducer.perf_counter.1.9.10.pack">
- Fix the support for RT-Thread - Fix the support for RT-Thread
</release> </release>
<release date="2022-09-26" version="1.9.9a" url="https://github.com/GorgonMeducer/perf_counter/raw/77134b23f9259e3ec4215eb30096c3474ed1d01d/cmsis-pack/GorgonMeducer.perf_counter.1.9.9a.pack"> <release date="2022-09-26" version="1.9.9a" url="https://github.com/GorgonMeducer/perf_counter/raw/77134b23f9259e3ec4215eb30096c3474ed1d01d/cmsis-pack/GorgonMeducer.perf_counter.1.9.9a.pack">
@ -85,27 +89,37 @@
<description>GNU Tools for Arm Embedded Processors.</description> <description>GNU Tools for Arm Embedded Processors.</description>
<accept Tcompiler="GCC"/> <accept Tcompiler="GCC"/>
</condition> </condition>
<condition id="Cortex-M Processors">
<description>Support All Cortex-M based processors</description>
<condition id="Armv8-M Processors">
<accept Dcore="ARMV8MBL"/>
<accept Dcore="ARMV8MML"/>
<accept Dcore="ARMV81MML"/>
<accept Dcore="Star-MC1"/>
<accept Dcore="Cortex-M23"/>
<accept Dcore="Cortex-M33"/>
<accept Dcore="Cortex-M35P"/>
<accept Dcore="Cortex-M55"/>
<accept Dcore="Cortex-M85"/>
</condition>
<condition id="Previous Generation Cortex-M Processors">
<accept Dcore="Cortex-M0"/> <accept Dcore="Cortex-M0"/>
<accept Dcore="Cortex-M0+"/> <accept Dcore="Cortex-M0+"/>
<accept Dcore="Cortex-M1"/> <accept Dcore="Cortex-M1"/>
<accept Dcore="Cortex-M3"/> <accept Dcore="Cortex-M3"/>
<accept Dcore="Cortex-M4"/> <accept Dcore="Cortex-M4"/>
<accept Dcore="Cortex-M7"/> <accept Dcore="Cortex-M7"/>
<accept Dcore="Cortex-M23"/>
<accept Dcore="Cortex-M33"/>
<accept Dcore="Cortex-M35P"/>
<accept Dcore="Cortex-M55"/>
<accept Dcore="Cortex-M85"/>
<accept Dcore="Star-MC1"/>
<accept Dcore="SC000"/> <accept Dcore="SC000"/>
<accept Dcore="SC300"/> <accept Dcore="SC300"/>
<accept Dcore="ARMV8MBL"/>
<accept Dcore="ARMV8MML"/>
<accept Dcore="ARMV81MML"/>
</condition> </condition>
<condition id="Cortex-M Processors">
<description>Support All Cortex-M based processors</description>
<accept condition="Previous Generation Cortex-M Processors"/>
<accept condition="Armv8-M Processors"/>
</condition>
<condition id="CMSIS-CORE"> <condition id="CMSIS-CORE">
<description>Require CMSIS-CORE Support</description> <description>Require CMSIS-CORE Support</description>
<require Cclass="CMSIS" Cgroup="CORE"/> <require Cclass="CMSIS" Cgroup="CORE"/>
@ -139,6 +153,18 @@
<require condition="Cortex-M Processors"/> <require condition="Cortex-M Processors"/>
</condition> </condition>
<condition id="Previous Generation Cortex-M Arm Compiler">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm Compiler"/>
<require condition="Previous Generation Cortex-M Processors"/>
</condition>
<condition id="Armv8-M Arm Compiler">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm Compiler"/>
<require condition="Armv8-M Processors"/>
</condition>
<condition id="Cortex-M Arm GCC CMSIS-CORE"> <condition id="Cortex-M Arm GCC CMSIS-CORE">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description> <description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm GCC"/> <require condition="Arm GCC"/>
@ -152,6 +178,19 @@
<require condition="CMSIS-CORE"/> <require condition="CMSIS-CORE"/>
</condition> </condition>
<condition id="Previous Generation Cortex-M Arm Compiler CMSIS-CORE">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm Compiler"/>
<require condition="Previous Generation Cortex-M Processors"/>
<require condition="CMSIS-CORE"/>
</condition>
<condition id="Armv8-M Arm Compiler CMSIS-CORE">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm Compiler"/>
<require condition="Armv8-M Processors"/>
<require condition="CMSIS-CORE"/>
</condition>
</conditions> </conditions>
<!-- apis section (optional - for Application Programming Interface descriptions) --> <!-- apis section (optional - for Application Programming Interface descriptions) -->
@ -185,7 +224,7 @@
--> -->
<components> <components>
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.9a"> <bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.9.11">
<description>A dedicated performance counter for Cortex-M systick.</description> <description>A dedicated performance counter for Cortex-M systick.</description>
<doc>documents/Doxygen/html/index.html</doc> <doc>documents/Doxygen/html/index.html</doc>
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true" condition="CMSIS-CORE"> <component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true" condition="CMSIS-CORE">
@ -211,8 +250,9 @@
<files> <files>
<file category="header" name="lib/perf_counter.h"/> <file category="header" name="lib/perf_counter.h"/>
<file category="source" name="perf_counter.c" /> <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_ual.s" condition="Previous Generation 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="systick_wrapper_gcc.s" condition="Cortex-M Arm GCC CMSIS-CORE"/>
<file category="source" name="systick_wrapper_gnu.s" condition="Armv8-M Arm Compiler CMSIS-CORE"/>
</files> </files>
<RTE_Components_h> <RTE_Components_h>

View File

@ -1 +0,0 @@
"C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021-07\bin\arm-none-eabi-ar" -M <ArInp.Scr

View File

@ -1,15 +0,0 @@
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x00000000 0x00400000 { ; load region size_region
ER_IROM1 +0 0x00400000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_IRAM1 0x20000000 0x00400000 { ; RW data
* (+RW +ZI)
}
}

View File

@ -30,26 +30,26 @@
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
;</h> ;</h>
Stack_Size EQU 0x00000400 ;Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3 ; AREA STACK, NOINIT, READWRITE, ALIGN=3
__stack_limit ;__stack_limit
Stack_Mem SPACE Stack_Size ;Stack_Mem SPACE Stack_Size
__initial_sp ;__initial_sp
;<h> Heap Configuration ;;<h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ;; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
;</h> ;;</h>
Heap_Size EQU 0x00000C00 ;Heap_Size EQU 0x00000C00
IF Heap_Size != 0 ; Heap is provided ; IF Heap_Size != 0 ; Heap is provided
AREA HEAP, NOINIT, READWRITE, ALIGN=3 ; AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base ;__heap_base
Heap_Mem SPACE Heap_Size ;Heap_Mem SPACE Heap_Size
__heap_limit ;__heap_limit
ENDIF ; ENDIF
PRESERVE8 PRESERVE8
@ -62,8 +62,9 @@ __heap_limit
EXPORT __Vectors EXPORT __Vectors
EXPORT __Vectors_End EXPORT __Vectors_End
EXPORT __Vectors_Size EXPORT __Vectors_Size
IMPORT |Image$$ARM_LIB_STACK$$ZI$$Limit|
__Vectors DCD __initial_sp ; Top of Stack
__Vectors DCD |Image$$ARM_LIB_STACK$$ZI$$Limit| ; Top of Stack
DCD Reset_Handler ; Reset Handler DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; -14 NMI Handler DCD NMI_Handler ; -14 NMI Handler
DCD HardFault_Handler ; -13 Hard Fault Handler DCD HardFault_Handler ; -13 Hard Fault Handler
@ -154,15 +155,15 @@ $Handler_Name PROC
; User setup Stack & Heap ; User setup Stack & Heap
IF :LNOT::DEF:__MICROLIB ; IF :LNOT::DEF:__MICROLIB
IMPORT __use_two_region_memory ; IMPORT __use_two_region_memory
ENDIF ; ENDIF
EXPORT __stack_limit ; EXPORT __stack_limit
EXPORT __initial_sp ; EXPORT __initial_sp
IF Heap_Size != 0 ; Heap is provided ; IF Heap_Size != 0 ; Heap is provided
EXPORT __heap_base ; EXPORT __heap_base
EXPORT __heap_limit ; EXPORT __heap_limit
ENDIF ; ENDIF
END END

36
example/example.sct Normal file
View File

@ -0,0 +1,36 @@
#! armclang --target=arm-arm-none-eabi -mcpu=cortex-m0 -E -xc
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
#define RAM1_SIZE 0x00020000
#define RAM1_BASE 0x20000000
#define RAM1_LIMIT (RAM1_BASE + RAM1_SIZE)
#define STACK_SIZE 0x800
#define HEAP_ALIGN 8
#define HEAP_SIZE (RAM1_LIMIT - AlignExpr(ImageLimit(RW_IRAM1), HEAP_ALIGN))
LR_IROM1 0x00000000 0x00040000 { ; load region size_region
ER_IROM1 0x00000000 0x00040000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
ARM_LIB_STACK RAM1_BASE ALIGN 8 EMPTY FILL 0xDEADBEEF STACK_SIZE {}
RW_IRAM1 +0 { ; RW data
.ANY (+RW +ZI)
}
ARM_LIB_HEAP +0 ALIGN HEAP_ALIGN EMPTY HEAP_SIZE {}
ScatterAssert(ImageLimit(ARM_LIB_HEAP) <= RAM1_LIMIT)
}

View File

@ -165,7 +165,7 @@
<Mm> <Mm>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<SubType>1</SubType> <SubType>1</SubType>
<ItemText>0x00</ItemText> <ItemText>0x20000000</ItemText>
<AccSizeX>0</AccSizeX> <AccSizeX>0</AccSizeX>
</Mm> </Mm>
</MemoryWindow1> </MemoryWindow1>
@ -364,54 +364,6 @@
<Bp> <Bp>
<Number>0</Number> <Number>0</Number>
<Type>0</Type> <Type>0</Type>
<LineNumber>94</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>&lt;1&gt;.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>93</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>&lt;1&gt;.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>92</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>&lt;1&gt;.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>62</LineNumber> <LineNumber>62</LineNumber>
<EnabledFlag>1</EnabledFlag> <EnabledFlag>1</EnabledFlag>
<Address>0</Address> <Address>0</Address>
@ -741,7 +693,7 @@
<Group> <Group>
<GroupName>application</GroupName> <GroupName>application</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -849,7 +801,7 @@
<Group> <Group>
<GroupName>::Compiler</GroupName> <GroupName>::Compiler</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>1</RteFlg> <RteFlg>1</RteFlg>

View File

@ -10,7 +10,7 @@
<TargetName>example_arm_compiler_6</TargetName> <TargetName>example_arm_compiler_6</TargetName>
<ToolsetNumber>0x4</ToolsetNumber> <ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName> <ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6180000::V6.18::ARMCLANG</pCCUsed> <pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6> <uAC6>1</uAC6>
<TargetOption> <TargetOption>
<TargetCommonOption> <TargetCommonOption>
@ -52,7 +52,7 @@
<OutputName>example</OutputName> <OutputName>example</OutputName>
<CreateExecutable>1</CreateExecutable> <CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib> <CreateLib>0</CreateLib>
<CreateHexFile>0</CreateHexFile> <CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation> <DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation> <BrowseInformation>1</BrowseInformation>
<ListingPath>.\</ListingPath> <ListingPath>.\</ListingPath>
@ -190,7 +190,7 @@
<hadIRAM2>0</hadIRAM2> <hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2> <hadIROM2>0</hadIROM2>
<StupSel>8</StupSel> <StupSel>8</StupSel>
<useUlib>1</useUlib> <useUlib>0</useUlib>
<EndSel>1</EndSel> <EndSel>1</EndSel>
<uLtcg>0</uLtcg> <uLtcg>0</uLtcg>
<nSecure>0</nSecure> <nSecure>0</nSecure>
@ -337,7 +337,7 @@
<v6WtE>0</v6WtE> <v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti> <v6Rtti>0</v6Rtti>
<VariousControls> <VariousControls>
<MiscControls>-Wno-missing-prototypes -Wno-reserved-identifier -Wno-sign-conversion -Wno-c11-extensions -Wno-implicit-int-conversion</MiscControls> <MiscControls>-Wno-missing-prototypes -Wno-reserved-identifier -Wno-sign-conversion -Wno-c11-extensions -Wno-implicit-int-conversion -Wno-invalid-utf8</MiscControls>
<Define>__PERF_COUNTER_CFG_USE_SYSTICK_WRAPPER__</Define> <Define>__PERF_COUNTER_CFG_USE_SYSTICK_WRAPPER__</Define>
<Undefine></Undefine> <Undefine></Undefine>
<IncludePath>..</IncludePath> <IncludePath>..</IncludePath>
@ -371,7 +371,7 @@
<TextAddressRange></TextAddressRange> <TextAddressRange></TextAddressRange>
<DataAddressRange></DataAddressRange> <DataAddressRange></DataAddressRange>
<pXoBase></pXoBase> <pXoBase></pXoBase>
<ScatterFile>Blinky.sct</ScatterFile> <ScatterFile>example.sct</ScatterFile>
<IncludeLibs></IncludeLibs> <IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath> <IncludeLibsPath></IncludeLibsPath>
<Misc></Misc> <Misc></Misc>
@ -530,7 +530,7 @@
<TargetName>library</TargetName> <TargetName>library</TargetName>
<ToolsetNumber>0x4</ToolsetNumber> <ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName> <ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6180000::V6.18::ARMCLANG</pCCUsed> <pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6> <uAC6>1</uAC6>
<TargetOption> <TargetOption>
<TargetCommonOption> <TargetCommonOption>
@ -1548,7 +1548,7 @@
<TextAddressRange></TextAddressRange> <TextAddressRange></TextAddressRange>
<DataAddressRange></DataAddressRange> <DataAddressRange></DataAddressRange>
<pXoBase></pXoBase> <pXoBase></pXoBase>
<ScatterFile>Blinky.sct</ScatterFile> <ScatterFile>.\example.sct</ScatterFile>
<IncludeLibs></IncludeLibs> <IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath> <IncludeLibsPath></IncludeLibsPath>
<Misc></Misc> <Misc></Misc>

View File

@ -62,6 +62,66 @@ static example_lv0_t s_tItem[8] = {
{.chID = 6}, {.chID = 6},
{.chID = 7}, {.chID = 7},
}; };
#if __IS_COMPILER_ARM_COMPILER__
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
# pragma clang diagnostic ignored "-Wdouble-promotion"
#endif
uint32_t calculate_stack_usage_topdown(void)
{
extern uint32_t Image$$ARM_LIB_STACK$$Limit[];
extern uint32_t Image$$ARM_LIB_STACK$$Length;
uint32_t *pwStack = Image$$ARM_LIB_STACK$$Limit;
uint32_t wStackSize = (uintptr_t)&Image$$ARM_LIB_STACK$$Length / 4;
uint32_t wStackUsed = 0;
do {
if (*--pwStack == 0xDEADBEEF) {
break;
}
wStackUsed++;
} while(--wStackSize);
printf("\r\nStack Usage: [%d/%d] %2.2f%%\r\n",
wStackUsed * 4,
(uintptr_t)&Image$$ARM_LIB_STACK$$Length,
( (float)wStackUsed * 400.0f
/ (float)(uintptr_t)&Image$$ARM_LIB_STACK$$Length));
return wStackUsed * 4;
}
uint32_t calculate_stack_usage_bottomup(void)
{
extern uint32_t Image$$ARM_LIB_STACK$$Base[];
extern uint32_t Image$$ARM_LIB_STACK$$Length;
uint32_t *pwStack = Image$$ARM_LIB_STACK$$Base;
uint32_t wStackSize = (uintptr_t)&Image$$ARM_LIB_STACK$$Length;
uint32_t wStackUsed = wStackSize / 4;
do {
if (*pwStack++ != 0xDEADBEEF) {
break;
}
} while(--wStackUsed);
printf("\r\nStack Usage: [%d/%d] %2.2f%%\r\n",
wStackUsed * 4,
wStackSize,
( (float)wStackUsed * 400.0f / (float)wStackSize));
return wStackUsed * 4;
}
#if defined(__clang__)
# pragma clang diagnostic pop
#endif
#endif
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Main function Main function
@ -120,6 +180,11 @@ int main (void)
printf("used clock cycle: %d", (int32_t)(get_system_ticks() - tStart)); printf("used clock cycle: %d", (int32_t)(get_system_ticks() - tStart));
} while(0); } while(0);
#if __IS_COMPILER_ARM_COMPILER__
calculate_stack_usage_topdown();
calculate_stack_usage_bottomup();
#endif
while (1) { while (1) {
printf("\r\nhello world\r\n"); printf("\r\nhello world\r\n");
delay_ms(1000); delay_ms(1000);

View File

@ -54,6 +54,7 @@ PACK_BASE_FILES="
perf_counter.c perf_counter.c
perf_counter.h perf_counter.h
systick_wrapper_gcc.s systick_wrapper_gcc.s
systick_wrapper_gnu.s
systick_wrapper_ual.s systick_wrapper_ual.s
LICENSE LICENSE
README.md README.md

View File

@ -35,9 +35,9 @@ extern "C" {
*/ */
#define __PERF_COUNTER_VER_MAJOR__ 1 #define __PERF_COUNTER_VER_MAJOR__ 1
#define __PERF_COUNTER_VER_MINOR__ 9 #define __PERF_COUNTER_VER_MINOR__ 9
#define __PERF_COUNTER_VER_REVISE__ 10 #define __PERF_COUNTER_VER_REVISE__ 11
#define __PERF_COUNTER_VER_STR__ "dev" #define __PERF_COUNTER_VER_STR__ ""
#define __PER_COUNTER_VER__ (__PERF_COUNTER_VER_MAJOR__ * 10000ul \ #define __PER_COUNTER_VER__ (__PERF_COUNTER_VER_MAJOR__ * 10000ul \
+__PERF_COUNTER_VER_MINOR__ * 100ul \ +__PERF_COUNTER_VER_MINOR__ * 100ul \
@ -285,7 +285,7 @@ extern "C" {
#endif #endif
#if __PLOOC_VA_NUM_ARGS() != 0 #if __PLOOC_VA_NUM_ARGS() != 0
#warning Please enable GNC extensions, it is required by __cycleof__() and \ #warning Please enable GNU extensions, it is required by __cycleof__() and \
__super_loop_monitor__() __super_loop_monitor__()
#endif #endif
@ -472,9 +472,6 @@ __attribute__((noinline))
extern int64_t clock(void); extern int64_t clock(void);
#endif #endif
/*! @} */ /*! @} */
/*! /*!
@ -607,7 +604,6 @@ extern int64_t __stop_task_cycle_counter(task_cycle_info_t *ptInfo);
* special conditions * * special conditions *
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
/*! \brief initialise cycle counter service /*! \brief initialise cycle counter service
* \note - don't forget to tell the function whether the systick is already * \note - don't forget to tell the function whether the systick is already
* used by user applications. * used by user applications.

Binary file not shown.

View File

@ -35,9 +35,9 @@ extern "C" {
*/ */
#define __PERF_COUNTER_VER_MAJOR__ 1 #define __PERF_COUNTER_VER_MAJOR__ 1
#define __PERF_COUNTER_VER_MINOR__ 9 #define __PERF_COUNTER_VER_MINOR__ 9
#define __PERF_COUNTER_VER_REVISE__ 10 #define __PERF_COUNTER_VER_REVISE__ 11
#define __PERF_COUNTER_VER_STR__ "dev" #define __PERF_COUNTER_VER_STR__ ""
#define __PER_COUNTER_VER__ (__PERF_COUNTER_VER_MAJOR__ * 10000ul \ #define __PER_COUNTER_VER__ (__PERF_COUNTER_VER_MAJOR__ * 10000ul \
+__PERF_COUNTER_VER_MINOR__ * 100ul \ +__PERF_COUNTER_VER_MINOR__ * 100ul \
@ -285,7 +285,7 @@ extern "C" {
#endif #endif
#if __PLOOC_VA_NUM_ARGS() != 0 #if __PLOOC_VA_NUM_ARGS() != 0
#warning Please enable GNC extensions, it is required by __cycleof__() and \ #warning Please enable GNU extensions, it is required by __cycleof__() and \
__super_loop_monitor__() __super_loop_monitor__()
#endif #endif
@ -472,9 +472,6 @@ __attribute__((noinline))
extern int64_t clock(void); extern int64_t clock(void);
#endif #endif
/*! @} */ /*! @} */
/*! /*!
@ -607,7 +604,6 @@ extern int64_t __stop_task_cycle_counter(task_cycle_info_t *ptInfo);
* special conditions * * special conditions *
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
/*! \brief initialise cycle counter service /*! \brief initialise cycle counter service
* \note - don't forget to tell the function whether the systick is already * \note - don't forget to tell the function whether the systick is already
* used by user applications. * used by user applications.

47
systick_wrapper_gnu.s Normal file
View File

@ -0,0 +1,47 @@
;/****************************************************************************
;* Copyright 2022 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. *
;* You may obtain a copy of the License at *
;* *
;* http://www.apache.org/licenses/LICENSE-2.0 *
;* *
;* Unless required by applicable law or agreed to in writing, software *
;* distributed under the License is distributed on an "AS IS" BASIS, *
;* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
;* See the License for the specific language governing permissions and *
;* limitations under the License. *
;* *
;****************************************************************************/
.syntax unified
.arch armv6-m
.eabi_attribute Tag_ABI_align_preserved, 1
.text
.thumb
.thumb_func
.align 2
.globl $Sub$$SysTick_Handler
.type $Sub$$SysTick_Handler, %function
$Sub$$SysTick_Handler:
push {r4, r5}
push {r4, lr}
ldr R0, =user_code_insert_to_systick_handler
blx R0
pop {r4, r5}
mov lr, r5
pop {r4, r5}
ldr R0, =$Super$$SysTick_Handler
bx R0
.globl __ensure_systick_wrapper
.type __ensure_systick_wrapper, %function
__ensure_systick_wrapper:
bx lr