Build error with demo code: lvalue requried

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
bsprajc
Posts: 6
Joined: Fri Aug 24, 2012 11:28 pm

Build error with demo code: lvalue requried

Post 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
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Build error with demo code: lvalue requried

Post 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
bsprajc
Posts: 6
Joined: Fri Aug 24, 2012 11:28 pm

Re: Build error with demo code: lvalue requried

Post 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
Post Reply