Prusa MINI Firmware overview
jgaurora_a5s_a1_with_bootloader Namespace Reference

Functions

def addboot (source, target, env)
 

Variables

 LDSCRIPT_PATH
 

Function Documentation

◆ addboot()

def jgaurora_a5s_a1_with_bootloader.addboot (   source,
  target,
  env 
)
11 def addboot(source,target,env):
12  import os
13 
14  firmware = open(target[0].path, "rb")
15  lengthfirmware = os.path.getsize(target[0].path)
16  bootloader_dir = "buildroot/share/PlatformIO/scripts/jgaurora_bootloader.bin"
17  bootloader = open(bootloader_dir, "rb")
18  lengthbootloader = os.path.getsize(bootloader_dir)
19  firmware_with_boothloader_dir = target[0].dir.path +'/firmware_with_bootloader.bin'
20  if os.path.exists(firmware_with_boothloader_dir):
21  os.remove(firmware_with_boothloader_dir)
22  firmwareimage = open(firmware_with_boothloader_dir, "wb")
23  position = 0
24  while position < lengthbootloader:
25  byte = bootloader.read(1)
26  firmwareimage.write(byte)
27  position += 1
28  position = 0
29  while position < lengthfirmware:
30  byte = firmware.read(1)
31  firmwareimage.write(byte)
32  position += 1
33  bootloader.close()
34  firmware.close()
35  firmwareimage.close()
36  firmware_without_bootloader_dir = target[0].dir.path+'/firmware_for_sd_upload.bin'
37  if os.path.exists(firmware_without_bootloader_dir):
38  os.remove(firmware_without_bootloader_dir)
39  os.rename(target[0].path, firmware_without_bootloader_dir)
40  #os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin')
41 
42 env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", addboot);
43 

Variable Documentation

◆ LDSCRIPT_PATH

jgaurora_a5s_a1_with_bootloader.LDSCRIPT_PATH
jgaurora_a5s_a1_with_bootloader.addboot
def addboot(source, target, env)
Definition: jgaurora_a5s_a1_with_bootloader.py:11