cancel
Showing results for 
Search instead for 
Did you mean: 

Is this bug? timezone definition in syscalls.c generated by cube mx

Nick Steele
Associate II
Posted on October 06, 2017 at 17:58

While compiling a project with syscalls.c generated by cube mx, there is a block like this:

  #ifdef _SYS_TIME_H_

  struct timezone {

    int tz_minuteswest; /* minutes west of Greenwich */

    int tz_dsttime; /* type of dst correction */

  };

#endif

and the file includes <time.h> at top. Since _SYS_TIME_H_ is defined in time.h, syscall.c redefines the timezone struct causing a compiler error. My guess is that it is supposed to be #ifndef _SYS_TIME_H_ ? I'm circumventing the error by adding  a preceding '#undef _SYS_TIME_H_' to syscalls.c in a /* USER CODE BEGIN */ section.

10 REPLIES 10
Posted on November 08, 2017 at 20:10

Hi,

I had this issue before as well, and I found out what was the cause for me.

To enable OpenOCD printf debugging, I added to the compiler these arguments:

-specs=rdimon.specs

-lc

-lrdimon

Which caused the conflict with sys_calls.c source code.

I can't remember were I read it, but it is an expected outcome when using arm gcc,

since it embeds its own libraries, when those arguments are provided.

If you don't add those compiler arguments, it works just as intended, compiles without any issues!

Obviously, you can't use printf to write in OpenOCD console.