STM32F103RC_fysetc.py 960 B

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