-
-
Save HerrSpace/4f922116bf0230891e97 to your computer and use it in GitHub Desktop.
write shit to binary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import time | |
import serial | |
import struct | |
import binascii | |
mem_addr = 0x80000000 | |
ser= serial.Serial('/dev/ttyUSB0', 115200, timeout=1) | |
f = open("./dump.bin", "wb") | |
while mem_addr < 0x83ffffff: | |
to_send = hex(mem_addr)[2:] + '\r' | |
ser.write(to_send) | |
_ = ser.readline() | |
result = ser.readline() | |
value = result[19:27] | |
_ = ser.readline() | |
#print(hex(mem_addr)+"\t"+value+"\t"+str(int(value,16))) | |
#data = chr(int(value[0:1], 16))+chr(int(value[2:3], 16))+chr(int(value[4:5], 16))+chr(int(value[6:7], 16)) | |
data = binascii.a2b_hex(value) | |
f.write(data) | |
mem_addr += 4 | |
if mem_addr % 256 == 0: print hex(mem_addr) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment