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. shutil.copy(target[0].path, firmware)
  8. if 'offset' in board.get("build").keys():
  9. LD_FLASH_OFFSET = board.get("build.offset")
  10. for define in env['CPPDEFINES']:
  11. if define[0] == "VECT_TAB_OFFSET":
  12. env['CPPDEFINES'].remove(define)
  13. env['CPPDEFINES'].append(("VECT_TAB_OFFSET", LD_FLASH_OFFSET))
  14. maximum_ram_size = board.get("upload.maximum_ram_size")
  15. for i, flag in enumerate(env["LINKFLAGS"]):
  16. if "-Wl,--defsym=LD_FLASH_OFFSET" in flag:
  17. env["LINKFLAGS"][i] = "-Wl,--defsym=LD_FLASH_OFFSET=" + LD_FLASH_OFFSET
  18. if "-Wl,--defsym=LD_MAX_DATA_SIZE" in flag:
  19. env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
  20. board_keys = board.get("build").keys()
  21. # Only copy file if there's no encryptation
  22. if 'firmware' in board_keys and not 'encrypt' in board_keys:
  23. env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", noencrypt)