openblt.py 604 B

123456789101112131415161718
  1. #
  2. # Convert the ELF to an SREC file suitable for some bootloaders
  3. #
  4. import pioutil
  5. if pioutil.is_pio_build():
  6. from os.path import join
  7. env = pioutil.env
  8. board = env.BoardConfig()
  9. board_keys = board.get("build").keys()
  10. if 'encode' in board_keys:
  11. env.AddPostAction(
  12. join("$BUILD_DIR", "${PROGNAME}.bin"),
  13. env.VerboseAction(" ".join([
  14. "$OBJCOPY", "-O", "srec",
  15. "\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encode")) + "\""
  16. ]), "Building " + board.get("build.encode"))
  17. )