Page 1 of 1

Build error with demo code: lvalue requried

Posted: Sat Aug 25, 2012 12:51 am
by bsprajc
Hello all,

Before I spend the time looking for the root cause, has anybody gotten the following error during compilation:

../../os/various/syscalls.c:95:3: warning: implicit declaration of function '__errno_r' [-Wimplicit-function-declaration]
../../os/various/syscalls.c:95:16: error: lvalue required as left operand of assignment

The code which causes this is:
__errno_r(r) = EINVAL;

I'm guessing that __errno_r(r) is a macro which is currently not defined
I'm using Sourcery CodeBench Lite Edition as my toolchain under Linux and the latest (stable) ChibiOS_2.4.2 from Sourceforge.

I will post a solution once I figure out what going on, but if someone has come across this before, I would appreciate if someone who has come across this already, post a solution.

Thanks,
Barry Sprajc

Re: Build error with demo code: lvalue requried

Posted: Sat Aug 25, 2012 6:19 am
by Giovanni
Hi Barry,

The syscall.c you find in ChibiOS is intended for newlib compiled in reentrant mode, this is why all functions have that _r suffix. I am not sure if codesourcery library is compiled in that mode, you should verify this.
If it is not reentrant then you need a slightly different syscall.c, you should read the newlib documentation for details.

Giovanni

Re: Build error with demo code: lvalue requried

Posted: Mon Aug 27, 2012 4:30 am
by bsprajc
Hi Giovanni,

Thank you for your help, which led me to discover that I installed the wrong Code Sorcery toolchain which was arm-none-linux-eabi.

I installed arm-none-eabi, and now the demo compiles perfectly.

I'm looking forward to using your OS, and the simplicity of it, along with the open source toolchain and LInux st-link utilities for GDB.
This will be a much more familiar environment for me than the commercial alternatives out there.

Barry