ChibiOS shell, STM32 and C++, linking problem

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
nameless1379
Posts: 1
Joined: Sun Mar 25, 2018 4:30 am

ChibiOS shell, STM32 and C++, linking problem

Post by nameless1379 »

Dear Giovanni:

I have recently started to use the C++ features of ChibiOS/RT 16.1.9. It works well before I tried to create a shell, and shows some errors on GCC linking as shown below.

Linking build/ch.elf
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-abort.o): In function `abort':
/build/newlib-5zwpxE/newlib-2.2.0+git20150830.5a3d536/build/arm-none-eabi/armv7e-m/fpu/newlib/libc/stdlib/../../../../../../../newlib/libc/stdlib/abort.c:63: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-signalr.o): In function `_kill_r':
/build/newlib-5zwpxE/newlib-2.2.0+git20150830.5a3d536/build/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/signalr.c:61: undefined reference to `_kill'
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-signalr.o): In function `_getpid_r':
/build/newlib-5zwpxE/newlib-2.2.0+git20150830.5a3d536/build/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/signalr.c:97: undefined reference to `_getpid'
collect2: ERROR: ld returned 1 exit status

This problem only occurs when I invoke a "shellCreateStatic" function, and I really cannot solve this by myself. I also included the C++ wrapper which contains these undefined functions in my Makefile, but the result is the same. I am looking forward to your reply.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ChibiOS shell, STM32 and C++, linking problem

Post by Giovanni »

Hi,

You need to include /os/various/syscalls.c

Moved in a support forum.

Giovani
Post Reply