Hmm, I think that even yield() won’t work as expected. This is because the main thread runs with normal priority, so it will never yield to the idle thread – yield() can only yield to threads with the same or higher priority.
Assuming you only have the one main thread running, the idle hook will run only when the main thread is blocked (e.g. waiting for a network packet) or is sleeping. So, try something like ThisThread::sleep_for(1s), and then you should see the idle hook execute.
I put the main thread to sleep and I can see the idle hook in action.
Can I see the sleep related trace in the terminal.
I have put some override in the mbed_app.json file but no trace is visible.
The mbed_app.json file has the following: