After a longer sabbatical I’ve started again working on a small library. After the necessary updates nearly everything worked as fine as before - with one weird exception. Running the tests for a d1_mini-board aborts with a linkage error
~/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pio/build/d1_mini/test/Mock_Adafruit_GFX.cpp.o:(.text._ZN7testing8internal17SharedPayloadBase3RefEv[_ZN7testing8internal17SharedPayloadBase3RefEv]+0x0): undefined reference to `__atomic_fetch_add_4'
~/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pio/build/d1_mini/test/Mock_Adafruit_GFX.cpp.o:(.text._ZN7testing8internal17SharedPayloadBase5UnrefEv[_ZN7testing8internal17SharedPayloadBase5UnrefEv]+0x0): undefined reference to `__atomic_fetch_sub_4'
~/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pio/build/d1_mini/test/Mock_Adafruit_GFX.cpp.o: in function `_ZN7testing8internal17SharedPayloadBase5UnrefEv':
Mock_Adafruit_GFX.cpp:(.text._ZN7testing8internal17SharedPayloadBase5UnrefEv[_ZN7testing8internal17SharedPayloadBase5UnrefEv]+0xe): undefined reference to `__atomic_fetch_sub_4'
The test is using gmock for mocking Adafruit_GFX resp. XPT2046_Touchscreen. nm shows me that the object-files containing those missing references are the two mock-classes and the test-class
xtensa-lx106-elf-nm -l .pio/build/d1_mini/test/*.o |grep atomic
U __atomic_fetch_add_4
U __atomic_fetch_sub_4 Mock_Adafruit_GFX.cpp:0
U __atomic_fetch_add_4 Mock_XPT2046_Touchscreen.cpp:0
U __atomic_fetch_sub_4 Mock_XPT2046_Touchscreen.cpp:0
U __atomic_fetch_add_4
U __atomic_fetch_sub_4 test_ete.cpp:0
Running the same tests for an esp32 works fine.
My platformio.ini looks like that
[platformio]
default_envs =
esp32dev
d1_mini
[env]
framework = arduino
test_framework = googletest
lib_deps =
Wire
googletest
Adafruit GFX Library
XPT2046_Touchscreen
Adafruit BusIO
test_build_src = true
[env:esp32dev]
platform = espressif32
board = esp32dev
lib_ignore = ArduinoFake
test_port=/dev/ttyUSB0
test_speed=921600
monitor_port = /dev/ttyUSB0
monitor_speed=921600
[env:d1_mini]
platform = espressif8266
board = d1_mini
lib_ignore = ArduinoFake
test_speed=460800
test_port=/dev/ttyUSB0
monitor_speed=460800
monitor_port = /dev/ttyUSB0
build_flags =
-D PIO_FRAMEWORK_ARDUINO_MMU_CUSTOM
-D MMU_IRAM_SIZE=0xC000
-D MMU_ICACHE_SIZE=0x4000
-D MMU_IRAM_HEAP
Any idea what’s going wrong?