Arduino mbed thread issue on Arduino Nicla

Good morning.

The upload of example codes to the Nicla board triggers a HardFault from the Arduino mBed OS. If these codes are tried in the Arduino IDE, they work fine. Below is the simplest code I have tried that triggers this fault (the example code of the Nicla System including Serial):

#include "Nicla_System.h"

void setup() {
  Serial.begin(115200);
  while(!Serial);
  
  nicla::begin();
  nicla::leds.begin();
}

void loop() {
  nicla::leds.setColor(green);
  delay(1000);
  nicla::leds.setColor(off);
  delay(1000);
} 

This is my platformio.ini file, a default one:

[env:nicla_sense_me]
platform = nordicnrf52
board = nicla_sense_me
framework = arduino
monitor_speed=115200
debug_tool = cmsis-dap
upload_protocol = cmsis-dap

After using the debugger, I believe I have located the fault: nicla::begin(); tries to create a thread for one of the i2c ports:

static rtos::Thread th(osPriorityHigh, 1024, nullptr, "ping_thread"); th.start(&nicla::pingI2CThd);

But the thread constructor is not defined and a null pointer is returned (which causes the HardFault when calling th.start() function.

Could someone help me with this?

Does this appear with the Arduino IDE too when you install the latest stable version of the GitHub - arduino/ArduinoCore-mbed core? If yes → issue at this repository please since the code is there.

Yes, it does (with the latest stable version). Thank you very much, I have just posted it where you have told me.

Thank you very much for your consideration.