Skip to content

Commit

Permalink
tests: boot_time: cleanup boot_time test to work on ARM
Browse files Browse the repository at this point in the history
Enabled the boot_time test on ARM SoCs, set __start_time_stamp on ARM
since we don't have a free running counter similar to TSC on x86.
Also moved to printing the values out as %u to increase the range of
values.

Signed-off-by: Kumar Gala <[email protected]>
  • Loading branch information
galak authored and Anas Nashif committed Jun 29, 2017
1 parent d3d9aba commit 534beb3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions arch/arm/core/cortex_m/prep_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,18 @@ extern FUNC_NORETURN void _Cstart(void);
* @return N/A
*/

#ifdef CONFIG_BOOT_TIME_MEASUREMENT
extern u64_t __start_time_stamp;
#endif
void _PrepC(void)
{
relocate_vector_table();
enable_floating_point();
_bss_zero();
_data_copy();
#ifdef CONFIG_BOOT_TIME_MEASUREMENT
__start_time_stamp = 0;
#endif
_Cstart();
CODE_UNREACHABLE;
}
9 changes: 5 additions & 4 deletions tests/benchmarks/boot_time/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include <zephyr.h>

#include <tc_util.h>

/* externs */
Expand Down Expand Up @@ -58,16 +59,16 @@ void main(void)
/* Only print lower 32bit of time result */
TC_PRINT("Boot Result: Clock Frequency: %d MHz\n",
freq);
TC_PRINT("__start : %d cycles, %d us\n",
TC_PRINT("__start : %u cycles, %u us\n",
(u32_t)(__start_time_stamp & 0xFFFFFFFFULL),
(u32_t) (_start_us & 0xFFFFFFFFULL));
TC_PRINT("_start->main(): %d cycles, %d us\n",
TC_PRINT("_start->main(): %u cycles, %u us\n",
(u32_t)(s_main_time_stamp & 0xFFFFFFFFULL),
(u32_t) (main_us & 0xFFFFFFFFULL));
TC_PRINT("_start->task : %d cycles, %d us\n",
TC_PRINT("_start->task : %u cycles, %u us\n",
(u32_t)(s_task_time_stamp & 0xFFFFFFFFULL),
(u32_t) (task_us & 0xFFFFFFFFULL));
TC_PRINT("_start->idle : %d cycles, %d us\n",
TC_PRINT("_start->idle : %u cycles, %u us\n",
(u32_t)(s_idle_time_stamp & 0xFFFFFFFFULL),
(u32_t) (idle_us & 0xFFFFFFFFULL));

Expand Down
2 changes: 1 addition & 1 deletion tests/benchmarks/boot_time/testcase.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests:
- test:
arch_whitelist: x86
arch_whitelist: x86 arm
tags: benchmark

0 comments on commit 534beb3

Please sign in to comment.