A-Star 32U4, linker issues in the Arduino slave program when using I2C code

There is a linker issue when using any code that wants to use Wire(I2C) other then the code that’s a I2C hack for raspberry<->controller communication. I’d like to use some other pololu libraries, like the one for the LSM303 or the one for the vl53l0x but i can’t include them in the sketch due to this bug.

Is there a way around this ? Is this a known issue ?

Arduino is at version 1.8.5 i’m using the latest code from github for the board definitions and the arduino slave library itself

A simple project that demonstrates the error is attached

pololu_slave.ino (2.1 KB)

Linking everything together...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega32u4  -o "C:\Users\atom\AppData\Local\Temp\arduino_build_564325/pololu_slave.ino.elf" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\sketch\pololu_slave.ino.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\lsm303-arduino\LSM303.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Timer\Event.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Timer\Timer.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Adafruit_NeoPixel\esp8266.c.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Servo\avr\Servo.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Servo\nrf52\Servo.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Servo\sam\Servo.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Servo\samd\Servo.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Servo\stm32f4\Servo.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\a-star-32u4-arduino-library\AStar32U4.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\a-star-32u4-arduino-library\AStar32U4Motors.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\a-star-32u4-arduino-library\PololuBuzzer.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\a-star-32u4-arduino-library\PololuHD44780.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\a-star-32u4-arduino-library\Pushbutton.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\pololu-rpi-slave-arduino-library\PololuTWISlave.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Wire\Wire.cpp.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Wire\utility\twi.c.o" "C:\Users\atom\AppData\Local\Temp\arduino_build_564325/..\arduino_cache_247973\core\core_pololu-a-star_avr_a-star32U4_0c812875ac70eb4a9b385d8fb077f54c.a" "-LC:\Users\atom\AppData\Local\Temp\arduino_build_564325" -lm
C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\Wire\utility\twi.c.o (symbol from plugin): In function `twi_readFrom':

(.text+0x0): multiple definition of `__vector_36'

C:\Users\atom\AppData\Local\Temp\arduino_build_564325\libraries\pololu-rpi-slave-arduino-library\PololuTWISlave.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

Hi, atomix1040.

Amanda posted a reply to you earlier, but we realized that some of information in it was inaccurate, so we’ve removed her original post and a (hopefully) better answer follows.

The Raspberry Pi slave library for Arduino was not designed to allow the A-Star to be an I2C master, which would be necessary to allow it to read from your sensors. In addition, since it needs to be fast, it accesses the I2C (TWI) peripheral on the AVR directly at a low level. This means it conflicts with the Wire library, and the two libraries cannot be used in the same program.

The easiest way to use your sensors with a Raspberry Pi master + A-Star slave system is to have the Raspberry Pi act as the I2C master for communications with the sensors as well (that is, the Raspberry Pi, not the A-Star, would read the sensors and process their data). There are some code examples for using both the LSM303D and VL53L0X sensors under the “Resources” tab on their product pages. You might also find it useful to look at the “balboa” branch of the repository to see an example of a Raspberry Pi python program that both reads from a sensor (in this case, an LSM6DS33) and controls an A-Star running the slave library.

Kevin