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.

stm32_bootloader.py 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. #
  2. # stm32_bootloader.py
  3. #
  4. import os,sys,shutil
  5. Import("env")
  6. from SCons.Script import DefaultEnvironment
  7. board = DefaultEnvironment().BoardConfig()
  8. def noencrypt(source, target, env):
  9. firmware = os.path.join(target[0].dir.path, board.get("build.firmware"))
  10. shutil.copy(target[0].path, firmware)
  11. if 'offset' in board.get("build").keys():
  12. LD_FLASH_OFFSET = board.get("build.offset")
  13. for define in env['CPPDEFINES']:
  14. if define[0] == "VECT_TAB_OFFSET":
  15. env['CPPDEFINES'].remove(define)
  16. env['CPPDEFINES'].append(("VECT_TAB_OFFSET", LD_FLASH_OFFSET))
  17. maximum_ram_size = board.get("upload.maximum_ram_size")
  18. for i, flag in enumerate(env["LINKFLAGS"]):
  19. if "-Wl,--defsym=LD_FLASH_OFFSET" in flag:
  20. env["LINKFLAGS"][i] = "-Wl,--defsym=LD_FLASH_OFFSET=" + LD_FLASH_OFFSET
  21. if "-Wl,--defsym=LD_MAX_DATA_SIZE" in flag:
  22. env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
  23. board_keys = board.get("build").keys()
  24. # Only copy file if there's no encryptation
  25. if 'firmware' in board_keys and not 'encrypt' in board_keys:
  26. env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", noencrypt)