I will start by saying, I am able to compile, flash and successfully debug the most basic blink
sketch on the Portenta C33, so I know my platform is configured correctly.
However, once I include the ArduinoIoTCloud
library from Arduino. PlatformIO fails to compile the basic sample provided by the library. To confirm the sketch does not have a syntax error, I compiled the basic sample on both the Arduino IDE 2.x and the Arduino Cloud Create IDE.
When I attempt to compile the basic sample on PlatformIO, it fails to find files for compilation:
Processing portenta_c33 (platform: renesas-ra; board: portenta_c33; framework: arduino)
----------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/renesas-ra/portenta_c33.html
PLATFORM: Renesas RA (1.3.0) > Arduino Portenta C33
HARDWARE: R7FA6M5BH2CBG 200MHz, 511.35KB RAM, 2MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinorenesas-portenta @ 1.0.5
- tool-dfuutil-arduino @ 1.11.0
- toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
Converting ArduinoIoTCloud_Basic.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 38 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ArduinoIoTCloud @ 1.13.0
|-- Arduino_ConnectionHandler @ 0.8.1
Building in release mode
Compiling .pio/build/portenta_c33/src/ArduinoIoTCloud_Basic.ino.cpp.o
Compiling .pio/build/portenta_c33/lib114/ESPhost/CEspControl.cpp.o
In file included from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/ESPhost/src/CEspControl.h:38:0,
from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/ESPhost/src/CEspControl.cpp:21:
/home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/lwIpWrapper/src/CNetIf.h:13:10: fatal error: EthernetDriver.h: No such file or directory
************************************************************************
* Looking for EthernetDriver.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:EthernetDriver.h"
* Web > https://registry.platformio.org/search?q=header:EthernetDriver.h
*
************************************************************************
#include "EthernetDriver.h"
^~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/portenta_c33/lib9b3/Ethernet/Ethernet.cpp.o
Compiling .pio/build/portenta_c33/lib9b3/Ethernet/EthernetSSLClient.cpp.o
Archiving .pio/build/portenta_c33/lib433/liblwIpWrapper.a
Archiving .pio/build/portenta_c33/libbb9/libWiFi.a
Indexing .pio/build/portenta_c33/lib433/liblwIpWrapper.a
Indexing .pio/build/portenta_c33/libbb9/libWiFi.a
In file included from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/lwIpWrapper/src/lwipClient.h:5:0,
from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/Ethernet/src/EthernetClient.h:5,
from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/Ethernet/src/EthernetC33.h:14,
from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/Ethernet/src/Ethernet.cpp:1:
/home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/lwIpWrapper/src/CNetIf.h:10:10: fatal error: CCtrlWrapper.h: No such file or directory
**********************************************************************
* Looking for CCtrlWrapper.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:CCtrlWrapper.h"
* Web > https://registry.platformio.org/search?q=header:CCtrlWrapper.h
*
**********************************************************************
#include "CCtrlWrapper.h"
^~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/lwIpWrapper/src/lwipClient.h:5:0,
from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/Ethernet/src/EthernetClient.h:5,
from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/Ethernet/src/EthernetSSLClient.h:4,
from /home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/Ethernet/src/EthernetSSLClient.cpp:1:
/home/zak/.platformio/packages/framework-arduinorenesas-portenta/libraries/lwIpWrapper/src/CNetIf.h:10:10: fatal error: CCtrlWrapper.h: No such file or directory
**********************************************************************
* Looking for CCtrlWrapper.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:CCtrlWrapper.h"
* Web > https://registry.platformio.org/search?q=header:CCtrlWrapper.h
*
**********************************************************************
#include "CCtrlWrapper.h"
^~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/portenta_c33/lib2fb/Arduino_ConnectionHandler/Arduino_LoRaConnectionHandler.cpp.o
Compiling .pio/build/portenta_c33/lib2fb/Arduino_ConnectionHandler/Arduino_NBConnectionHandler.cpp.o
Compiling .pio/build/portenta_c33/lib2fb/Arduino_ConnectionHandler/Arduino_WiFiConnectionHandler.cpp.o
Compiling .pio/build/portenta_c33/lib964/RTC/RTC.cpp.o
Compiling .pio/build/portenta_c33/lib3eb/ArduinoMqttClient/MqttClient.cpp.o
Compiling .pio/build/portenta_c33/lib607/ArduinoIoTCloud/ArduinoIoTCloud.cpp.o
Compiling .pio/build/portenta_c33/lib607/ArduinoIoTCloud/ArduinoIoTCloudLPWAN.cpp.o
Compiling .pio/build/portenta_c33/lib607/ArduinoIoTCloud/ArduinoIoTCloudTCP.cpp.o
Compiling .pio/build/portenta_c33/lib607/ArduinoIoTCloud/cbor/CBORDecoder.cpp.o
Compiling .pio/build/portenta_c33/lib607/ArduinoIoTCloud/cbor/CBOREncoder.cpp.o
Compiling .pio/build/portenta_c33/lib607/ArduinoIoTCloud/cbor/lib/tinycbor/src/cborencoder.c.o
Compiling .pio/build/portenta_c33/lib607/ArduinoIoTCloud/cbor/lib/tinycbor/src/cborencoder_close_container_checked.c.o
Compiling .pio/build/portenta_c33/lib607/ArduinoIoTCloud/cbor/lib/tinycbor/src/cborerrorstrings.c.o
Compiling .pio/build/portenta_c33/lib607/ArduinoIoTCloud/cbor/lib/tinycbor/src/cborparser.c.o
*** [.pio/build/portenta_c33/lib114/ESPhost/CEspControl.cpp.o] Error 1
*** [.pio/build/portenta_c33/lib9b3/Ethernet/Ethernet.cpp.o] Error 1
*** [.pio/build/portenta_c33/lib9b3/Ethernet/EthernetSSLClient.cpp.o] Error 1
===================== [FAILED] Took 4.37 seconds =====================
* The terminal process "platformio 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
I looked at .vscode/c_cpp_properties.json
and I can see entries in the include path for the folders containing the “missing” files. Interestingly, if I included them manually in the platformio.ini
file, then it was able to complete the build. Unfortunately, the next problem becomes linker errors.
...
Archiving .pio/build/portenta_c33/lib607/libArduinoIoTCloud.a
Indexing .pio/build/portenta_c33/lib607/libArduinoIoTCloud.a
Archiving .pio/build/portenta_c33/libFrameworkArduino.a
Indexing .pio/build/portenta_c33/libFrameworkArduino.a
Linking .pio/build/portenta_c33/firmware.elf
.pio/build/portenta_c33/libbf8/libStorage.a(storage_retarget.cpp.o): In function `_close':
storage_retarget.cpp:(.text._close+0x0): multiple definition of `_close'
/home/zak/.platformio/packages/toolchain-gccarmnoneeabi@1.70201.0/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v8-m.main/fpv5-sp/hard/libnosys.a(close.o):close.c:(.text._close+0x0): first defined here
.pio/build/portenta_c33/libbf8/libStorage.a(storage_retarget.cpp.o): In function `_write':
storage_retarget.cpp:(.text._write+0x0): multiple definition of `_write'
/home/zak/.platformio/packages/toolchain-gccarmnoneeabi@1.70201.0/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v8-m.main/fpv5-sp/hard/libnosys.a(write.o):write.c:(.text._write+0x0): first defined here
.pio/build/portenta_c33/libbf8/libStorage.a(storage_retarget.cpp.o): In function `_read':
storage_retarget.cpp:(.text._read+0x0): multiple definition of `_read'
/home/zak/.platformio/packages/toolchain-gccarmnoneeabi@1.70201.0/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v8-m.main/fpv5-sp/hard/libnosys.a(read.o):read.c:(.text._read+0x0): first defined here
.pio/build/portenta_c33/libbf8/libStorage.a(storage_retarget.cpp.o): In function `_lseek':
storage_retarget.cpp:(.text._lseek+0x0): multiple definition of `_lseek'
/home/zak/.platformio/packages/toolchain-gccarmnoneeabi@1.70201.0/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v8-m.main/fpv5-sp/hard/libnosys.a(lseek.o):lseek.c:(.text._lseek+0x0): first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/portenta_c33/firmware.elf] Error 1
===================== [FAILED] Took 9.21 seconds =====================
* The terminal process "platformio 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
Instead of slogging through it on my own, I thought it was best to report here and get advice from the experts.
Cheers,
Zak
NOTE: In case it helps, here is the compile command from the build log of the Arduino IDE 2.x, so you can compare and contrast which build flags and defines it is using to compile.
/home/zak/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -Wall -Wextra -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=200000000 -MMD -std=gnu++17 -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"/tmp/arduino/sketches/1BA883498A5D9CC7DF51698757F9B440/ArduinoIoTCloud_Basic.ino\"" -DARDUINO_PORTENTA_C33 -DARDUINO_ARCH_RENESAS_PORTENTA -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb @/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/variants/PORTENTA_C33/defines.txt -DLWIP_DNS=1 -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/cores/arduino/tinyusb -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/cores/arduino/api/deprecated -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/cores/arduino/api/deprecated-avr-comp -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/cores/arduino -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/variants/PORTENTA_C33 -I/home/zak/Development/Arduino/libraries/ArduinoIoTCloud/src -I/home/zak/Development/Arduino/libraries/Arduino_ConnectionHandler/src -I/home/zak/Development/Arduino/libraries/Arduino_DebugUtils/src -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/WiFi/src -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/lwIpWrapper/src -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/ESPhost/src -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/Ethernet/src -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/SE05X/src -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/SSLClient/src -I/home/zak/Development/Arduino/libraries/ArduinoMqttClient/src -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/RTC/src -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/Wire -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/BlockDevices -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/FATFilesystem -I/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/Storage -iprefix/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5 @/home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/variants/PORTENTA_C33/includes.txt /home/zak/.arduino15/packages/arduino/hardware/renesas_portenta/1.0.5/libraries/ESPhost/src/CEspControl.cpp -o /tmp/arduino/sketches/1BA883498A5D9CC7DF51698757F9B440/libraries/ESPhost/CEspControl.cpp.o
From a quick scan of the
compilerArgs
inc_cpp_properties.json
, PlatformIO appears to be missing the following flags:"-fno-use-cxa-atexit", "-fno-rtti", "-fno-exceptions", "-MMD", "-nostdlib", "-std=gnu17", "-fsigned-char", "-ffunction-sections", "-fdata-sections", "-fmessage-length=0", "-fno-builtin",