Tweaked the timings a little… the extra_script method now has a 5s delay, and also 5000ms delay in the test_main.cpp and it seems to work ok now!!!
extra_script.py
Import("env")
def after_upload(source, target, env):
print "Delay while uploading..."
import time
time.sleep(5)
print "Done!"
env.AddPostAction("upload", after_upload)
And also setup() in test_main.cpp here…
void setup() {
// NOTE!!! Wait for >2 secs
// if board doesn't support software reset via Serial.DTR/RTS
delay(5000);
UNITY_BEGIN(); // IMPORTANT LINE!
RUN_TEST(test_led_builtin_pin_number);
pinMode(LED_BUILTIN, OUTPUT);
}
Thanks!