My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

STM32F103RC_MEEB_3DP.py 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. try:
  2. import configparser
  3. except ImportError:
  4. import ConfigParser as configparser
  5. import os
  6. Import("env", "projenv")
  7. # access to global build environment
  8. print(env)
  9. # access to project build environment (is used source files in "src" folder)
  10. print(projenv)
  11. config = configparser.ConfigParser()
  12. config.read("platformio.ini")
  13. #com_port = config.get("env:STM32F103RC_meeb", "upload_port")
  14. #print('Use the {0:s} to reboot the board to dfu mode.'.format(com_port))
  15. #
  16. # Upload actions
  17. #
  18. def before_upload(source, target, env):
  19. print("before_upload")
  20. # do some actions
  21. # use com_port
  22. #
  23. env.Execute("pwd")
  24. def after_upload(source, target, env):
  25. print("after_upload")
  26. # do some actions
  27. #
  28. #
  29. env.Execute("pwd")
  30. print("Current build targets", map(str, BUILD_TARGETS))
  31. env.AddPreAction("upload", before_upload)
  32. env.AddPostAction("upload", after_upload)
  33. flash_size = 0
  34. vect_tab_addr = 0
  35. for define in env['CPPDEFINES']:
  36. if define[0] == "VECT_TAB_ADDR":
  37. vect_tab_addr = define[1]
  38. if define[0] == "STM32_FLASH_SIZE":
  39. flash_size = define[1]
  40. print('Use the {0:s} address as the marlin app entry point.'.format(vect_tab_addr))
  41. print('Use the {0:d}KB flash version of stm32f103rct6 chip.'.format(flash_size))
  42. custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RC_MEEB_3DP.ld")
  43. for i, flag in enumerate(env["LINKFLAGS"]):
  44. if "-Wl,-T" in flag:
  45. env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
  46. elif flag == "-T":
  47. env["LINKFLAGS"][i + 1] = custom_ld_script