tronxy_cxy_446_v10.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # tronxy_cxy_446_v10.py
  3. # Build customizations for env:TRONXY_CXY_446_V10
  4. #
  5. import pioutil
  6. if pioutil.is_pio_build():
  7. import marlin, os
  8. env = pioutil.env
  9. # Check whether the "update" folder exists
  10. outpath = f"{env['PROJECT_BUILD_DIR']}/{env['PIOENV']}/update"
  11. if not os.path.exists(outpath): os.makedirs(outpath)
  12. # Build "fmw_tronxy.hex" and place in "update" folder
  13. def output_target_hex():
  14. hex_path = f"update/fmw_tronxy.hex"
  15. hex_long = f"$PROJECT_BUILD_DIR/$PIOENV/{hex_path}"
  16. env.AddPostAction(
  17. "$BUILD_DIR/${PROGNAME}.elf",
  18. env.VerboseAction(" ".join([
  19. "$OBJCOPY", "-O", "ihex", "-R", ".eeprom",
  20. "$BUILD_DIR/${PROGNAME}.elf", hex_long
  21. ]), f"Building {hex_path}")
  22. )
  23. # Build "fmw_tronxy.bin" and place in "update" folder
  24. def output_target_bin():
  25. bin_path = f"update/fmw_tronxy.bin"
  26. bin_long = f"$PROJECT_BUILD_DIR/$PIOENV/{bin_path}"
  27. env.AddPostAction(
  28. "$BUILD_DIR/${PROGNAME}.elf",
  29. env.VerboseAction(" ".join([
  30. "$OBJCOPY", "-O", "binary", "-R", ".eeprom",
  31. "$BUILD_DIR/${PROGNAME}.elf", bin_long
  32. ]), f"Building {bin_path}")
  33. )
  34. output_target_hex()
  35. output_target_bin()