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.6KB

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