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.

jgaurora_a5s_a1_with_bootloader.py 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #
  2. # buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py
  3. # Customizations for env:jgaurora_a5s_a1
  4. #
  5. import os,marlin
  6. # Append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin'
  7. def addboot(source, target, env):
  8. firmware = open(target[0].path, "rb")
  9. lengthfirmware = os.path.getsize(target[0].path)
  10. bootloader_bin = "buildroot/share/PlatformIO/scripts/" + "jgaurora_bootloader.bin"
  11. bootloader = open(bootloader_bin, "rb")
  12. lengthbootloader = os.path.getsize(bootloader_bin)
  13. firmware_with_boothloader_bin = target[0].dir.path + '/firmware_with_bootloader.bin'
  14. if os.path.exists(firmware_with_boothloader_bin):
  15. os.remove(firmware_with_boothloader_bin)
  16. firmwareimage = open(firmware_with_boothloader_bin, "wb")
  17. position = 0
  18. while position < lengthbootloader:
  19. byte = bootloader.read(1)
  20. firmwareimage.write(byte)
  21. position += 1
  22. position = 0
  23. while position < lengthfirmware:
  24. byte = firmware.read(1)
  25. firmwareimage.write(byte)
  26. position += 1
  27. bootloader.close()
  28. firmware.close()
  29. firmwareimage.close()
  30. firmware_without_bootloader_bin = target[0].dir.path + '/firmware_for_sd_upload.bin'
  31. if os.path.exists(firmware_without_bootloader_bin):
  32. os.remove(firmware_without_bootloader_bin)
  33. os.rename(target[0].path, firmware_without_bootloader_bin)
  34. #os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin')
  35. marlin.add_post_action(addboot);