Understanding 3.x syscalls_cpp.cpp

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
dflogeras
Posts: 235
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Understanding 3.x syscalls_cpp.cpp

Post by dflogeras »

Hi,

I am playing around with porting some prototype projects that were built with ChibiOS 2.x to 3.x. I have one in particular which uses C++.

Basically, I used a diff too to "rebase" my chconf/mcuconf/halfconf/Makefile to that of the G++ example in the 3.x demos directory (plus or minus a tweak here and there). After doing so, I began to get link errors from "multiple definition" of symbols (_kill, _exit, _getpid, for example). It seems those stubs are now available through syscalls_cpp.cpp. I am not sure what variable in the Makefile is including this, I can only assume $(CHCPPSRC).

I recalled that in another project, I was advised to use --disable-newlib-supplied-syscalls in my toolchain. I rebuilt with this, and added the C 'syscalls.c' to include the rest and the project linked fine.

However now of course, my old ChibiOS 2.x based C++ will not compile with the same toolchain because it is now _missing_ said symbols that newlib used to provide. I am unsure of the most correct way to handle this. It seems there is no equivalent syscalls_cpp.cpp in Chibi 2.x, and I don't know how to exclude the Chibi 3.x provided syscalls_cpp.cpp and rely on the newlib stubs (or if that is even a good idea).

Any insight would be appreciated.
Post Reply