Libuavcan interfacing with chibios


I’m trying to interface libuavcan with chibios. I’ve made changes to main make file by comparing with libuavcan\libuavcan_drivers\stm32\test_stm32f107\Makefile. But I’m getting below error which i’m unable to resolve.
I’m new to uavcan, chibios and c++ as well. Please help me to resolve this problem.

                 from ..libuavcan/libuavcan/include/uavcan/build_config.hpp:32:6: warning: "__cplusplus" is not defined, evaluates to 0 [-Wundef]
   32 | # if __cplusplus > 201200
      |      ^~~~~~~~~~~
..libuavcan/libuavcan/include/uavcan/build_config.hpp:34:9: warning: "__cplusplus" is not defined, evaluates to 0 [-Wundef]
   34 | # elif (__cplusplus > 201100) || defined(__GXX_EXPERIMENTAL_CXX0X__)
      |         ^~~~~~~~~~~
../libuavcan/libuavcan/include/uavcan/build_config.hpp:210:1: error: unknown type name 'namespace'
  210 | namespace uavcan
      | ^~~~~~~~~
../libuavcan/libuavcan/include/uavcan/build_config.hpp:211:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  211 | {
      | ^

You are trying to include a C++ header file into a C file, this is not permitted, so don’t do that.

Also, UAVCAN has ceased to exist. There are two successor projects: DroneCAN for legacy systems, Cyphal for modern systems. More info:

1 Like

Thankyou @pavel.kirienko.

Yes I’ve included header files in main.c file. And renaming it to main.cpp worked.

Yes I’ll note that and switch to DroneCAN.

Thankyou for your time:)