#!/usr/bin/env python3 # Beagle to EDL Loader (c) B.Kerler 2021 import os,sys from struct import unpack def main(): if len(sys.argv)<2: print("Usage: ./beagle_to_loader.py [beagle_log.bin] [loader.elf]") sys.exit(0) with open(sys.argv[1],"rb") as rf: data=rf.read() outdata=bytearray() i=0 seq=b"\x03\x00\x00\x00\x14\x00\x00\x00\x0D\x00\x00\x00" with open(sys.argv[2], "wb") as wf: while True: idx=data.find(seq) if idx==-1: if i==0: seq=b"\x12\x00\x00\x00\x20\x00\x00\x00\x0D\x00\x00\x00\x00\x00\x00\x00" i+=1 continue else: break else: cmd=unpack("