Time functions in BCC sources


I have built bcc-2.2.1-gcc from sources successfully and I am now trying to use time functions (e.g. clock()) in my code for the LEON3 to measure the execution time. According to the BCC User’s Manual I need to first call leonbare_init_ticks() and include asm-leon/timer.h. However, the compiler fails as it can’t find asm-leon/timer.h and the header is not found in the built bcc destination directory. In other words, when newlib is built, the time functions are not included.

I have seen that libgloss is disabled in the provided build script (ubuild.sh), but even enabling it does not solve the issue. Currently, I’m executing it as:

./ubuild.sh --destination path --toolchain --libbcc

Is there any flag I need to set when building newlib? Otherwise, what is the configuration I should use?

Thanks for your help!


Hello Marc,

You’re reading the manual for BCC version 1, the BCC2 manual is here:

See sections 4.2 and 5.3.
For shorter time measurements you should be able to just use clock() directly, but to keep track of longer times (hours etc) you need to install a tick handler with bcc_timer_tick_init_period()


1 Like

Hi Magnus,

Thanks for your quick answer.
I did as you said and the program now compiles, thanks!