STM32F103RC_fysetc.py 941 B

1234567891011121314151617181920212223242526
  1. #
  2. # STM32F103RC_fysetc.py
  3. #
  4. import pioutil
  5. if pioutil.is_pio_build():
  6. from os.path import join, expandvars
  7. env = pioutil.env
  8. # Custom HEX from ELF
  9. env.AddPostAction(
  10. join("$BUILD_DIR", "${PROGNAME}.elf"),
  11. env.VerboseAction(" ".join([
  12. "$OBJCOPY", "-O ihex", "$TARGET",
  13. "\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path
  14. ]), "Building $TARGET"))
  15. # In-line command with arguments
  16. UPLOAD_TOOL="stm32flash"
  17. platform = env.PioPlatform()
  18. if platform.get_package_dir("tool-stm32duino") != None:
  19. UPLOAD_TOOL=expandvars("\"" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "\"")
  20. env.Replace(
  21. UPLOADER=UPLOAD_TOOL,
  22. UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT")
  23. )