sparkfun / Arduino_Apollo3

Arduino core to support the Apollo3 microcontroller from Ambiq Micro
83 stars 38 forks source link

Compilation of some Arduino libraries fails for LoRa Thing Plus Explorable #417

Closed amirna2 closed 2 years ago

amirna2 commented 3 years ago

Subject of the issue

I am testing several very common Arduino Libraries such as ArduinoJSON or the Adafruit sensor Libraries. They all fail with various compilation errors when using the SparkFun Apollo3 Arduino core. I am currently testing with the LoRa explorable board.

Your workbench

Steps to reproduce

Expected behaviour

Compiling sketch...
/Users/anathoo/Library/Arduino15/packages/SparkFun/tools/arm-none-eabi-gcc/8-2018-q4-major/bin/arm-none-eabi-g++ -include /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/mbed_config.h -include /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/sdk/ArduinoSDK.h -iprefix /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/ @/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.cxx-flags -MMD -DARDUINO=10815 -DARDUINO_LoRa_THING_PLUS_expLoRaBLE -DARDUINO_ARCH_MBED -DARDUINO_ARCH_APOLLO3 -DMBED_NO_GLOBAL_USING_DIRECTIVE -DCORDIO_ZERO_COPY_HCI @/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.cxx-symbols -I/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino -I/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/variants/LoRa_THING_PLUS_expLoRaBLE -I/Users/anathoo/Documents/Arduino/libraries/ArduinoJson/src -I/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino -I/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge -I/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge/core-api -I/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge/core-api/api/deprecated @/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.includes /var/folders/57/0h65vzcn5px_061yp_bmc31r0000gn/T/arduino_build_707631/sketch/StringExample.ino.cpp -o /var/folders/57/0h65vzcn5px_061yp_bmc31r0000gn/T/arduino_build_707631/sketch/StringExample.ino.cpp.o
In file included from /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge/core-api/api/String.h:33,
                 from /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge/core-api/api/Print.h:24,
                 from /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge/core-api/api/Stream.h:25,
                 from /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge/core-api/api/Client.h:22,
                 from /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge/core-api/api/ArduinoAPI.h:29,
                 from /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge/Arduino.h:17,
                 from /Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/sdk/ArduinoSDK.h:9,
                 from <command-line>:
/Users/anathoo/Documents/Arduino/libraries/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace_generic.hpp: In instantiation of 'typename ArduinoJson6180_91::enable_if<ArduinoJson6180_91::is_pointer<T>::value, T>::type ArduinoJson6180_91::pgm_read(const void*) [with T = const arduino::__FlashStringHelper*; typename ArduinoJson6180_91::enable_if<ArduinoJson6180_91::is_pointer<T>::value, T>::type = const arduino::__FlashStringHelper*]':
/Users/anathoo/Documents/Arduino/libraries/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp:100:12:   required from here
/Users/anathoo/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.1.1/cores/arduino/mbed-bridge/core-api/api/deprecated-avr-comp/avr/pgmspace.h:106:29: error: 'const void*' is not a pointer-to-object type
 #define pgm_read_ptr(addr) (*(const void *)(addr))
                            ~^~~~~~~~~~~~~~~~~~~~~~
Using library ArduinoJson at version 6.18.0 in folder: /Users/anathoo/Documents/Arduino/libraries/ArduinoJson 
exit status 1
Error compiling for board LoRa Thing Plus expLoRaBLE.
amirna2 commented 3 years ago

I have a workaround for this issue in pgmspace.h where the error is happening

//#define pgm_read_ptr(addr) (*(const void *)(addr))
#define pgm_read_ptr(addr) (*reinterpret_cast<const void* const *>(addr))
Wenn0101 commented 3 years ago

Thanks for the report!

I will add this to my To-Do to look into this.

Wenn0101 commented 2 years ago

Issue resolved when arduino api was updated to v1.2.0