2017-10-06 08:58 AM
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.
Solved! Go to Solution.
2017-11-08 12:10 PM
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.