minor update

This commit is contained in:
Gabriel Wang 2022-11-28 00:27:15 +00:00
parent 0f3aafd63d
commit e140f23603
6 changed files with 88 additions and 76 deletions

View File

@ -13,23 +13,24 @@
#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)
}
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 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
.ANY (+RW +ZI)
}
RW_IRAM1 +0 { ; RW data
.ANY (+RW +ZI)
}
ARM_LIB_HEAP +0 ALIGN HEAP_ALIGN EMPTY HEAP_SIZE {}
ARM_LIB_HEAP +0 ALIGN HEAP_ALIGN EMPTY HEAP_SIZE {}
ScatterAssert(ImageLimit(ARM_LIB_HEAP) <= RAM1_LIMIT)
ScatterAssert(ImageLimit(ARM_LIB_HEAP) <= RAM1_LIMIT)
}

View File

@ -364,54 +364,6 @@
<Bp>
<Number>0</Number>
<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>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
@ -785,7 +737,7 @@
<Group>
<GroupName>perf_counter_lib</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -857,7 +809,7 @@
<Group>
<GroupName>::Device</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>

View File

@ -10,7 +10,7 @@
<TargetName>example_arm_compiler_6</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6180000::V6.18::ARMCLANG</pCCUsed>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>
@ -52,7 +52,7 @@
<OutputName>example</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>0</CreateHexFile>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\</ListingPath>
@ -337,7 +337,7 @@
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<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>
<Undefine></Undefine>
<IncludePath>..</IncludePath>
@ -530,7 +530,7 @@
<TargetName>library</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6180000::V6.18::ARMCLANG</pCCUsed>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>

View File

@ -63,6 +63,66 @@ static example_lv0_t s_tItem[8] = {
{.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
*----------------------------------------------------------------------------*/
@ -120,6 +180,9 @@ int main (void)
printf("used clock cycle: %d", (int32_t)(get_system_ticks() - tStart));
} while(0);
calculate_stack_usage_topdown();
calculate_stack_usage_bottomup();
while (1) {
printf("\r\nhello world\r\n");
delay_ms(1000);

View File

@ -285,7 +285,7 @@ extern "C" {
#endif
#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__()
#endif
@ -472,9 +472,6 @@ __attribute__((noinline))
extern int64_t clock(void);
#endif
/*! @} */
/*!
@ -607,7 +604,6 @@ extern int64_t __stop_task_cycle_counter(task_cycle_info_t *ptInfo);
* special conditions *
*----------------------------------------------------------------------------*/
/*! \brief initialise cycle counter service
* \note - don't forget to tell the function whether the systick is already
* used by user applications.

Binary file not shown.