Delay function not working in the main loop on m4 core

Hi all,

I'm trying to use the m4 core on opta in parallel with m7 core.
My program on m7 work fine. I added
bootM4();
on setup in m7 side to launch the m4.
Now this is my code for m4

#include <Arduino.h>
#include <mbed.h>
#include <rtos.h>

using namespace mbed;
using namespace rtos;
using namespace std::chrono_literals;

DigitalOut ledUser(PE_5);

void setup()
{
  ledUser.write(1);
  ThisThread::sleep_for(1s);
  ledUser.write(0);
  ThisThread::sleep_for(1s);
  ledUser.write(1);
  ThisThread::sleep_for(1s);
}

void loop()
{
  ledUser.write(0);
  ThisThread::sleep_for(1s);
  ledUser.write(1);
}

The blue led blink when i'm in the setup but when i enter in the main loop, the led goes to low (first line) but the program stuck at the sleep line ...

Can you help please ?

The loop() is pretty fast, so I think if you end it with write(1), the next cycle starts almost immediately and executes write(0), then waits back 1 second. the result is you can't ever see the led be turned on.
Try it with another sleep before the end:

void loop()
{
  ledUser.write(0);
  ThisThread::sleep_for(1s);
  ledUser.write(1);
  ThisThread::sleep_for(1s);
}

Oh yes, beginner error ...
Thank you
Is it possible also on m4 side to use serial to debug (also used on m7 !)

I'm sorry I don't know as I never used it!