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.

mks_robin.py 1.1KB

12345678910111213141516171819202122232425262728
  1. Import("env")
  2. # Relocate firmware from 0x08000000 to 0x08007000
  3. env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
  4. env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
  5. env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin.ld")
  6. # Encrypt ${PROGNAME}.bin and save it as 'Robin.bin'
  7. def encrypt(source, target, env):
  8. import os
  9. key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
  10. firmware = open(target[0].path, "rb")
  11. robin = open(target[0].dir.path +'/Robin.bin', "wb")
  12. length = os.path.getsize(target[0].path)
  13. position = 0
  14. try:
  15. while position < length:
  16. byte = firmware.read(1)
  17. if position >= 320 and position < 31040:
  18. byte = chr(ord(byte) ^ key[position & 31])
  19. robin.write(byte)
  20. position += 1
  21. finally:
  22. firmware.close()
  23. robin.close()
  24. env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);