Open gutzchi opened 2 years ago
Hi @gutzchi , the only thing that comes to my mind is that platformio could be using a different version of the compiler. Any other explanation, given the exact same source code and compilation flags is very unlikely. Could you paste here the verbose output from the platformio build?
Thank you for your quick response, @facchinm. Here you have the build log.
It would be interesting to see the version of arm-none-eabi-g++
; I think pio is using either the system-wide compiler or their own, so the initial idea seems to be confirmed...
@gutzchi since you already opened the discussion on their channel, would you mind asking them for some additional info? Thx
Sorry, I found the info I needed
toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1)
So the toolchain is definitely different from the one we are using, but one other issue could be the cohexistence of Arduino_BHY2
and Nicla_System
libraries https://github.com/arduino/ArduinoCore-mbed/blob/838c70238aaee11c7a8a32cf570de4f51ce240f7/libraries/Nicla_System/src/Nicla_System.cpp#L3-L9
Can you share the exact sketch you are compiling? The default Blink_Nicla should not pull in Arduino_BHY2
lib
Your compiler log says
Dependency Graph
|-- <Arduino_BHY2> 1.0.3 (C:\Users\gutzchi\Box\Tecnodiabetes\Arduino Nicla\PlatformioSketches\mBedOSFaultTest\.pio\libdeps\nicla_sense_me\Arduino_BHY2)
| |-- <Nicla_System> 1.0 (C:\Users\gutzchi\.platformio\packages\framework-arduino-mbed\libraries\Nicla_System)
| | |-- <Wire> (C:\Users\gutzchi\.platformio\packages\framework-arduino-mbed\libraries\Wire)
| |-- <Wire> (C:\Users\gutzchi\.platformio\packages\framework-arduino-mbed\libraries\Wire)
| |-- <ArduinoBLE> 1.2.1 (C:\Users\gutzchi\Box\Tecnodiabetes\Arduino Nicla\PlatformioSketches\mBedOSFaultTest\.pio\libdeps\nicla_sense_me\ArduinoBLE)
|-- <ArduinoBLE> 1.2.1 (C:\Users\gutzchi\Box\Tecnodiabetes\Arduino Nicla\PlatformioSketches\mBedOSFaultTest\.pio\libdeps\nicla_sense_me\ArduinoBLE)
|-- <Nicla_System> 1.0 (C:\Users\gutzchi\.platformio\packages\framework-arduino-mbed\libraries\Nicla_System)
| |-- <Wire> (C:\Users\gutzchi\.platformio\packages\framework-arduino-mbed\libraries\Wire)
which doesn't match the seen libraries when I use your above platformio.ini
. I get with that only
Dependency Graph
|-- <Nicla_System>
| |-- <Wire>
I.e., it does not by default pull in the Arduino_BHY2
library. Did you use a different sketch than the provided one to generate the compiler log?
In any case, if PlatformIO generates code that crashes when the Arduino_BHY2
library is used and Arduino-IDE does not, that's a fault in PlatformIO, not in this Arduino core, and possibly related to the different compiler version. The Nicla board support is contained in the nordicnrf52 platform where in issue about that should be opened https://github.com/platformio/platform-nordicnrf52/issues.
I'm very sorry, at some point I included the BHY2 library (and the ArduinoBLE), or I copied the platformio.ini
file of another project. I'm very sorry about this mistake, it seemed fishy to me but I thought that maybe the library was automatically included, my bad.
Here is the build log I should have attached, the platformio configuration file and the sketch are the ones from above, for sure. build_log_nicla.txt
Actually, if I upload the sketch, then I don't get the hard fault, but it gets stuck in the same call.
If, on the other hand, I include the Arduino_BHY2
library, I get the hard fault. If I understand properly, from the code below:
the preprocessor should define the macro NO_NEED_FOR_WATCHDOG_THREAD
. However in the debugger the following lines are executed (which trigger the fault):
How can this be?
@maxgerhardt I agree with you, but I have posted the issue here because I was told to. Once @facchinm answers me, I will post it on the link you have provided me. Thank you very much to both of you.
https://github.com/arduino/ArduinoCore-mbed/blob/838c70238aaee11c7a8a32cf570de4f51ce240f7/libraries/Nicla_System/src/Nicla_System.cpp#L25-L35
Good morning.
I have tried uploading the nicla-blink code using the Platformio IDE. With the Arduino IDE, the code works fine. However, with Platformio, I get a hard fault from the mbed OS:
Using the debugger, the fault is triggered by the
th.start(&nicla::pingI2CThd);
call inside thenicla::begin()
function. The code used is the following one:The platformio.ini file is the following one:
I have previously posted the issue in the Platformio community and they have told me that I should post it here(https://community.platformio.org/t/arduino-mbed-thread-issue-on-arduino-nicla/24915).
Thank you for your attention.