Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


You are viewing a reply to undefined reference to `_times'  

undefined reference to `_times'

France

Hi,

Obviously, it’s not in this routine that you reference times; however, as you provide assembly code, the fact you call this function will link in your program all other code from the same source file, so I suspect the problem may come from other pieces of code in the same file (even if they are not called...)

Note that the times’ C library routine is useless on an MCU (it summarize execution time for a linux process and its children) and needs a support function called _times’’ to gather these, function that does not exist as it has no use. You could just provide it in syscalls.c by adding:

#include "sys/times.h"
clock_t _times(struct tms* tms) {
    errno = EINVAL;
    return (clock_t)-1;
}

However this will just allow your code to link, but either it will not work as expected (if times if effectively called) or will contain dead code (due to your assembly-level code).

Just a question: why did you code in assembly language, instead of C? Your function could as well have been written in C; moreover you seem to pass only one single parameter in the R3 register, which is quite unusual (parameters must be passed in R0, R1, R2 and R3, that do not have to be saved as they are scratch registers). As is, your function could only be called from assembly-level code, not from C code.

Bernard (Ac6)