bolderflight / sbus

Arduino and CMake library for communicating with SBUS receivers and servos.
MIT License
373 stars 132 forks source link

Teensy 3.2 Compilation error with Teensyduino 1.58 #67

Closed Duese123 closed 1 year ago

Duese123 commented 1 year ago

Hello wanted to update my project my lib for sbus was on 2.x.x i now get on Arduiono 1.8.5 and as well >2.x the following error ( i installed teensy via Arduino IDE 2 with adding the link to board manager https://www.pjrc.com/teensy/package_teensy_index.json)

see Teensy

c:/users/xx/appdata/local/arduino15/packages/
c:/users/xx/appdata/local/arduino15/packages/teensy/tools/teensy-compile/11.3.1/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\xx\AppData\Local\Temp\arduino_modified_sketch_862059/sketch_apr16a.ino:44: undefined reference to `bfs::SbusTx::Begin()'
c:/users/xx/appdata/local/arduino15/packages/teensy/tools/teensy-compile/11.3.1/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\xx\AppData\Local\Temp\arduino_build_556759\sketch\sketch_apr16a.ino.cpp.o: in function `loop':
C:\Users\xx\AppData\Local\Temp\arduino_modified_sketch_862059/sketch_apr16a.ino:48: undefined reference to `bfs::SbusRx::Read()'
c:/users/xx/appdata/local/arduino15/packages/teensy/tools/teensy-compile/11.3.1/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\xx\AppData\Local\Temp\arduino_modified_sketch_862059/sketch_apr16a.ino:63: undefined reference to `bfs::SbusTx::Write()'
collect2.exe: error: ld returned 1 exit status

not sure where the issue is

flybrianfly commented 1 year ago

Are you on the latest version of this library downloaded from GitHub?

Duese123 commented 1 year ago

yes and calling specificly the version with #include <C:\Users\xx\Documents\Arduino\libraries\sbus-8.1.4\src\sbus.h>

Iam using the example

installed Teensyduiono with Board manager like described on the page Teensy Install

i think mabye there is a bug. I did not install Teensyduino for 1.8.15 sepcificly but it should becompatible but i think it has to be installed via installer. Since i installed it via Arduino 2.0 it is using the new teensyduino library for 2.x. but it should not matter.

At least i got the same error on both

see webpage

Teensyduino 1.58 supports Arduino versions 1.8.5 and 1.8.9 and 1.8.13 and 1.8.15 and 1.8.16 and 1.8.19. Future versions of Teensyduino will drop support for Arduino 1.8.15 Arduino 2.0.0 and later are supported by use of Arduino Boards Manager.

Duese123 commented 1 year ago

i could get rid of this error by (de-)installing over the arduino IDE 2.x interface... now i can compile but there are some warnings:

c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp: In member function 'bool bfs::SbusRx::Parse()': c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:112:68: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 112 | data_.ch[0] = static_cast<int16_t>(buf_[1] | buf_[2] << 8 & 0x07FF); | ~~~~~~~~~~~~~^~~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:113:73: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 113 | data_.ch[1] = static_cast<int16_t>(buf_[2] >> 3 | buf_[3] << 5 & | ~~~~~~~~~~~~~^ 114 | 0x07FF); | ~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:116:59: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 116 | buf_[5] << 10 & 0x07FF); | ~~~~~~~~~~~~~~^~~~~~~~ c:\Users\x\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:117:73: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 117 | data_.ch[3] = static_cast<int16_t>(buf_[5] >> 1 | buf_[6] << 7 & | ~~~~~~~~~~~~~^ 118 | 0x07FF); | ~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:119:73: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 119 | data_.ch[4] = static_cast<int16_t>(buf_[6] >> 4 | buf_[7] << 4 & | ~~~~~~~~~~~~~^ 120 | 0x07FF); | ~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:122:58: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 122 | buf_[9] << 9 & 0x07FF); | ~~~~~~~~~~~~~^~~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:123:74: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 123 | data_.ch[6] = static_cast<int16_t>(buf_[9] >> 2 | buf_[10] << 6 & | ~~~~~~~~~~~~~~^ 124 | 0x07FF); | ~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:125:75: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 125 | data_.ch[7] = static_cast<int16_t>(buf_[10] >> 5 | buf_[11] << 3 & | ~~~~~~~~~~~~~~^ 126 | 0x07FF); | ~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:127:70: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 127 | data_.ch[8] = static_cast<int16_t>(buf_[12] | buf_[13] << 8 & 0x07FF); | ~~~~~~~~~~~~~~^~~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:128:75: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 128 | data_.ch[9] = static_cast<int16_t>(buf_[13] >> 3 | buf_[14] << 5 & | ~~~~~~~~~~~~~~^ 129 | 0x07FF); | ~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:131:60: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 131 | buf_[16] << 10 & 0x07FF); | ~~~~~~~~~~~~~~~^~~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:132:75: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 132 | data_.ch[11] = static_cast<int16_t>(buf_[16] >> 1 | buf_[17] << 7 & | ~~~~~~~~~~~~~~^ 133 | 0x07FF); | ~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:134:75: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 134 | data_.ch[12] = static_cast<int16_t>(buf_[17] >> 4 | buf_[18] << 4 & | ~~~~~~~~~~~~~~^ 135 | 0x07FF); | ~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:137:59: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 137 | buf_[20] << 9 & 0x07FF); | ~~~~~~~~~~~~~~^~~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:138:75: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 138 | data_.ch[14] = static_cast<int16_t>(buf_[20] >> 2 | buf_[21] << 6 & | ~~~~~~~~~~~~~~^ 139 | 0x07FF); | ~~~~~~ c:\Users\xx\Documents\Arduino\libraries\Bolder_Flight_Systems_SBUS\src\sbus.cpp:140:75: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses] 140 | data_.ch[15] = static_cast<int16_t>(buf_[21] >> 5 | buf_[22] << 3 & | ~~~~~~~~~~~~~~^ 141 | 0x07FF);

flybrianfly commented 1 year ago

Those warnings aren't really bad, but you definitely are not using the most current version of the library. The most current version includes fixes to eliminate the warnings.

Duese123 commented 1 year ago

yep you were right. Seems that Arduino was not using the correct one. it showed: image

i downloaded again the zip and overwrote all data inside the lib now all errors are gone.

Strange that it was not working out of the box with downloading and inserting in libraries folder. i had to go the way through Arduino IDE. I have to say i have installed 1.8.15 and newly 2.x in parallel.

Thank you by the way for your fast reply