-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the bug
Using the newlib libc in Zephyr, the clock() and/or time() functions call the _times_r function which requires the _times function to be supplied, but this function is missing and the compilation fails at link time.
I have tested this while trying to create a lua module for Zephyr. Lua uses both the clock() and the time() function and the compilation fails with the following error:
... zephyr-sdk-0.15.0/arm-zephyr-eabi/arm-zephyr-eabi/lib/thumb/v7e-m/nofp/libc.a(lib_a-timesr.o): in function _times_r': timesr.c:(.text._times_r+0x2): undefined reference to
_times'
collect2: error: ld returned 1 exit status
To Reproduce
I prepared a hello_world example available at: https://github.com/tenllado/zephyr_hello_world_lua
The README.md file contains instructions to compile it as a west workspace. The project includes a file src/missing_stubs.c a definition of _times (and also _unlink, which is also missing in Zephyr). If you comment the _times definition you will obtain the error mentioned above.
Expected behavior
Zephyr should be including a definition of the _times function for the newlib libc library.
Impact
The absence of this function prevents the full support of the lua library for the zephyr project.
Environment (please complete the following information):
- OS: Linux
- Toolchain: zephyr-sdk-0.15.0
- Commit SHA: sha for the zephyr project is 8db84cf