Jumperless/JumperlessNano/scripts/extra_script.py

24 lines
602 B
Python
Raw Normal View History

2023-06-14 05:57:04 +02:00
Import("env")
def after_upload(source, target, env):
port = env.GetProjectOption("monitor_port")
print("waiting for " + port + " ...")
import serial
while True:
try:
s = serial.Serial(port)
break
except:
pass
env.AddPostAction("upload", after_upload)
# Custom HEX from ELF
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
env.VerboseAction(" ".join([
"$OBJCOPY", "-O", "ihex", "-R", ".eeprom",
'"$BUILD_DIR/${PROGNAME}.elf"', '"$BUILD_DIR/${PROGNAME}.hex"'
]), "Building $BUILD_DIR/${PROGNAME}.hex")
)