arduino / ArduinoCore-mbed

348 stars 202 forks source link

`undefined reference` when compiling for `arduino:mbed_nicla:nicla_sense` #943

Closed aliphys closed 3 months ago

aliphys commented 3 months ago

For the Nicla Sense ME (FQBN: arduino:mbed_nicla:nicla_sense ) It is not possible to compile any sketches under Windows for the latest versions of the core and Arduino-cli/IDE.

Even on a BareMinimum sketch, the following error is given. image

"C:\\Users\\Ali Jahangiri\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -E -P -x c "C:\\Users\\Ali Jahangiri\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nicla\\4.1.6\\variants\\NICLA/linker_script.ld" -o "C:\\Users\\Ali Jahangiri\\AppData\\Local\\Temp\\arduino\\sketches\\346DE439FA5447F3074168AC321F36E1/linker_script.ld"
"C:\\Users\\Ali Jahangiri\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" "-LC:\\Users\\Ali Jahangiri\\AppData\\Local\\Temp\\arduino\\sketches\\346DE439FA5447F3074168AC321F36E1" -Wl,--gc-sections -w -Wl,--as-needed "@C:\\Users\\Ali Jahangiri\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nicla\\4.1.6\\variants\\NICLA/ldflags.txt" "-TC:\\Users\\Ali Jahangiri\\AppData\\Local\\Temp\\arduino\\sketches\\346DE439FA5447F3074168AC321F36E1/linker_script.ld" "-Wl,-Map,C:\\Users\\Ali Jahangiri\\AppData\\Local\\Temp\\arduino\\sketches\\346DE439FA5447F3074168AC321F36E1/BareMinimum.ino.map" --specs=nosys.specs -o "C:\\Users\\Ali Jahangiri\\AppData\\Local\\Temp\\arduino\\sketches\\346DE439FA5447F3074168AC321F36E1/BareMinimum.ino.elf" "C:\\Users\\Ali Jahangiri\\AppData\\Local\\Temp\\arduino\\sketches\\346DE439FA5447F3074168AC321F36E1\\sketch\\BareMinimum.ino.cpp.o" "C:\\Users\\Ali Jahangiri\\AppData\\Local\\Temp\\arduino\\sketches\\346DE439FA5447F3074168AC321F36E1\\core\\variant.cpp.o" -Wl,--whole-archive "C:\\Users\\Ali Jahangiri\\AppData\\Local\\Temp\\arduino\\sketches\\346DE439FA5447F3074168AC321F36E1/..\\..\\cores\\arduino_mbed_nicla_nicla_sense_833f20a5d7a4231426a2e42ac1138921\\core.a" "C:\\Users\\Ali Jahangiri\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_nicla\\4.1.6\\variants\\NICLA/libs/libmbed.a" -Wl,--no-whole-archive -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group
C:\Users\Ali Jahangiri\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.6\variants\NICLA/libs/libmbed.a(mbed_boot_gcc_arm.o): In function `__wrap_main':
mbed_boot_gcc_arm.c:(.text.__wrap_main+0x0): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1
aliphys commented 3 months ago

Downgraded package from 4.1.6 (staging) to 4.1.5 by uninstalling and reinstalling the core.

āœ… Sketches compile successfully. Thanks @pennam šŸŒŸ

PS C:\GitHub\Arduino\nicla-sense-me-fw\Arduino_BHY2> arduino-cli core uninstall arduino:mbed_nicla 
Uninstalling arduino:mbed_nicla@4.1.6...
Running pre_uninstall script....
Platform arduino:mbed_nicla@4.1.6 uninstalled
PS C:\GitHub\Arduino\nicla-sense-me-fw\Arduino_BHY2> arduino-cli core install arduino:mbed_nicla  
Tool arduino:arm-none-eabi-gcc@7-2017q4 already installed
Tool arduino:bossac@1.9.1-arduino2 already installed
Tool arduino:dfu-util@0.10.0-arduino1 already installed
Tool arduino:openocd@0.11.0-arduino2 already installed
Tool arduino:rp2040tools@1.0.6 already installed
Downloading packages...
arduino:mbed_nicla@4.1.5 arduino:mbed_nicla@4.1.5 already downloaded
Installing platform arduino:mbed_nicla@4.1.5...
Configuring platform....
Platform arduino:mbed_nicla@4.1.5 installed
PS C:\GitHub\Arduino\nicla-sense-me-fw\Arduino_BHY2> arduino-cli compile -b arduino:mbed_nicla:nicla_sense .\examples\App --library .\           
Sketch uses 308424 bytes (58%) of program storage space. Maximum is 527616 bytes.
Global variables use 38496 bytes (59%) of dynamic memory, leaving 25792 bytes for local variables. Maximum is 64288 bytes.

Used library       Version Path
Arduino_BHY2       1.0.7   C:\GitHub\Arduino\nicla-sense-me-fw\Arduino_BHY2
ArduinoBLE         1.3.7   C:\Users\Ali Jahangiri\Documents\Arduino\libraries\ArduinoBLE
Wire                       C:\Users\Ali Jahangiri\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.5\libraries\Wire
Nicla_Sense_System 1.0     C:\Users\Ali Jahangiri\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.5\libraries\Nicla_System

Used platform      Version Path
arduino:mbed_nicla 4.1.5   C:\Users\Ali Jahangiri\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.5
aliphys commented 3 months ago

I tried upgrading up from 4.1.5 to 4.1.6, and I got a message about arduino:arm-none-eabi-gcc being uninstalled. Maybe this could be interesting to you @pennam šŸ™

Tool arduino:arm-none-eabi-gcc@7-2017q4 already installed
Tool arduino:bossac@1.9.1-arduino2 already installed
Tool arduino:dfu-util@0.10.0-arduino1 already installed
Tool arduino:openocd@0.11.0-arduino2 already installed
Tool arduino:rp2040tools@1.0.6 already installed
Downloading packages
arduino:mbed_nicla@4.1.6
Replacing platform arduino:mbed_nicla@4.1.5 with arduino:mbed_nicla@4.1.6
Uninstalling arduino:mbed_nicla@4.1.5
Running pre_uninstall script.
Platform arduino:mbed_nicla@4.1.5 uninstalled
Uninstalling arduino:arm-none-eabi-gcc@7-2017q4, tool is no more required
Uninstalling arduino:bossac@1.9.1-arduino2, tool is no more required
Uninstalling arduino:dfu-util@0.10.0-arduino1, tool is no more required
Uninstalling arduino:openocd@0.11.0-arduino2, tool is no more required
Uninstalling arduino:rp2040tools@1.0.6, tool is no more required
Configuring platform.
Platform arduino:mbed_nicla@4.1.6 installed