Hi Sebastien,
You can try to put the device into realtime mode before connecting to the target. i.e setting STI.DBGM = 0. You have done this in your script. But it was done after the target is connected. You can't set this bit before connecting to the target. So, you will need to set this bit in your firmware code. I am not a firmware guy and don't know all the necessary bits and pieces. There might be some other bits that need to set inorder to put the device into realtime mode.
The line GEL_EnableRealtime() call in the script needs to be moved to before the connect() call as well.
Regards,
Patrick