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

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