Jumperless/JumperlessNano/scripts/extra_script.py
2023-06-13 20:57:04 -07:00

24 lines
602 B
Python

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")
)