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

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