1_GPS_FEATURES in AssetTracker library won't compile

Hello, I’m struggling to get the 1-gps-features.ino example from the AssetTracker library to compile in the WebIDE. I’m trying to load it onto an Electron. Logs below. Any support much appreciated please, thanks!

lib/Adafruit_LIS3DH/Adafruit_LIS3DH.cpp:320:1: no return statement in function returning non-void [-Werror=return-type]

Error: Could not compile. Please review your code.
Processing  1_gps_features.ino
Checking library AssetTracker...
Installing library AssetTracker 0.0.10 to lib/AssetTracker ...
Library AssetTracker 0.0.10 installed.
Checking library Adafruit_GPS...
Checking library Adafruit_LIS3DH...
Installing library Adafruit_GPS 1.0.3 to lib/Adafruit_GPS ...
Installing library Adafruit_LIS3DH 1.0.3 to lib/Adafruit_LIS3DH ...
Library Adafruit_LIS3DH 1.0.3 installed.
Checking library Adafruit_Sensor...
Library Adafruit_GPS 1.0.3 installed.
Installing library Adafruit_Sensor 1.0.2 to lib/Adafruit_Sensor ...
Library Adafruit_Sensor 1.0.2 installed.
make -C ../modules/electron/user-part all
make[1]: Entering directory `/firmware/modules/electron/user-part'
make -C ../../../user 
make[2]: Entering directory `/firmware/user'
Building cpp file: src/1_gps_features.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-10-msrc/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=10 -DPLATFORM_NAME=electron -DPLATFORM_GEN=2 -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00A -DUSBD_PID_CDC=0xC00A -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb --specs=nano.specs -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=10 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING=2.3.0 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../services/inc -I../third_party/nanopb/nanopb -I../communication/inc -I../hal/inc -I../hal/shared -I../hal/src/electron -I../hal/src/stm32f2xx -I../hal/src/stm32 -I../hal/network -I../hal/network/util -I../third_party/freertos/freertos/FreeRTOS/Source/include -I../third_party/freertos/freertos/FreeRTOS/Source/portable/GCC/ARM_CM3 -I../platform/shared/inc -I../platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I../platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F2xx/CMSIS/Include -I../platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I../dynalib/inc -Isrc -I./libraries -Ilib/Adafruit_Sensor/src -Ilib/Adafruit_LIS3DH/src -Ilib/AssetTracker/src -Ilib/Adafruit_GPS/src -I. -MD -MP -MF ../build/target/user/platform-10-msrc/1_gps_features.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Werror=return-type -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLATFORM_NET=UBLOXSARA -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x8080000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=6 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,2,2301 -DMODULE_DEPENDENCY2=0,0,0 -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -flto -ffat-lto-objects -DPARTICLE_COMPILE_LTO_FAT -fno-use-cxa-atexit -std=gnu++14 -c -o ../build/target/user/platform-10-msrc/1_gps_features.o src/1_gps_features.cpp
1_gps_features.ino: In function 'void loop()':
1_gps_features.ino:57:30: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'int' [-Wsign-compare]

Building cpp file: lib/Adafruit_Sensor/src/Adafruit_Sensor.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-10-mAdafruit_Sensor/src/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=10 -DPLATFORM_NAME=electron -DPLATFORM_GEN=2 -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00A -DUSBD_PID_CDC=0xC00A -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb --specs=nano.specs -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=10 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING=2.3.0 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../services/inc -I../third_party/nanopb/nanopb -I../communication/inc -I../hal/inc -I../hal/shared -I../hal/src/electron -I../hal/src/stm32f2xx -I../hal/src/stm32 -I../hal/network -I../hal/network/util -I../third_party/freertos/freertos/FreeRTOS/Source/include -I../third_party/freertos/freertos/FreeRTOS/Source/portable/GCC/ARM_CM3 -I../platform/shared/inc -I../platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I../platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F2xx/CMSIS/Include -I../platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I../dynalib/inc -Isrc -I./libraries -Ilib/Adafruit_Sensor/src -Ilib/Adafruit_LIS3DH/src -Ilib/AssetTracker/src -Ilib/Adafruit_GPS/src -I. -MD -MP -MF ../build/target/user/platform-10-mAdafruit_Sensor/src/Adafruit_Sensor.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Werror=return-type -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLATFORM_NET=UBLOXSARA -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x8080000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=6 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,2,2301 -DMODULE_DEPENDENCY2=0,0,0 -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -flto -ffat-lto-objects -DPARTICLE_COMPILE_LTO_FAT -fno-use-cxa-atexit -std=gnu++14 -c -o ../build/target/user/platform-10-mAdafruit_Sensor/src/Adafruit_Sensor.o lib/Adafruit_Sensor/src/Adafruit_Sensor.cpp

Building cpp file: lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-10-mAdafruit_LIS3DH/src/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=10 -DPLATFORM_NAME=electron -DPLATFORM_GEN=2 -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00A -DUSBD_PID_CDC=0xC00A -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb --specs=nano.specs -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=10 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING=2.3.0 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../services/inc -I../third_party/nanopb/nanopb -I../communication/inc -I../hal/inc -I../hal/shared -I../hal/src/electron -I../hal/src/stm32f2xx -I../hal/src/stm32 -I../hal/network -I../hal/network/util -I../third_party/freertos/freertos/FreeRTOS/Source/include -I../third_party/freertos/freertos/FreeRTOS/Source/portable/GCC/ARM_CM3 -I../platform/shared/inc -I../platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I../platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F2xx/CMSIS/Include -I../platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I../dynalib/inc -Isrc -I./libraries -Ilib/Adafruit_Sensor/src -Ilib/Adafruit_LIS3DH/src -Ilib/AssetTracker/src -Ilib/Adafruit_GPS/src -I. -MD -MP -MF ../build/target/user/platform-10-mAdafruit_LIS3DH/src/Adafruit_LIS3DH.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Werror=return-type -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLATFORM_NET=UBLOXSARA -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x8080000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=6 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,2,2301 -DMODULE_DEPENDENCY2=0,0,0 -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -flto -ffat-lto-objects -DPARTICLE_COMPILE_LTO_FAT -fno-use-cxa-atexit -std=gnu++14 -c -o ../build/target/user/platform-10-mAdafruit_LIS3DH/src/Adafruit_LIS3DH.o lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp
In file included from lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp:31:
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.h: In constructor 'Adafruit_LIS3DH::Adafruit_LIS3DH()':
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.h:233:29: warning: 'Adafruit_LIS3DH::_sck' will be initialized after [-Wreorder]
  233 |   int8_t _cs, _mosi, _miso, _sck;
      |                             ^~~~
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.h:229:11: warning:   'int32_t Adafruit_LIS3DH::_sensorID' [-Wreorder]
  229 |   int32_t _sensorID;
      |           ^~~~~~~~~
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp:40:1: warning:   when initialized here [-Wreorder]
   40 | Adafruit_LIS3DH::Adafruit_LIS3DH()
      | ^~~~~~~~~~~~~~~
In file included from lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp:31:
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.h: In constructor 'Adafruit_LIS3DH::Adafruit_LIS3DH(int8_t)':
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.h:233:29: warning: 'Adafruit_LIS3DH::_sck' will be initialized after [-Wreorder]
  233 |   int8_t _cs, _mosi, _miso, _sck;
      |                             ^~~~
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.h:229:11: warning:   'int32_t Adafruit_LIS3DH::_sensorID' [-Wreorder]
  229 |   int32_t _sensorID;
      |           ^~~~~~~~~
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp:45:1: warning:   when initialized here [-Wreorder]
   45 | Adafruit_LIS3DH::Adafruit_LIS3DH(int8_t cspin)
      | ^~~~~~~~~~~~~~~
In file included from lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp:31:
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.h: In constructor 'Adafruit_LIS3DH::Adafruit_LIS3DH(int8_t, int8_t, int8_t, int8_t)':
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.h:233:29: warning: 'Adafruit_LIS3DH::_sck' will be initialized after [-Wreorder]
  233 |   int8_t _cs, _mosi, _miso, _sck;
      |                             ^~~~
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.h:229:11: warning:   'int32_t Adafruit_LIS3DH::_sensorID' [-Wreorder]
  229 |   int32_t _sensorID;
      |           ^~~~~~~~~
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp:49:1: warning:   when initialized here [-Wreorder]
   49 | Adafruit_LIS3DH::Adafruit_LIS3DH(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin)
      | ^~~~~~~~~~~~~~~
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp: In member function 'virtual bool Adafruit_LIS3DH::getEvent(sensors_event_t*)':
lib/Adafruit_LIS3DH/src/Adafruit_LIS3DH.cpp:320:1: error: no return statement in function returning non-void [-Werror=return-type]
  320 | }
      | ^
cc1plus: some warnings being treated as errors
make[2]: *** [../build/target/user/platform-10-mAdafruit_LIS3DH/src/Adafruit_LIS3DH.o] Error 1
make[2]: Leaving directory `/firmware/user'
make[1]: *** [user] Error 2
make[1]: Leaving directory `/firmware/modules/electron/user-part'
make: *** [modules/electron/user-part] Error 2```

This is the error that breaks the build

And here is the culprit

The function signature promises to return a bool but the function never does.

@Colleen, could you please also take on this library to get repaired?
As it appears there is no contributor’s repo to file an issue.
library.properties only provides a link to the original Adafruit repo where this issue was already taken care of but never made it into the Particle libraries repository.

I would use the AssetTrackerRK library instead.

The Adafruit_LIS3DH library is a fork that was made 6 years ago and hasn’t been updated since. Also even without the compile error, I’m pretty sure that example did not work properly. The AssetTracker library hasn’t been updated since 2017 and the hardware has been discontinued for years.

1 Like

Thank you! That worked nicely. I now have a slightly different problem: I’ve flashed the “wake_on_move” example but now can’t flash any new code as the device is asleep! How do I get around this please?

Hold down the MODE button and tap RESET. Continue to hold down MODE until the status LED blinks magenta (red and blue at the same time), then release MODE. This will enter safe mode so your firmware does not run and the device does not sleep. Once you get to breathing magenta you can flash your code OTA.

Thanks!

Hi

So what’s the exact solution to the error?
lib/Adafruit_LIS3DH/Adafruit_LIS3DH.cpp:320:1: no return statement in function returning non-void [-Werror=return-type]

I cannot edit the Adafruit_LIS3DH.cpp ?

Appreciate your help. I thought programming the Tracker one was easy as the Electron. :frowning:

Neither the Electron AssetTracker nor the AssetTrackerRK library can be used on the Tracker SoM or Tracker One. You should use the Tracker Edge firmware that is intended for use on the Tracker. It includes the necessary libraries to work with the GNSS on the Tracker.

If you really wanted to use the Electron AssetTracker with a newer version of Device OS (on the Electron), the easiest way is to use Particle Workbench. Install the library in your project, then remove the line for Adaffruit_LIS3DH from the project.properties. Then you can edit the source in the lib directory to add the missing return statement.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.