mirror of
https://github.com/GorgonMeducer/perf_counter.git
synced 2025-01-31 19:33:04 +08:00
minor update
This commit is contained in:
parent
0f3aafd63d
commit
e140f23603
@ -13,6 +13,7 @@
|
|||||||
#define HEAP_ALIGN 8
|
#define HEAP_ALIGN 8
|
||||||
#define HEAP_SIZE (RAM1_LIMIT - AlignExpr(ImageLimit(RW_IRAM1), HEAP_ALIGN))
|
#define HEAP_SIZE (RAM1_LIMIT - AlignExpr(ImageLimit(RW_IRAM1), HEAP_ALIGN))
|
||||||
|
|
||||||
|
|
||||||
LR_IROM1 0x00000000 0x00040000 { ; load region size_region
|
LR_IROM1 0x00000000 0x00040000 { ; load region size_region
|
||||||
ER_IROM1 0x00000000 0x00040000 { ; load address = execution address
|
ER_IROM1 0x00000000 0x00040000 { ; load address = execution address
|
||||||
*.o (RESET, +First)
|
*.o (RESET, +First)
|
||||||
@ -21,9 +22,8 @@ LR_IROM1 0x00000000 0x00040000 { ; load region size_region
|
|||||||
.ANY (+XO)
|
.ANY (+XO)
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_LIB_STACK RAM1_BASE ALIGN 8 EMPTY STACK_SIZE {}
|
ARM_LIB_STACK RAM1_BASE ALIGN 8 EMPTY FILL 0xDEADBEEF STACK_SIZE {}
|
||||||
|
|
||||||
;RW_IRAM1 0x20000000 0x00020000 { ; RW data
|
|
||||||
RW_IRAM1 +0 { ; RW data
|
RW_IRAM1 +0 { ; RW data
|
||||||
.ANY (+RW +ZI)
|
.ANY (+RW +ZI)
|
||||||
}
|
}
|
||||||
@ -33,3 +33,4 @@ LR_IROM1 0x00000000 0x00040000 { ; load region size_region
|
|||||||
ScatterAssert(ImageLimit(ARM_LIB_HEAP) <= RAM1_LIMIT)
|
ScatterAssert(ImageLimit(ARM_LIB_HEAP) <= RAM1_LIMIT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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><1>.\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><1>.\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><1>.\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>
|
||||||
@ -785,7 +737,7 @@
|
|||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>perf_counter_lib</GroupName>
|
<GroupName>perf_counter_lib</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>
|
||||||
@ -857,7 +809,7 @@
|
|||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>::Device</GroupName>
|
<GroupName>::Device</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>
|
||||||
|
@ -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>
|
||||||
@ -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>
|
||||||
@ -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>
|
||||||
|
@ -63,6 +63,66 @@ static example_lv0_t s_tItem[8] = {
|
|||||||
{.chID = 7},
|
{.chID = 7},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Main function
|
Main function
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
@ -120,6 +180,9 @@ 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);
|
||||||
|
|
||||||
|
calculate_stack_usage_topdown();
|
||||||
|
calculate_stack_usage_bottomup();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
printf("\r\nhello world\r\n");
|
printf("\r\nhello world\r\n");
|
||||||
delay_ms(1000);
|
delay_ms(1000);
|
||||||
|
@ -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.
Loading…
x
Reference in New Issue
Block a user