summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2020-07-09 20:43:03 +0200
committerMichael Buesch <m@bues.ch>2020-07-09 21:43:22 +0200
commit3e47dbffa1a76a51c9649e586f40a916f197079c (patch)
tree0b1efdd8af59211c191d575a1f9a964199a465bd
parentd26c65dec52e5dab13bd88275fd5200d213cbb70 (diff)
downloadtoprammer-3e47dbffa1a76a51c9649e586f40a916f197079c.tar.xz
toprammer-3e47dbffa1a76a51c9649e586f40a916f197079c.zip
bytes vs. str fixes
Signed-off-by: Michael Buesch <m@bues.ch>
-rw-r--r--libtoprammer/bitfile.py2
-rw-r--r--libtoprammer/chips/at89c2051dip20.py10
-rw-r--r--libtoprammer/chips/at89s51dip40.py18
-rw-r--r--libtoprammer/chips/at89s52dip40.py16
-rw-r--r--libtoprammer/chips/atmega168dip28.py4
-rw-r--r--libtoprammer/chips/atmega328dip28.py4
-rw-r--r--libtoprammer/chips/atmega32dip40.py2
-rw-r--r--libtoprammer/chips/atmega48dip28.py4
-rw-r--r--libtoprammer/chips/atmega88dip28.py4
-rw-r--r--libtoprammer/chips/atmega8dip28.py2
-rw-r--r--libtoprammer/chips/atmega_common.py25
-rw-r--r--libtoprammer/chips/attiny13dip8.py6
-rw-r--r--libtoprammer/chips/attiny26dip20.py2
-rw-r--r--libtoprammer/chips/m24cxxdip8.py4
-rw-r--r--libtoprammer/chips/microchip16/microchip16_common.py22
-rw-r--r--libtoprammer/chips/microchip16/pic24f04ka200dip14.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f04ka200sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f04ka201dip20.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f04ka201sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f04kl100dip14.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f04kl100sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f04kl101dip20.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f04kl101sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl200dip14.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl200sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl201dip20.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl201sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl301dip20.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl301sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl302dip28.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl302sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl401dip20.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl401sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl402dip28.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f08kl402sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f16kl401dip20.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f16kl401sip6.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f16kl402dip28.py2
-rw-r--r--libtoprammer/chips/microchip16/pic24f16kl402sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/microchip8_18_common.py10
-rw-r--r--libtoprammer/chips/microchip8/microchip8_common.py8
-rw-r--r--libtoprammer/chips/microchip8/pic10f200dip8.py2
-rw-r--r--libtoprammer/chips/microchip8/pic10f200sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic10f202dip8.py2
-rw-r--r--libtoprammer/chips/microchip8/pic10f202sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic10f320dip8.py2
-rw-r--r--libtoprammer/chips/microchip8/pic10f320sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic10f322dip8.py2
-rw-r--r--libtoprammer/chips/microchip8/pic10f322sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic12f1501dip8.py2
-rw-r--r--libtoprammer/chips/microchip8/pic12f1501sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic12f1822dip8.py2
-rw-r--r--libtoprammer/chips/microchip8/pic12f1822sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic12f508dip8.py2
-rw-r--r--libtoprammer/chips/microchip8/pic12f508sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic12f629dip8.py2
-rw-r--r--libtoprammer/chips/microchip8/pic12f629sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1454dip14.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1454sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1459dip20.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1459sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1503dip14.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1503sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1507dip20.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1507sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1508dip20.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1508sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1509dip20.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1509sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1823dip14.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1824dip14.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1824sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1825dip14.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1825sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1826dip18.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1826sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1827dip18.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1827sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1828dip20.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1828sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1829dip20.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1829sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1933dip28.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1933sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1934dip40.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1934sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1936dip28.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1936sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1937dip40.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1937sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1938dip28.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1938sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1939dip40.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f1939sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f59dip40.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f59sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f630dip14.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f630sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f84adip18.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16f84asip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1902dip28.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1902sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1903dip28.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1903sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1904dip40.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1904sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1906dip28.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1906sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1907dip40.py2
-rw-r--r--libtoprammer/chips/microchip8/pic16lf1907sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic18f1220dip18.py2
-rw-r--r--libtoprammer/chips/microchip8/pic18f1220sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic18f2320dip28.py2
-rw-r--r--libtoprammer/chips/microchip8/pic18f2320sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic18f2321dip28.py2
-rw-r--r--libtoprammer/chips/microchip8/pic18f2321sip6.py2
-rw-r--r--libtoprammer/chips/microchip8/pic18f67j60sip6.py2
-rw-r--r--libtoprammer/chips/w29ee011dip32.py2
-rw-r--r--libtoprammer/command_queue.py4
-rw-r--r--libtoprammer/top2049/hardware_access.py2
-rw-r--r--libtoprammer/util.py18
121 files changed, 189 insertions, 180 deletions
diff --git a/libtoprammer/bitfile.py b/libtoprammer/bitfile.py
index 7c02342..e111a81 100644
--- a/libtoprammer/bitfile.py
+++ b/libtoprammer/bitfile.py
@@ -34,7 +34,7 @@ class BitfileException(Exception): pass
class Bitfile:
# Magic header
- MAGIC = "\x00\x09\x0f\xf0\x0f\xf0\x0f\xf0\x0f\xf0\x00\x00\x01"
+ MAGIC = b"\x00\x09\x0f\xf0\x0f\xf0\x0f\xf0\x0f\xf0\x00\x00\x01"
# Field IDs
FIELD_SRCFILE = 0x61
FIELD_FPGA = 0x62
diff --git a/libtoprammer/chips/at89c2051dip20.py b/libtoprammer/chips/at89c2051dip20.py
index c23a89d..3924d12 100644
--- a/libtoprammer/chips/at89c2051dip20.py
+++ b/libtoprammer/chips/at89c2051dip20.py
@@ -50,7 +50,7 @@ class Chip_AT89C2051dip20(Chip):
self.__loadCommand(5) # VPP on
self.__loadCommand(1) # set P3.2
self.__setP3x(P33=0, P34=0, P35=0, IA=0)
- data = ""
+ data = b""
self.top.cmdFPGARead(0x10)
self.__setP3x(P33=0, P34=0, P35=0, IA=1)
self.__setP3x(P33=0, P34=0, P35=0, IA=0)
@@ -61,9 +61,9 @@ class Chip_AT89C2051dip20(Chip):
data += self.top.cmdReadBufferReg()
self.__setP3x(P33=0, P34=1, P35=0, IA=0)
self.__loadCommand(6) # VPP off
- signature = ""
- signature += data[0]
- signature += data[1]
+ signature = b""
+ signature += int2byte(data[0])
+ signature += int2byte(data[1])
self.top.printInfo("Signature: %X, %X" % (byte2int(signature[0]), byte2int(signature[1])))
return signature
@@ -99,7 +99,7 @@ class Chip_AT89C2051dip20(Chip):
self.applyVPP(True)
self.__loadCommand(5) # VPP on
self.__setP3x(P33=0, P34=0, P35=1, IA=0)
- image = ""
+ image = b""
byteCount = 0
self.progressMeterInit("Reading Flash", 0x800)
for addr in range(0, 0x800):
diff --git a/libtoprammer/chips/at89s51dip40.py b/libtoprammer/chips/at89s51dip40.py
index e9327be..e117cd7 100644
--- a/libtoprammer/chips/at89s51dip40.py
+++ b/libtoprammer/chips/at89s51dip40.py
@@ -55,16 +55,16 @@ class Chip_AT89S51dip40(Chip):
self.__loadCommand(1) # set nPROG
self.__loadAddress(0x0100)
self.__setPx()
- data = ""
+ data = b""
self.top.cmdFPGARead(0x10)
self.__loadAddress(0x0200)
self.top.cmdFPGARead(0x10)
data += self.top.cmdReadBufferReg()
self.applyVPP(False)
self.__loadCommand(6) # VPP off
- signature = ""
- signature += data[0]
- signature += data[1]
+ signature = b""
+ signature += int2byte(data[0])
+ signature += int2byte(data[1])
self.top.printInfo("Signature: %X, %X" % (byte2int(signature[0]), byte2int(signature[1])))
return signature
@@ -105,7 +105,7 @@ class Chip_AT89S51dip40(Chip):
self.__setPx(P36=1, P37=1)
#self.__setPx(P26=1, P27=1, P36=1)
#self.__setPx()
- image = ""
+ image = b""
byteCount = 0
self.progressMeterInit("Reading Flash", self.flashPageSize*self.flashPages)
for addr in range(0, self.flashPageSize*self.flashPages):
@@ -162,7 +162,7 @@ class Chip_AT89S51dip40(Chip):
self.top.printInfo("{chipid}: Write flash done.".format(chipid = self.chipDescription.chipID))
else:
self.top.printInfo("{chipid}: Write flash failed!".format(chipid = self.chipDescription.chipID))
-
+
def readLockbits(self):
self.__initChip()
self.top.cmdEnableZifPullups(True)
@@ -173,13 +173,13 @@ class Chip_AT89S51dip40(Chip):
self.applyVPP(True)
self.__loadCommand(1) # set nPROG
self.__setPx(P26=1, P27=1, P36=1)
- data = ""
+ data = b""
self.top.cmdFPGARead(0x10)
data += self.top.cmdReadBufferReg()
self.applyVPP(False)
self.__loadCommand(6) # VPP off
- lockbits = ""
- lockbits += data[0]
+ lockbits = b""
+ lockbits += int2byte(data[0])
return lockbits
def writeLockbits(self, image):
diff --git a/libtoprammer/chips/at89s52dip40.py b/libtoprammer/chips/at89s52dip40.py
index 238a50a..049bdd9 100644
--- a/libtoprammer/chips/at89s52dip40.py
+++ b/libtoprammer/chips/at89s52dip40.py
@@ -55,16 +55,16 @@ class Chip_AT89S52dip40(Chip):
self.__loadCommand(1) # set nPROG
self.__loadAddress(0x0100)
self.__setPx()
- data = ""
+ data = b""
self.top.cmdFPGARead(0x10)
self.__loadAddress(0x0200)
self.top.cmdFPGARead(0x10)
data += self.top.cmdReadBufferReg()
self.applyVPP(False)
self.__loadCommand(6) # VPP off
- signature = ""
- signature += data[0]
- signature += data[1]
+ signature = b""
+ signature += int2byte(data[0])
+ signature += int2byte(data[1])
self.top.printInfo("Signature: %X, %X" % (byte2int(signature[0]), byte2int(signature[1])))
return signature
@@ -105,7 +105,7 @@ class Chip_AT89S52dip40(Chip):
self.__setPx(P36=1, P37=1)
#self.__setPx(P26=1, P27=1, P36=1)
#self.__setPx()
- image = ""
+ image = b""
byteCount = 0
self.progressMeterInit("Reading Flash", self.flashPageSize*self.flashPages)
for addr in range(0, self.flashPageSize*self.flashPages):
@@ -173,13 +173,13 @@ class Chip_AT89S52dip40(Chip):
self.applyVPP(True)
self.__loadCommand(1) # set nPROG
self.__setPx(P26=1, P27=1, P36=1)
- data = ""
+ data = b""
self.top.cmdFPGARead(0x10)
data += self.top.cmdReadBufferReg()
self.applyVPP(False)
self.__loadCommand(6) # VPP off
- lockbits = ""
- lockbits += data[0]
+ lockbits = b""
+ lockbits += int2byte(data[0])
return lockbits
def writeLockbits(self, image):
diff --git a/libtoprammer/chips/atmega168dip28.py b/libtoprammer/chips/atmega168dip28.py
index c636423..d8e8b41 100644
--- a/libtoprammer/chips/atmega168dip28.py
+++ b/libtoprammer/chips/atmega168dip28.py
@@ -30,7 +30,7 @@ class Chip_ATMega168DIP28(Chip_ATMega_common):
chipPinVCC = 7,
chipPinsVPP = 1,
chipPinGND = 8,
- signature = "\x1E\x94\x06",
+ signature = b"\x1E\x94\x06",
flashPageSize = 64,
flashPages = 128,
eepromPageSize = 4,
@@ -54,7 +54,7 @@ class Chip_ATMega168pDIP28(Chip_ATMega_common):
chipPinVCC = 7,
chipPinsVPP = 1,
chipPinGND = 8,
- signature = "\x1E\x94\x0B",
+ signature = b"\x1E\x94\x0B",
flashPageSize = 64,
flashPages = 128,
eepromPageSize = 4,
diff --git a/libtoprammer/chips/atmega328dip28.py b/libtoprammer/chips/atmega328dip28.py
index 98562bd..76eddcc 100644
--- a/libtoprammer/chips/atmega328dip28.py
+++ b/libtoprammer/chips/atmega328dip28.py
@@ -30,7 +30,7 @@ class Chip_ATMega328DIP28(Chip_ATMega_common):
chipPinVCC = 7,
chipPinsVPP = 1,
chipPinGND = 8,
- signature = "\x1E\x95\x14",
+ signature = b"\x1E\x95\x14",
flashPageSize = 64,
flashPages = 256,
eepromPageSize = 4,
@@ -54,7 +54,7 @@ class Chip_ATMega328pDIP28(Chip_ATMega_common):
chipPinVCC = 7,
chipPinsVPP = 1,
chipPinGND = 8,
- signature = "\x1E\x95\x0F",
+ signature = b"\x1E\x95\x0F",
flashPageSize = 64,
flashPages = 256,
eepromPageSize = 4,
diff --git a/libtoprammer/chips/atmega32dip40.py b/libtoprammer/chips/atmega32dip40.py
index e2e1898..15783f0 100644
--- a/libtoprammer/chips/atmega32dip40.py
+++ b/libtoprammer/chips/atmega32dip40.py
@@ -30,7 +30,7 @@ class Chip_ATMega32DIP40(Chip_ATMega_common):
chipPinVCC = 10,
chipPinsVPP = 9,
chipPinGND = 11,
- signature = "\x1E\x95\x02",
+ signature = b"\x1E\x95\x02",
flashPageSize = 64,
flashPages = 256,
eepromPageSize = 4,
diff --git a/libtoprammer/chips/atmega48dip28.py b/libtoprammer/chips/atmega48dip28.py
index c71aa0a..5faaaba 100644
--- a/libtoprammer/chips/atmega48dip28.py
+++ b/libtoprammer/chips/atmega48dip28.py
@@ -30,7 +30,7 @@ class Chip_ATMega48DIP28(Chip_ATMega_common):
chipPinVCC = 7,
chipPinsVPP = 1,
chipPinGND = 8,
- signature = "\x1E\x92\x05",
+ signature = b"\x1E\x92\x05",
flashPageSize = 32,
flashPages = 64,
eepromPageSize = 4,
@@ -54,7 +54,7 @@ class Chip_ATMega48pDIP28(Chip_ATMega_common):
chipPinVCC = 7,
chipPinsVPP = 1,
chipPinGND = 8,
- signature = "\x1E\x92\x0A",
+ signature = b"\x1E\x92\x0A",
flashPageSize = 32,
flashPages = 64,
eepromPageSize = 4,
diff --git a/libtoprammer/chips/atmega88dip28.py b/libtoprammer/chips/atmega88dip28.py
index 6130f0e..6b747a5 100644
--- a/libtoprammer/chips/atmega88dip28.py
+++ b/libtoprammer/chips/atmega88dip28.py
@@ -30,7 +30,7 @@ class Chip_ATMega88DIP28(Chip_ATMega_common):
chipPinVCC = 7,
chipPinsVPP = 1,
chipPinGND = 8,
- signature = "\x1E\x93\x0A",
+ signature = b"\x1E\x93\x0A",
flashPageSize = 32,
flashPages = 128,
eepromPageSize = 4,
@@ -54,7 +54,7 @@ class Chip_ATMega88paDIP28(Chip_ATMega_common):
chipPinVCC = 7,
chipPinsVPP = 1,
chipPinGND = 8,
- signature = "\x1E\x93\x0F",
+ signature = b"\x1E\x93\x0F",
flashPageSize = 32,
flashPages = 128,
eepromPageSize = 4,
diff --git a/libtoprammer/chips/atmega8dip28.py b/libtoprammer/chips/atmega8dip28.py
index a331c87..58b8f64 100644
--- a/libtoprammer/chips/atmega8dip28.py
+++ b/libtoprammer/chips/atmega8dip28.py
@@ -30,7 +30,7 @@ class Chip_ATMega8DIP28(Chip_ATMega_common):
chipPinVCC = 7,
chipPinsVPP = 1,
chipPinGND = 8,
- signature = "\x1E\x93\x07",
+ signature = b"\x1E\x93\x07",
flashPageSize = 32,
flashPages = 128,
eepromPageSize = 4,
diff --git a/libtoprammer/chips/atmega_common.py b/libtoprammer/chips/atmega_common.py
index 57ba759..ecaf021 100644
--- a/libtoprammer/chips/atmega_common.py
+++ b/libtoprammer/chips/atmega_common.py
@@ -74,7 +74,7 @@ class Chip_ATMega_common(Chip):
self.__enterPM()
self.progressMeterInit("Reading Flash", self.flashPages)
- image = ""
+ image = b""
for page in range(0, self.flashPages):
self.progressMeter(page)
readWords = 0
@@ -121,7 +121,7 @@ class Chip_ATMega_common(Chip):
assert(self.eepromPageSize <= self.top.getBufferRegSize())
self.progressMeterInit("Reading EEPROM", self.eepromPages)
- image = ""
+ image = b""
for page in range(0, self.eepromPages):
self.progressMeter(page)
for byte in range(0, self.eepromPageSize):
@@ -147,8 +147,7 @@ class Chip_ATMega_common(Chip):
self.__loadCommand(self.CMD_WRITEEEPROM)
addr = (page * self.eepromPageSize) + byte
self.__loadAddr(addr)
- data = image[addr]
- self.__loadDataLow(byte2int(data[0]))
+ self.__loadDataLow(image[addr])
self.__pulsePAGEL()
self.__setBS1(0)
self.__pulseWR()
@@ -223,16 +222,16 @@ class Chip_ATMega_common(Chip):
def __readSigAndCalib(self):
"""Reads the signature and calibration bytes and returns them.
This function expects a DUT present and pins initialized."""
- signature = ""
- calibration = ""
+ signature = b""
+ calibration = b""
for addr in range(0, 3):
self.__loadCommand(self.CMD_READSIG)
self.__loadAddr(addr)
self.__readWordToStatusReg()
data = self.top.cmdReadBufferReg()
if addr == 0:
- calibration += data[1]
- signature += data[0]
+ calibration += int2byte(data[1])
+ signature += int2byte(data[0])
return (signature, calibration)
def __readFuseAndLockBits(self):
@@ -247,13 +246,13 @@ class Chip_ATMega_common(Chip):
data = self.top.cmdReadBufferReg()
if self.fuseBytes == 2:
# fuseLow, fuseHigh
- fuses = data[0] + data[3]
+ fuses = int2byte(data[0]) + int2byte(data[3])
elif self.fuseBytes == 3:
# fuseLow, fuseHigh, fuseExt
- fuses = data[0] + data[3] + data[2]
+ fuses = int2byte(data[0]) + int2byte(data[3]) + int2byte(data[2])
else:
assert(0)
- lock = data[1]
+ lock = int2byte(data[1])
return (fuses, lock)
def __enterPM(self):
@@ -373,9 +372,9 @@ class Chip_ATMega_common(Chip):
def __loadCommand(self, command):
"""Load a command into the device."""
-# self.top.queueCommand("\x34")
+# self.top.queueCommand(b"\x34")
self.__setBS1(0)
-# self.top.queueCommand("\x34")
+# self.top.queueCommand(b"\x34")
self.__setXA0(0)
self.__setXA1(1)
self.top.cmdFPGAWrite(0x10, command)
diff --git a/libtoprammer/chips/attiny13dip8.py b/libtoprammer/chips/attiny13dip8.py
index bacd3b7..17c5b0c 100644
--- a/libtoprammer/chips/attiny13dip8.py
+++ b/libtoprammer/chips/attiny13dip8.py
@@ -35,7 +35,7 @@ class Chip_AtTiny13dip8(Chip):
chipPinVCC = 8,
chipPinsVPP = 1,
chipPinGND = 4)
- self.signature = "\x1E\x90\x07"
+ self.signature = b"\x1E\x90\x07"
self.flashPageSize = 16
self.flashPages = 32
self.eepromPageSize = 4
@@ -60,7 +60,7 @@ class Chip_AtTiny13dip8(Chip):
def readProgmem(self):
nrWords = self.flashPages * self.flashPageSize
- image = ""
+ image = b""
self.__enterPM()
self.progressMeterInit("Reading flash", nrWords)
self.__sendReadFlashInstr()
@@ -119,7 +119,7 @@ class Chip_AtTiny13dip8(Chip):
def readEEPROM(self):
nrBytes = self.eepromPages * self.eepromPageSize
- image = ""
+ image = b""
self.__enterPM()
self.progressMeterInit("Reading EEPROM", nrBytes)
self.__sendReadEEPROMInstr()
diff --git a/libtoprammer/chips/attiny26dip20.py b/libtoprammer/chips/attiny26dip20.py
index 5f93b7d..2097fd6 100644
--- a/libtoprammer/chips/attiny26dip20.py
+++ b/libtoprammer/chips/attiny26dip20.py
@@ -30,7 +30,7 @@ class Chip_ATTiny26DIP20(Chip_ATMega_common):
chipPinVCC = 5,
chipPinsVPP = 10,
chipPinGND = 6,
- signature = "\x1E\x91\x09",
+ signature = b"\x1E\x91\x09",
flashPageSize = 16,
flashPages = 64,
eepromPageSize = 4,
diff --git a/libtoprammer/chips/m24cxxdip8.py b/libtoprammer/chips/m24cxxdip8.py
index 46ab619..aed4535 100644
--- a/libtoprammer/chips/m24cxxdip8.py
+++ b/libtoprammer/chips/m24cxxdip8.py
@@ -47,12 +47,12 @@ class Chip_m24cXXdip8_common(Chip):
self.currentWriteMode = None
def erase(self):
- self.writeEEPROM("\xFF" * self.eepromSize)
+ self.writeEEPROM(b"\xFF" * self.eepromSize)
def readEEPROM(self):
self.__chipTurnOn()
- image = ""
+ image = b""
prevAddr = None
self.progressMeterInit("Reading EEPROM", self.eepromSize)
for addr in range(0, self.eepromSize):
diff --git a/libtoprammer/chips/microchip16/microchip16_common.py b/libtoprammer/chips/microchip16/microchip16_common.py
index 1257fd8..301c34a 100644
--- a/libtoprammer/chips/microchip16/microchip16_common.py
+++ b/libtoprammer/chips/microchip16/microchip16_common.py
@@ -102,7 +102,7 @@ class Chip_Microchip16_common(Chip):
self.fuseBytes = fuseBytes # Nr of fuse bytes
self.isInPmMode = False
self.BufferedBytes = 0
- self.Image = ""
+ self.Image = b""
def enterPM(self, lowVoltageIcspEntry=True):
if self.isInPmMode:
@@ -150,7 +150,7 @@ class Chip_Microchip16_common(Chip):
def old_readSignature(self):
self.progressMeterInit("Reading signature", 0)
self.enterPM()
- self.Image = ""
+ self.Image = b""
self.BufferedBytes = 0
self.executeCode(self.codeExitResetVector)
self.executeCode(self.getCodeInitializeTBLPAG(self.deviceIDAddr, 6))
@@ -184,10 +184,10 @@ class Chip_Microchip16_common(Chip):
def readProgmem(self):
def unpackImage():
- out = ""
+ out = b""
for halfPackAddr in range(0, len(self.Image), 6):
- out += self.Image[halfPackAddr:halfPackAddr + 3] + "\0"
- out += self.Image[halfPackAddr + 4:halfPackAddr + 6] + self.Image[halfPackAddr + 3] + "\0"
+ out += self.Image[halfPackAddr:halfPackAddr + 3] + b"\0"
+ out += self.Image[halfPackAddr + 4:halfPackAddr + 6] + self.Image[halfPackAddr + 3] + b"\0"
return out
nrWords = self.flashPages * self.flashPageSize
@@ -196,7 +196,7 @@ class Chip_Microchip16_common(Chip):
self.enterPM()
self.progressMeterInit("Reading flash", nrWords / 2)
self.BufferedBytes = 0
- self.Image = ""
+ self.Image = b""
self.executeCode(self.codeExitResetVector)
self.executeCode(self.getCodeInitializeTBLPAG(0, 6))
self.executeCode(self.codeInitializeW7toVISI)
@@ -223,7 +223,7 @@ class Chip_Microchip16_common(Chip):
self.enterPM()
self.progressMeterInit("Reading EEPROM", nrWords)
self.BufferedBytes = 0
- self.Image = ""
+ self.Image = b""
self.executeCode(self.codeExitResetVector)
self.executeCode(self.getCodeInitializeTBLPAG(0x7F0000 | 0, 6))
self.executeCode((0x207847, 0x0))
@@ -242,12 +242,12 @@ class Chip_Microchip16_common(Chip):
def readFuse(self):
return self.readSequentialBlock(self.configWordAddr, self.fuseBytes / 2, "Reading Config Words")
- 6402
+
def tmp_readSignature(self):
self.enterPM()
self.executeCode(self.codeExitResetVector)
self.executeCode((0x200FF0, 0x880190, 0x200006, 0x0, 0x0, 0x207847, 0x0, 0xBA0BB6, 0x0, 0x0, 0x0))
- self.Image = ""
+ self.Image = b""
self.readREGOUTword()
self.executeCode(self.codeExitResetVector)
self.flushBufferToImage()
@@ -273,7 +273,7 @@ class Chip_Microchip16_common(Chip):
self.enterPM()
self.progressMeterInit(infoText, nWords)
self.BufferedBytes = 0
- self.Image = ""
+ self.Image = b""
self.executeCode(self.codeExitResetVector)
self.executeCode(self.getCodeInitializeTBLPAG(startAddr, 6))
self.executeCode(self.codeInitializeW7toVISI)
@@ -536,7 +536,7 @@ class Chip_Microchip16_common(Chip):
self.executeCode(self.codeExitResetVectorSimple)
self.executeCode((0x803B02, 0x883C22, 0x000000))
self.BufferedBytes = 0
- self.Image = ""
+ self.Image = b""
self.readREGOUTword()
self.flushBufferToImage()
self.executeCode((0x000000,))
diff --git a/libtoprammer/chips/microchip16/pic24f04ka200dip14.py b/libtoprammer/chips/microchip16/pic24f04ka200dip14.py
index f49c3ba..5e84503 100644
--- a/libtoprammer/chips/microchip16/pic24f04ka200dip14.py
+++ b/libtoprammer/chips/microchip16/pic24f04ka200dip14.py
@@ -39,7 +39,7 @@ class Chip_Pic24f04ka200dip14(Chip_Microchip16_common):
chipPinVCC=14,
chipPinsVPP=1,
chipPinGND=13,
- signature="\x02\x0d",
+ signature=b"\x02\x0d",
# flashPageSize (in number of 24bit words)
flashPageSize=0xAFE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f04ka200sip6.py b/libtoprammer/chips/microchip16/pic24f04ka200sip6.py
index 86c9fb2..3eba029 100644
--- a/libtoprammer/chips/microchip16/pic24f04ka200sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f04ka200sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic24f04ka200sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x02\x0d",
+ signature=b"\x02\x0d",
# flashPageSize (in number of 24bit words)
flashPageSize=0xAFE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f04ka201dip20.py b/libtoprammer/chips/microchip16/pic24f04ka201dip20.py
index a06dbb9..7d7aa4a 100644
--- a/libtoprammer/chips/microchip16/pic24f04ka201dip20.py
+++ b/libtoprammer/chips/microchip16/pic24f04ka201dip20.py
@@ -39,7 +39,7 @@ class Chip_Pic24f04ka201dip20(Chip_Microchip16_common):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x00\x0d",
+ signature=b"\x00\x0d",
# flashPageSize (in number of 24bit words)
flashPageSize=0xAFE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f04ka201sip6.py b/libtoprammer/chips/microchip16/pic24f04ka201sip6.py
index 8b2e5a4..3beddd7 100644
--- a/libtoprammer/chips/microchip16/pic24f04ka201sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f04ka201sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic24f04ka201sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x00\x0d",
+ signature=b"\x00\x0d",
# flashPageSize (in number of 24bit words)
flashPageSize=0xAFE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f04kl100dip14.py b/libtoprammer/chips/microchip16/pic24f04kl100dip14.py
index 50849e2..a0e40b8 100644
--- a/libtoprammer/chips/microchip16/pic24f04kl100dip14.py
+++ b/libtoprammer/chips/microchip16/pic24f04kl100dip14.py
@@ -39,7 +39,7 @@ class Chip_Pic24f04kl100dip14(Chip_Microchip16_common):
chipPinVCC=14,
chipPinsVPP=1,
chipPinGND=13,
- signature="\x01\x4b",
+ signature=b"\x01\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0xAFE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f04kl100sip6.py b/libtoprammer/chips/microchip16/pic24f04kl100sip6.py
index d95860d..37532fc 100644
--- a/libtoprammer/chips/microchip16/pic24f04kl100sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f04kl100sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic24f04kl100sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x01\x4b",
+ signature=b"\x01\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0xAFE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f04kl101dip20.py b/libtoprammer/chips/microchip16/pic24f04kl101dip20.py
index 37ed6ae..39a606e 100644
--- a/libtoprammer/chips/microchip16/pic24f04kl101dip20.py
+++ b/libtoprammer/chips/microchip16/pic24f04kl101dip20.py
@@ -39,7 +39,7 @@ class Chip_Pic24f04kl101dip20(Chip_Microchip16_common):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x02\x4b",
+ signature=b"\x02\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0xAFE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f04kl101sip6.py b/libtoprammer/chips/microchip16/pic24f04kl101sip6.py
index 7194885..f71cda9 100644
--- a/libtoprammer/chips/microchip16/pic24f04kl101sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f04kl101sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic24f04kl101sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x02\x4b",
+ signature=b"\x02\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0xAFE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl200dip14.py b/libtoprammer/chips/microchip16/pic24f08kl200dip14.py
index 61394a2..133b317 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl200dip14.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl200dip14.py
@@ -39,7 +39,7 @@ class Chip_Pic24f08kl200dip14(Chip_Microchip16_common):
chipPinVCC=14,
chipPinsVPP=1,
chipPinGND=13,
- signature="\x05\x4b",
+ signature=b"\x05\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x15FE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl200sip6.py b/libtoprammer/chips/microchip16/pic24f08kl200sip6.py
index f7340b1..8f458be 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl200sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl200sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic24f08kl200sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x05\x4b",
+ signature=b"\x05\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x15FE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl201dip20.py b/libtoprammer/chips/microchip16/pic24f08kl201dip20.py
index 85dfc8d..62cd6da 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl201dip20.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl201dip20.py
@@ -39,7 +39,7 @@ class Chip_Pic24f08kl201dip20(Chip_Microchip16_common):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x06\x4b",
+ signature=b"\x06\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x15FE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl201sip6.py b/libtoprammer/chips/microchip16/pic24f08kl201sip6.py
index 86dcfa3..76171f3 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl201sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl201sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic24f08kl201sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x06\x4b",
+ signature=b"\x06\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x15FE / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl301dip20.py b/libtoprammer/chips/microchip16/pic24f08kl301dip20.py
index 93183ee..7fad647 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl301dip20.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl301dip20.py
@@ -39,7 +39,7 @@ class Chip_Pic24f08kl301dip20(Chip_Microchip16_common):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x0a\x4b",
+ signature=b"\x0a\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x2bfe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl301sip6.py b/libtoprammer/chips/microchip16/pic24f08kl301sip6.py
index 7a99289..dc8fd1e 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl301sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl301sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic24f08kl301sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x0a\x4b",
+ signature=b"\x0a\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x2bfe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl302dip28.py b/libtoprammer/chips/microchip16/pic24f08kl302dip28.py
index 7701ced..849f27e 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl302dip28.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl302dip28.py
@@ -39,7 +39,7 @@ class Chip_Pic24f08kl302dip28(Chip_Microchip16_common):
chipPinVCC=28,
chipPinsVPP=1,
chipPinGND=27,
- signature="\x00\x4b",
+ signature=b"\x00\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x15fe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl302sip6.py b/libtoprammer/chips/microchip16/pic24f08kl302sip6.py
index 734276c..dc37d7f 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl302sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl302sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic24f08kl302sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x00\x4b",
+ signature=b"\x00\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x15fe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl401dip20.py b/libtoprammer/chips/microchip16/pic24f08kl401dip20.py
index 6a4ccac..8758233 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl401dip20.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl401dip20.py
@@ -37,7 +37,7 @@ class Chip_Pic24f08kl401dip20(Chip_Microchip16_common):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x0e\x4b",
+ signature=b"\x0e\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x2bfe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl401sip6.py b/libtoprammer/chips/microchip16/pic24f08kl401sip6.py
index a9f60eb..4578d63 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl401sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl401sip6.py
@@ -42,7 +42,7 @@ class Chip_Pic24f08kl401sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x0e\x4b",
+ signature=b"\x0e\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x2bfe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl402dip28.py b/libtoprammer/chips/microchip16/pic24f08kl402dip28.py
index f8a05c1..7b2c4f2 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl402dip28.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl402dip28.py
@@ -37,7 +37,7 @@ class Chip_Pic24f08kl402dip28(Chip_Microchip16_common):
chipPinVCC=28,
chipPinsVPP=1,
chipPinGND=27,
- signature="\x04\x4b",
+ signature=b"\x04\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x15fe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f08kl402sip6.py b/libtoprammer/chips/microchip16/pic24f08kl402sip6.py
index 7ce11e2..67a13e8 100644
--- a/libtoprammer/chips/microchip16/pic24f08kl402sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f08kl402sip6.py
@@ -42,7 +42,7 @@ class Chip_Pic24f08kl402sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x04\x4b",
+ signature=b"\x04\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x15fe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f16kl401dip20.py b/libtoprammer/chips/microchip16/pic24f16kl401dip20.py
index 41f2072..7e6e85a 100644
--- a/libtoprammer/chips/microchip16/pic24f16kl401dip20.py
+++ b/libtoprammer/chips/microchip16/pic24f16kl401dip20.py
@@ -37,7 +37,7 @@ class Chip_Pic24f16kl401dip20(Chip_Microchip16_common):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x1e\x4b",
+ signature=b"\x1e\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x2bfe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f16kl401sip6.py b/libtoprammer/chips/microchip16/pic24f16kl401sip6.py
index 7de33aa..65c6a7c 100644
--- a/libtoprammer/chips/microchip16/pic24f16kl401sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f16kl401sip6.py
@@ -42,7 +42,7 @@ class Chip_Pic24f16kl401sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x1e\x4b",
+ signature=b"\x1e\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x2bfe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f16kl402dip28.py b/libtoprammer/chips/microchip16/pic24f16kl402dip28.py
index b79cd40..646b16a 100644
--- a/libtoprammer/chips/microchip16/pic24f16kl402dip28.py
+++ b/libtoprammer/chips/microchip16/pic24f16kl402dip28.py
@@ -37,7 +37,7 @@ class Chip_Pic24f16kl402dip28(Chip_Microchip16_common):
chipPinVCC=28,
chipPinsVPP=1,
chipPinGND=27,
- signature="\x14\x4b",
+ signature=b"\x14\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x2bfe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip16/pic24f16kl402sip6.py b/libtoprammer/chips/microchip16/pic24f16kl402sip6.py
index 928286b..dedb383 100644
--- a/libtoprammer/chips/microchip16/pic24f16kl402sip6.py
+++ b/libtoprammer/chips/microchip16/pic24f16kl402sip6.py
@@ -42,7 +42,7 @@ class Chip_Pic24f16kl402sip6(Chip_Microchip16_common):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x14\x4b",
+ signature=b"\x14\x4b",
# flashPageSize (in number of 24bit words)
flashPageSize=0x2bfe / 2 + 2,
# flashPageSize=0x40,
diff --git a/libtoprammer/chips/microchip8/microchip8_18_common.py b/libtoprammer/chips/microchip8/microchip8_18_common.py
index 1af69c0..a4ffab2 100644
--- a/libtoprammer/chips/microchip8/microchip8_18_common.py
+++ b/libtoprammer/chips/microchip8/microchip8_18_common.py
@@ -89,7 +89,7 @@ class Chip_Microchip8_18_common(Chip):
self.fuseBytes = fuseBytes # Nr of fuse bytes
self.isInPmMode = False
self.BufferedBytes = 0
- self.Image = ""
+ self.Image = b""
def getIHexInterpreter(self):
inter = IHexInterpreter()
@@ -135,7 +135,7 @@ class Chip_Microchip8_18_common(Chip):
self.enterPM()
self.progressMeterInit(infoText, nBytes)
self.BufferedBytes = 0
- self.Image = ""
+ self.Image = b""
self.executeCode(self.getCodeAddrToTBLPTR(startAddr))
for byteAddr in range(0, nBytes):
self.send4bitReadInstruction(self.CMD_TRI)
@@ -167,7 +167,7 @@ class Chip_Microchip8_18_common(Chip):
self.enterPM()
self.progressMeterInit("Reading EEPROM", nrBytes)
self.BufferedBytes = 0
- self.Image = ""
+ self.Image = b""
self.executeCode((0x9EA6, 0x9CA6))
for byteAddr in range(0, nrBytes):
# print("set addr to {:x}\n".format(byteAddr))
@@ -204,8 +204,8 @@ class Chip_Microchip8_18_common(Chip):
#N = (pN, len(image))[len(image) < pN]
for idx in range(0, N):
if idx == len(image):
- image += '\xFF'
- elif image[idx] != '\xFF':
+ image += b'\xFF'
+ elif byte2int(image[idx]) != 0xFF:
isEmpty = False
if(not isEmpty):
for wordAddr in range(0, N-2, 2):
diff --git a/libtoprammer/chips/microchip8/microchip8_common.py b/libtoprammer/chips/microchip8/microchip8_common.py
index b5bf172..9cb9490 100644
--- a/libtoprammer/chips/microchip8/microchip8_common.py
+++ b/libtoprammer/chips/microchip8/microchip8_common.py
@@ -50,7 +50,7 @@ class Chip_Microchip8_common(Chip):
delayTprog = 0.001
delayTdly = 0.000001
delayTera = 0.01
- nLatches =1
+ nLatches = 1
@classmethod
def getSupportFlags(cls):
@@ -157,7 +157,7 @@ class Chip_Microchip8_common(Chip):
def readProgmem(self):
nrWords = self.flashPages * self.flashPageSize
- image = ""
+ image = b""
self.enterPM()
self.setPC(0)
self.progressMeterInit("Reading flash", nrWords)
@@ -183,7 +183,7 @@ class Chip_Microchip8_common(Chip):
def readEEPROM(self):
nrWords = self.eepromPages * self.eepromPageSize
- image = ""
+ image = b""
self.enterPM()
self.progressMeterInit("Reading eeprom", nrWords)
bufferedBytes = 0
@@ -205,7 +205,7 @@ class Chip_Microchip8_common(Chip):
def writeEEPROM(self, image):
nrWords = self.eepromPages * self.eepromPageSize
if len(image) > nrWords:
- self.throwError("Invalid flash image size %d (expected <=%d)" % len(image))
+ self.throwError("Invalid flash image size %d (expected <=%d)" % len(image))
self.enterPM()
self.progressMeterInit("Writing eeprom", nrWords)
bufferedBytes = 0
diff --git a/libtoprammer/chips/microchip8/pic10f200dip8.py b/libtoprammer/chips/microchip8/pic10f200dip8.py
index e189869..2d838a6 100644
--- a/libtoprammer/chips/microchip8/pic10f200dip8.py
+++ b/libtoprammer/chips/microchip8/pic10f200dip8.py
@@ -34,7 +34,7 @@ class Chip_Pic10F200dip8(microchip8_singlePMarea):
chipPinVCC=2,
chipPinsVPP=8,
chipPinGND=7,
- signature="\x09\x18\x24\x35",
+ signature=b"\x09\x18\x24\x35",
flashPageSize=0x100,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic10f200sip6.py b/libtoprammer/chips/microchip8/pic10f200sip6.py
index 3b1a4a9..ea29fda 100644
--- a/libtoprammer/chips/microchip8/pic10f200sip6.py
+++ b/libtoprammer/chips/microchip8/pic10f200sip6.py
@@ -39,7 +39,7 @@ class Chip_Pic10F200sip6(microchip8_singlePMarea):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x09\x18\x24\x35",
+ signature=b"\x09\x18\x24\x35",
flashPageSize=0x100,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic10f202dip8.py b/libtoprammer/chips/microchip8/pic10f202dip8.py
index 2a7d041..bc88e87 100644
--- a/libtoprammer/chips/microchip8/pic10f202dip8.py
+++ b/libtoprammer/chips/microchip8/pic10f202dip8.py
@@ -34,7 +34,7 @@ class Chip_Pic10F202dip8(microchip8_singlePMarea):
chipPinVCC=2,
chipPinsVPP=8,
chipPinGND=7,
- signature="\x09\x18\x24\x35",
+ signature=b"\x09\x18\x24\x35",
flashPageSize=0x200,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic10f202sip6.py b/libtoprammer/chips/microchip8/pic10f202sip6.py
index 631d7df..2b62583 100644
--- a/libtoprammer/chips/microchip8/pic10f202sip6.py
+++ b/libtoprammer/chips/microchip8/pic10f202sip6.py
@@ -39,7 +39,7 @@ class Chip_Pic10F202sip6(microchip8_singlePMarea):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x09\x18\x24\x35",
+ signature=b"\x09\x18\x24\x35",
flashPageSize=0x200,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic10f320dip8.py b/libtoprammer/chips/microchip8/pic10f320dip8.py
index 6620dd7..c43a3ea 100644
--- a/libtoprammer/chips/microchip8/pic10f320dip8.py
+++ b/libtoprammer/chips/microchip8/pic10f320dip8.py
@@ -36,7 +36,7 @@ class Chip_Pic10F320dip8(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=2,
chipPinsVPP=8,
chipPinGND=7,
- signature="\xA1\x29",
+ signature=b"\xA1\x29",
flashPageSize=0x100,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic10f320sip6.py b/libtoprammer/chips/microchip8/pic10f320sip6.py
index 0429800..29b24ce 100644
--- a/libtoprammer/chips/microchip8/pic10f320sip6.py
+++ b/libtoprammer/chips/microchip8/pic10f320sip6.py
@@ -41,7 +41,7 @@ class Chip_Pic10F320sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\xA1\x29",
+ signature=b"\xA1\x29",
flashPageSize=0x100,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic10f322dip8.py b/libtoprammer/chips/microchip8/pic10f322dip8.py
index 08044f6..7b055c1 100644
--- a/libtoprammer/chips/microchip8/pic10f322dip8.py
+++ b/libtoprammer/chips/microchip8/pic10f322dip8.py
@@ -36,7 +36,7 @@ class Chip_Pic10F322dip8(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=2,
chipPinsVPP=8,
chipPinGND=7,
- signature="\x82\x29",
+ signature=b"\x82\x29",
flashPageSize=0x200,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic10f322sip6.py b/libtoprammer/chips/microchip8/pic10f322sip6.py
index 5840223..d408eda 100644
--- a/libtoprammer/chips/microchip8/pic10f322sip6.py
+++ b/libtoprammer/chips/microchip8/pic10f322sip6.py
@@ -41,7 +41,7 @@ class Chip_Pic10F322sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x82\x29",
+ signature=b"\x82\x29",
flashPageSize=0x200,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic12f1501dip8.py b/libtoprammer/chips/microchip8/pic12f1501dip8.py
index c709d4a..309f90a 100644
--- a/libtoprammer/chips/microchip8/pic12f1501dip8.py
+++ b/libtoprammer/chips/microchip8/pic12f1501dip8.py
@@ -33,7 +33,7 @@ class Chip_Pic12F1501dip8(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=8,
- signature="\x80\x27",
+ signature=b"\x80\x27",
flashPageSize=0x400,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic12f1501sip6.py b/libtoprammer/chips/microchip8/pic12f1501sip6.py
index 6213cc9..cd06b55 100644
--- a/libtoprammer/chips/microchip8/pic12f1501sip6.py
+++ b/libtoprammer/chips/microchip8/pic12f1501sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic12F1501sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x80\x27",
+ signature=b"\x80\x27",
flashPageSize=0x400,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic12f1822dip8.py b/libtoprammer/chips/microchip8/pic12f1822dip8.py
index 232b1dc..ecb79b3 100644
--- a/libtoprammer/chips/microchip8/pic12f1822dip8.py
+++ b/libtoprammer/chips/microchip8/pic12f1822dip8.py
@@ -34,7 +34,7 @@ class Chip_Pic12F1822dip8(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=8,
- signature="\x08\x27",
+ signature=b"\x08\x27",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic12f1822sip6.py b/libtoprammer/chips/microchip8/pic12f1822sip6.py
index b883024..30eb879 100644
--- a/libtoprammer/chips/microchip8/pic12f1822sip6.py
+++ b/libtoprammer/chips/microchip8/pic12f1822sip6.py
@@ -39,7 +39,7 @@ class Chip_Pic12F1822sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x08\x27",
+ signature=b"\x08\x27",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic12f508dip8.py b/libtoprammer/chips/microchip8/pic12f508dip8.py
index d4e4355..d7477a9 100644
--- a/libtoprammer/chips/microchip8/pic12f508dip8.py
+++ b/libtoprammer/chips/microchip8/pic12f508dip8.py
@@ -32,7 +32,7 @@ class Chip_Pic12F508dip8(microchip8_singlePMarea):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=8,
- signature="",
+ signature=b"",
flashPageSize=0x200,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic12f508sip6.py b/libtoprammer/chips/microchip8/pic12f508sip6.py
index cd574d1..5fb31de 100644
--- a/libtoprammer/chips/microchip8/pic12f508sip6.py
+++ b/libtoprammer/chips/microchip8/pic12f508sip6.py
@@ -37,7 +37,7 @@ class Chip_Pic12F508sip6(microchip8_singlePMarea):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="",
+ signature=b"",
flashPageSize=0x200,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic12f629dip8.py b/libtoprammer/chips/microchip8/pic12f629dip8.py
index 2574f80..5325579 100644
--- a/libtoprammer/chips/microchip8/pic12f629dip8.py
+++ b/libtoprammer/chips/microchip8/pic12f629dip8.py
@@ -39,7 +39,7 @@ class Chip_Pic12F629dip8(microchip8_splittedPMarea):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=8,
- signature="\xCB\x0F",
+ signature=b"\xCB\x0F",
flashPageSize=0x400, # 1024 words
flashPages=1,
eepromPageSize=128,
diff --git a/libtoprammer/chips/microchip8/pic12f629sip6.py b/libtoprammer/chips/microchip8/pic12f629sip6.py
index b3c0009..7798d3c 100644
--- a/libtoprammer/chips/microchip8/pic12f629sip6.py
+++ b/libtoprammer/chips/microchip8/pic12f629sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic12F629sip6(microchip8_splittedPMarea):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\xCB\x0F",
+ signature=b"\xCB\x0F",
flashPageSize=0x400, # 1024 words
flashPages=1,
eepromPageSize=128,
diff --git a/libtoprammer/chips/microchip8/pic16f1454dip14.py b/libtoprammer/chips/microchip8/pic16f1454dip14.py
index 1fdad1d..5b825df 100644
--- a/libtoprammer/chips/microchip8/pic16f1454dip14.py
+++ b/libtoprammer/chips/microchip8/pic16f1454dip14.py
@@ -34,7 +34,7 @@ class Chip_Pic16F1454dip14(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=14,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1454sip6.py b/libtoprammer/chips/microchip8/pic16f1454sip6.py
index 424fd32..a85d000 100644
--- a/libtoprammer/chips/microchip8/pic16f1454sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1454sip6.py
@@ -39,7 +39,7 @@ class Chip_Pic16F1454sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1459dip20.py b/libtoprammer/chips/microchip8/pic16f1459dip20.py
index 14ef682..9518650 100644
--- a/libtoprammer/chips/microchip8/pic16f1459dip20.py
+++ b/libtoprammer/chips/microchip8/pic16f1459dip20.py
@@ -34,7 +34,7 @@ class Chip_Pic16F1459dip20(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=20,
- signature="\x00\x2E",
+ signature=b"\x00\x2E",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1459sip6.py b/libtoprammer/chips/microchip8/pic16f1459sip6.py
index 499162c..450e556 100644
--- a/libtoprammer/chips/microchip8/pic16f1459sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1459sip6.py
@@ -39,7 +39,7 @@ class Chip_Pic16F1459sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x00\x2E",
+ signature=b"\x00\x2E",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1503dip14.py b/libtoprammer/chips/microchip8/pic16f1503dip14.py
index 163364e..1f8125e 100644
--- a/libtoprammer/chips/microchip8/pic16f1503dip14.py
+++ b/libtoprammer/chips/microchip8/pic16f1503dip14.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1503dip14(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=14,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1503sip6.py b/libtoprammer/chips/microchip8/pic16f1503sip6.py
index dc27e60..de887a3 100644
--- a/libtoprammer/chips/microchip8/pic16f1503sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1503sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1503sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1507dip20.py b/libtoprammer/chips/microchip8/pic16f1507dip20.py
index caa7434..e03000d 100644
--- a/libtoprammer/chips/microchip8/pic16f1507dip20.py
+++ b/libtoprammer/chips/microchip8/pic16f1507dip20.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1507dip20(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=20,
- signature="\x80\x2D",
+ signature=b"\x80\x2D",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1507sip6.py b/libtoprammer/chips/microchip8/pic16f1507sip6.py
index 002b8fc..c8897f6 100644
--- a/libtoprammer/chips/microchip8/pic16f1507sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1507sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1507sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x80\x2D",
+ signature=b"\x80\x2D",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1508dip20.py b/libtoprammer/chips/microchip8/pic16f1508dip20.py
index e90f9c0..3331f47 100644
--- a/libtoprammer/chips/microchip8/pic16f1508dip20.py
+++ b/libtoprammer/chips/microchip8/pic16f1508dip20.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1508dip20(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=20,
- signature="\x20\x2D",
+ signature=b"\x20\x2D",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1508sip6.py b/libtoprammer/chips/microchip8/pic16f1508sip6.py
index 3e0c512..46da571 100644
--- a/libtoprammer/chips/microchip8/pic16f1508sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1508sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1508sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x20\x2D",
+ signature=b"\x20\x2D",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1509dip20.py b/libtoprammer/chips/microchip8/pic16f1509dip20.py
index 42d485a..b9fca19 100644
--- a/libtoprammer/chips/microchip8/pic16f1509dip20.py
+++ b/libtoprammer/chips/microchip8/pic16f1509dip20.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1509dip20(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=20,
- signature="\x00\x2E",
+ signature=b"\x00\x2E",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1509sip6.py b/libtoprammer/chips/microchip8/pic16f1509sip6.py
index 1931bd2..12e4c59 100644
--- a/libtoprammer/chips/microchip8/pic16f1509sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1509sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1509sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x00\x2E",
+ signature=b"\x00\x2E",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1823dip14.py b/libtoprammer/chips/microchip8/pic16f1823dip14.py
index 78a0d1f..cf39aed 100644
--- a/libtoprammer/chips/microchip8/pic16f1823dip14.py
+++ b/libtoprammer/chips/microchip8/pic16f1823dip14.py
@@ -34,7 +34,7 @@ class Chip_Pic16F1823dip14(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=14,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x0800,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1824dip14.py b/libtoprammer/chips/microchip8/pic16f1824dip14.py
index eb649f7..4b372aa 100644
--- a/libtoprammer/chips/microchip8/pic16f1824dip14.py
+++ b/libtoprammer/chips/microchip8/pic16f1824dip14.py
@@ -35,7 +35,7 @@ class Chip_Pic16F1824dip14(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=14,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1824sip6.py b/libtoprammer/chips/microchip8/pic16f1824sip6.py
index a870c62..7f0a25d 100644
--- a/libtoprammer/chips/microchip8/pic16f1824sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1824sip6.py
@@ -40,7 +40,7 @@ class Chip_Pic16F1824sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1825dip14.py b/libtoprammer/chips/microchip8/pic16f1825dip14.py
index 5bb373c..14eaf0b 100644
--- a/libtoprammer/chips/microchip8/pic16f1825dip14.py
+++ b/libtoprammer/chips/microchip8/pic16f1825dip14.py
@@ -35,7 +35,7 @@ class Chip_Pic16F1825dip14(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=14,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1825sip6.py b/libtoprammer/chips/microchip8/pic16f1825sip6.py
index 5e31713..bcff20f 100644
--- a/libtoprammer/chips/microchip8/pic16f1825sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1825sip6.py
@@ -40,7 +40,7 @@ class Chip_Pic16F1825sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1826dip18.py b/libtoprammer/chips/microchip8/pic16f1826dip18.py
index 5c37cf5..00c7dea 100644
--- a/libtoprammer/chips/microchip8/pic16f1826dip18.py
+++ b/libtoprammer/chips/microchip8/pic16f1826dip18.py
@@ -35,7 +35,7 @@ class Chip_PIC16F1826dip18(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=14,
chipPinsVPP=4,
chipPinGND=5,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1826sip6.py b/libtoprammer/chips/microchip8/pic16f1826sip6.py
index 716ff0b..1f0c3fb 100644
--- a/libtoprammer/chips/microchip8/pic16f1826sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1826sip6.py
@@ -40,7 +40,7 @@ class Chip_PIC16F1826sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1827dip18.py b/libtoprammer/chips/microchip8/pic16f1827dip18.py
index 9dfe840..342a1af 100644
--- a/libtoprammer/chips/microchip8/pic16f1827dip18.py
+++ b/libtoprammer/chips/microchip8/pic16f1827dip18.py
@@ -35,7 +35,7 @@ class Chip_Pic16F1827dip18(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=14,
chipPinsVPP=4,
chipPinGND=5,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x1000, # 4kWords
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1827sip6.py b/libtoprammer/chips/microchip8/pic16f1827sip6.py
index 780b0f9..970717b 100644
--- a/libtoprammer/chips/microchip8/pic16f1827sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1827sip6.py
@@ -40,7 +40,7 @@ class Chip_Pic16F1827sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x1000, # 4kWords
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1828dip20.py b/libtoprammer/chips/microchip8/pic16f1828dip20.py
index 1ec8fa5..933abb6 100644
--- a/libtoprammer/chips/microchip8/pic16f1828dip20.py
+++ b/libtoprammer/chips/microchip8/pic16f1828dip20.py
@@ -35,7 +35,7 @@ class Chip_Pic16F1828dip20(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=20,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1828sip6.py b/libtoprammer/chips/microchip8/pic16f1828sip6.py
index 3f9077c..16fd16b 100644
--- a/libtoprammer/chips/microchip8/pic16f1828sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1828sip6.py
@@ -40,7 +40,7 @@ class Chip_Pic16F1828sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1829dip20.py b/libtoprammer/chips/microchip8/pic16f1829dip20.py
index d9ccbfc..cffc5f2 100644
--- a/libtoprammer/chips/microchip8/pic16f1829dip20.py
+++ b/libtoprammer/chips/microchip8/pic16f1829dip20.py
@@ -35,7 +35,7 @@ class Chip_Pic16F1829dip20(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=20,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1829sip6.py b/libtoprammer/chips/microchip8/pic16f1829sip6.py
index 4bbb682..ebd430a 100644
--- a/libtoprammer/chips/microchip8/pic16f1829sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1829sip6.py
@@ -40,7 +40,7 @@ class Chip_Pic16F1829sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x43\x27",
+ signature=b"\x43\x27",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1933dip28.py b/libtoprammer/chips/microchip8/pic16f1933dip28.py
index cb6eb8c..6e23686 100644
--- a/libtoprammer/chips/microchip8/pic16f1933dip28.py
+++ b/libtoprammer/chips/microchip8/pic16f1933dip28.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1933dip28(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1933sip6.py b/libtoprammer/chips/microchip8/pic16f1933sip6.py
index c8c1659..1f689ae 100644
--- a/libtoprammer/chips/microchip8/pic16f1933sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1933sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1933sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1934dip40.py b/libtoprammer/chips/microchip8/pic16f1934dip40.py
index 49bc077..2cb633e 100644
--- a/libtoprammer/chips/microchip8/pic16f1934dip40.py
+++ b/libtoprammer/chips/microchip8/pic16f1934dip40.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1934dip40(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=32,
chipPinsVPP=1,
chipPinGND=31,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1934sip6.py b/libtoprammer/chips/microchip8/pic16f1934sip6.py
index ffdb648..0d2a7d7 100644
--- a/libtoprammer/chips/microchip8/pic16f1934sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1934sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1934sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1936dip28.py b/libtoprammer/chips/microchip8/pic16f1936dip28.py
index 5f2f61f..a004e30 100644
--- a/libtoprammer/chips/microchip8/pic16f1936dip28.py
+++ b/libtoprammer/chips/microchip8/pic16f1936dip28.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1936dip28(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1936sip6.py b/libtoprammer/chips/microchip8/pic16f1936sip6.py
index a4e8161..6cac3b2 100644
--- a/libtoprammer/chips/microchip8/pic16f1936sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1936sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1936sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1937dip40.py b/libtoprammer/chips/microchip8/pic16f1937dip40.py
index 5997ee8..8bff4ba 100644
--- a/libtoprammer/chips/microchip8/pic16f1937dip40.py
+++ b/libtoprammer/chips/microchip8/pic16f1937dip40.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1937dip40(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=32,
chipPinsVPP=1,
chipPinGND=31,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1937sip6.py b/libtoprammer/chips/microchip8/pic16f1937sip6.py
index c9df960..9184631 100644
--- a/libtoprammer/chips/microchip8/pic16f1937sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1937sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1937sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1938dip28.py b/libtoprammer/chips/microchip8/pic16f1938dip28.py
index 4627973..1ea1630 100644
--- a/libtoprammer/chips/microchip8/pic16f1938dip28.py
+++ b/libtoprammer/chips/microchip8/pic16f1938dip28.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1938dip28(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x4000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1938sip6.py b/libtoprammer/chips/microchip8/pic16f1938sip6.py
index eab0abd..b5224de 100644
--- a/libtoprammer/chips/microchip8/pic16f1938sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1938sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1938sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x4000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1939dip40.py b/libtoprammer/chips/microchip8/pic16f1939dip40.py
index 6a547f7..6e90abb 100644
--- a/libtoprammer/chips/microchip8/pic16f1939dip40.py
+++ b/libtoprammer/chips/microchip8/pic16f1939dip40.py
@@ -33,7 +33,7 @@ class Chip_Pic16F1939dip40(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=32,
chipPinsVPP=1,
chipPinGND=31,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x4000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f1939sip6.py b/libtoprammer/chips/microchip8/pic16f1939sip6.py
index 085b5ec..1cba8d0 100644
--- a/libtoprammer/chips/microchip8/pic16f1939sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f1939sip6.py
@@ -38,7 +38,7 @@ class Chip_Pic16F1939sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x68\x23",
+ signature=b"\x68\x23",
flashPageSize=0x4000,
flashPages=1,
eepromPageSize=256,
diff --git a/libtoprammer/chips/microchip8/pic16f59dip40.py b/libtoprammer/chips/microchip8/pic16f59dip40.py
index dc7bc2c..7fa9e44 100644
--- a/libtoprammer/chips/microchip8/pic16f59dip40.py
+++ b/libtoprammer/chips/microchip8/pic16f59dip40.py
@@ -34,7 +34,7 @@ class Chip_Pic16F59dip40(microchip8_singlePMarea):
chipPinVCC=15,
chipPinsVPP=14,
chipPinGND=5,
- signature="",
+ signature=b"",
flashPageSize=0x200,
flashPages=4,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16f59sip6.py b/libtoprammer/chips/microchip8/pic16f59sip6.py
index eab7caa..c61c944 100644
--- a/libtoprammer/chips/microchip8/pic16f59sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f59sip6.py
@@ -39,7 +39,7 @@ class Chip_Pic16F59sip6(microchip8_singlePMarea):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="",
+ signature=b"",
flashPageSize=0x200,
flashPages=4,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16f630dip14.py b/libtoprammer/chips/microchip8/pic16f630dip14.py
index c6ab4c8..eb695c1 100644
--- a/libtoprammer/chips/microchip8/pic16f630dip14.py
+++ b/libtoprammer/chips/microchip8/pic16f630dip14.py
@@ -39,7 +39,7 @@ class Chip_Pic16F630dip14(microchip8_splittedPMarea):
chipPinVCC=1,
chipPinsVPP=4,
chipPinGND=14,
- signature="\x08\x27",
+ signature=b"\x08\x27",
flashPageSize=0x400, # 1024 words
flashPages=1,
eepromPageSize=128,
diff --git a/libtoprammer/chips/microchip8/pic16f630sip6.py b/libtoprammer/chips/microchip8/pic16f630sip6.py
index bc7da4b..bde059b 100644
--- a/libtoprammer/chips/microchip8/pic16f630sip6.py
+++ b/libtoprammer/chips/microchip8/pic16f630sip6.py
@@ -44,7 +44,7 @@ class Chip_Pic16F630sip6(microchip8_splittedPMarea):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x08\x27",
+ signature=b"\x08\x27",
flashPageSize=0x400, # 1024 words
flashPages=1,
eepromPageSize=128,
diff --git a/libtoprammer/chips/microchip8/pic16f84adip18.py b/libtoprammer/chips/microchip8/pic16f84adip18.py
index 0a62644..58b9a00 100644
--- a/libtoprammer/chips/microchip8/pic16f84adip18.py
+++ b/libtoprammer/chips/microchip8/pic16f84adip18.py
@@ -40,7 +40,7 @@ class Chip_Pic16F84adip18(microchip8_splittedPMarea):
chipPinVCC=14,
chipPinsVPP=4,
chipPinGND=5,
- signature="\x60\x05",
+ signature=b"\x60\x05",
flashPageSize=0x200,
flashPages=1,
eepromPageSize=64,
diff --git a/libtoprammer/chips/microchip8/pic16f84asip6.py b/libtoprammer/chips/microchip8/pic16f84asip6.py
index 6c0fe89..dfbee87 100644
--- a/libtoprammer/chips/microchip8/pic16f84asip6.py
+++ b/libtoprammer/chips/microchip8/pic16f84asip6.py
@@ -45,7 +45,7 @@ class Chip_Pic16F84asip6(microchip8_splittedPMarea):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x60\x05",
+ signature=b"\x60\x05",
flashPageSize=0x200,
flashPages=1,
eepromPageSize=64,
diff --git a/libtoprammer/chips/microchip8/pic16lf1902dip28.py b/libtoprammer/chips/microchip8/pic16lf1902dip28.py
index 2b786bd..595cf80 100644
--- a/libtoprammer/chips/microchip8/pic16lf1902dip28.py
+++ b/libtoprammer/chips/microchip8/pic16lf1902dip28.py
@@ -32,7 +32,7 @@ class Chip_Pic16LF1902dip28(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x22\x2c",
+ signature=b"\x22\x2c",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16lf1902sip6.py b/libtoprammer/chips/microchip8/pic16lf1902sip6.py
index 7615e04..8287799 100644
--- a/libtoprammer/chips/microchip8/pic16lf1902sip6.py
+++ b/libtoprammer/chips/microchip8/pic16lf1902sip6.py
@@ -37,7 +37,7 @@ class Chip_Pic16LF1902sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x22\x2c",
+ signature=b"\x22\x2c",
flashPageSize=0x800,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16lf1903dip28.py b/libtoprammer/chips/microchip8/pic16lf1903dip28.py
index 02ec6b2..882d318 100644
--- a/libtoprammer/chips/microchip8/pic16lf1903dip28.py
+++ b/libtoprammer/chips/microchip8/pic16lf1903dip28.py
@@ -32,7 +32,7 @@ class Chip_Pic16LF1903dip28(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x22\x2c",
+ signature=b"\x22\x2c",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16lf1903sip6.py b/libtoprammer/chips/microchip8/pic16lf1903sip6.py
index 9e97abd..cc3a703 100644
--- a/libtoprammer/chips/microchip8/pic16lf1903sip6.py
+++ b/libtoprammer/chips/microchip8/pic16lf1903sip6.py
@@ -37,7 +37,7 @@ class Chip_Pic16LF1903sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x22\x2c",
+ signature=b"\x22\x2c",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16lf1904dip40.py b/libtoprammer/chips/microchip8/pic16lf1904dip40.py
index 37c7b67..61b3a4e 100644
--- a/libtoprammer/chips/microchip8/pic16lf1904dip40.py
+++ b/libtoprammer/chips/microchip8/pic16lf1904dip40.py
@@ -32,7 +32,7 @@ class Chip_Pic16LF1904dip40(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=32,
chipPinsVPP=1,
chipPinGND=31,
- signature="\x81\x2c",
+ signature=b"\x81\x2c",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16lf1904sip6.py b/libtoprammer/chips/microchip8/pic16lf1904sip6.py
index 7e63a4b..dd26c01 100644
--- a/libtoprammer/chips/microchip8/pic16lf1904sip6.py
+++ b/libtoprammer/chips/microchip8/pic16lf1904sip6.py
@@ -37,7 +37,7 @@ class Chip_Pic16LF1904sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x81\x2c",
+ signature=b"\x81\x2c",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16lf1906dip28.py b/libtoprammer/chips/microchip8/pic16lf1906dip28.py
index e87d779..6a01aef 100644
--- a/libtoprammer/chips/microchip8/pic16lf1906dip28.py
+++ b/libtoprammer/chips/microchip8/pic16lf1906dip28.py
@@ -32,7 +32,7 @@ class Chip_Pic16LF1906dip28(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x22\x2c",
+ signature=b"\x22\x2c",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16lf1906sip6.py b/libtoprammer/chips/microchip8/pic16lf1906sip6.py
index 2acf0ec..63e3824 100644
--- a/libtoprammer/chips/microchip8/pic16lf1906sip6.py
+++ b/libtoprammer/chips/microchip8/pic16lf1906sip6.py
@@ -37,7 +37,7 @@ class Chip_Pic16LF1906sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x22\x2c",
+ signature=b"\x22\x2c",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16lf1907dip40.py b/libtoprammer/chips/microchip8/pic16lf1907dip40.py
index 65d5ce6..d61464c 100644
--- a/libtoprammer/chips/microchip8/pic16lf1907dip40.py
+++ b/libtoprammer/chips/microchip8/pic16lf1907dip40.py
@@ -32,7 +32,7 @@ class Chip_Pic16LF1907dip40(microchip8_splittedPMarea_hasResetPC):
chipPinVCC=32,
chipPinsVPP=1,
chipPinGND=31,
- signature="\x81\x2c",
+ signature=b"\x81\x2c",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic16lf1907sip6.py b/libtoprammer/chips/microchip8/pic16lf1907sip6.py
index 7d76161..45ae004 100644
--- a/libtoprammer/chips/microchip8/pic16lf1907sip6.py
+++ b/libtoprammer/chips/microchip8/pic16lf1907sip6.py
@@ -37,7 +37,7 @@ class Chip_Pic16LF1907sip6(microchip8_splittedPMarea_hasResetPC):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x81\x2c",
+ signature=b"\x81\x2c",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=0,
diff --git a/libtoprammer/chips/microchip8/pic18f1220dip18.py b/libtoprammer/chips/microchip8/pic18f1220dip18.py
index bc060be..6ae4834 100644
--- a/libtoprammer/chips/microchip8/pic18f1220dip18.py
+++ b/libtoprammer/chips/microchip8/pic18f1220dip18.py
@@ -35,7 +35,7 @@ class Chip_PIC18F1220dip18(microchip8_18f1220family):
chipPinVCC=14,
chipPinsVPP=4,
chipPinGND=5,
- signature="\xE7\x07",
+ signature=b"\xE7\x07",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=0x100,
diff --git a/libtoprammer/chips/microchip8/pic18f1220sip6.py b/libtoprammer/chips/microchip8/pic18f1220sip6.py
index 035188d..56219e7 100644
--- a/libtoprammer/chips/microchip8/pic18f1220sip6.py
+++ b/libtoprammer/chips/microchip8/pic18f1220sip6.py
@@ -40,7 +40,7 @@ class Chip_PIC18F1220sip6(microchip8_18f1220family):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\xE7\x07",
+ signature=b"\xE7\x07",
flashPageSize=0x1000,
flashPages=1,
eepromPageSize=0x100,
diff --git a/libtoprammer/chips/microchip8/pic18f2320dip28.py b/libtoprammer/chips/microchip8/pic18f2320dip28.py
index 03657bd..2f5639e 100644
--- a/libtoprammer/chips/microchip8/pic18f2320dip28.py
+++ b/libtoprammer/chips/microchip8/pic18f2320dip28.py
@@ -35,7 +35,7 @@ class Chip_PIC18F2320dip28(microchip8_18f1220family):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x80\x05",
+ signature=b"\x80\x05",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=0x100,
diff --git a/libtoprammer/chips/microchip8/pic18f2320sip6.py b/libtoprammer/chips/microchip8/pic18f2320sip6.py
index a19062d..1dd649b 100644
--- a/libtoprammer/chips/microchip8/pic18f2320sip6.py
+++ b/libtoprammer/chips/microchip8/pic18f2320sip6.py
@@ -40,7 +40,7 @@ class Chip_PIC18F2320sip6(microchip8_18f1220family):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x80\x05",
+ signature=b"\x80\x05",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=0x100,
diff --git a/libtoprammer/chips/microchip8/pic18f2321dip28.py b/libtoprammer/chips/microchip8/pic18f2321dip28.py
index 5375d32..445f1a2 100644
--- a/libtoprammer/chips/microchip8/pic18f2321dip28.py
+++ b/libtoprammer/chips/microchip8/pic18f2321dip28.py
@@ -35,7 +35,7 @@ class Chip_PIC18F2321dip28(microchip8_18f2221family):
chipPinVCC=20,
chipPinsVPP=1,
chipPinGND=19,
- signature="\x22\x21",
+ signature=b"\x22\x21",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=0x100,
diff --git a/libtoprammer/chips/microchip8/pic18f2321sip6.py b/libtoprammer/chips/microchip8/pic18f2321sip6.py
index 388d82e..559fccb 100644
--- a/libtoprammer/chips/microchip8/pic18f2321sip6.py
+++ b/libtoprammer/chips/microchip8/pic18f2321sip6.py
@@ -40,7 +40,7 @@ class Chip_PIC18F2321sip6(microchip8_18f2221family):
chipPinVCC = 9,
chipPinsVPP = 10,
chipPinGND = 8,
- signature="\x22\x21",
+ signature=b"\x22\x21",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=0x100,
diff --git a/libtoprammer/chips/microchip8/pic18f67j60sip6.py b/libtoprammer/chips/microchip8/pic18f67j60sip6.py
index 9c23259..b3f67df 100644
--- a/libtoprammer/chips/microchip8/pic18f67j60sip6.py
+++ b/libtoprammer/chips/microchip8/pic18f67j60sip6.py
@@ -35,7 +35,7 @@ class Chip_PIC18F67J60sip6(microchip8_18f97j60family):
chipPinVCC=9,
chipPinsVPP=10,
chipPinGND=8,
- signature="\x22\x21",
+ signature=b"\x22\x21",
flashPageSize=0x2000,
flashPages=1,
eepromPageSize=0x100,
diff --git a/libtoprammer/chips/w29ee011dip32.py b/libtoprammer/chips/w29ee011dip32.py
index 0948c0f..e281bd0 100644
--- a/libtoprammer/chips/w29ee011dip32.py
+++ b/libtoprammer/chips/w29ee011dip32.py
@@ -80,7 +80,7 @@ class Chip_w29ee011dip32(Chip):
return image
def __readRange(self, baseAddress, size, progress=False):
- image = ""
+ image = b""
byteCount = 0
prevAddr = baseAddress
self.__loadReadAddrLo(baseAddress)
diff --git a/libtoprammer/command_queue.py b/libtoprammer/command_queue.py
index 7a1d356..4802b36 100644
--- a/libtoprammer/command_queue.py
+++ b/libtoprammer/command_queue.py
@@ -34,6 +34,10 @@ class CommandQueue(object):
def queueCommand(self, command):
"""Queue a raw command for transmission."""
+ if isinstance(command, str):
+ # Compat for old code
+ command = b"".join(int2byte(ord(c)) for c in command)
+ assert isinstance(command, (bytes, bytearray))
assert(len(command) <= self.maxPacketBytes)
if self.synchronous:
self.send(command)
diff --git a/libtoprammer/top2049/hardware_access.py b/libtoprammer/top2049/hardware_access.py
index 4a51785..5f45cb5 100644
--- a/libtoprammer/top2049/hardware_access.py
+++ b/libtoprammer/top2049/hardware_access.py
@@ -78,7 +78,7 @@ class HardwareAccess(HardwareAccessUSB):
"Returns the device ID and versioning string."
self.queueCommand(b"\x0E\x11\x00\x00")
data = self.readBufferReg(16)
- return data.strip()
+ return data.decode("ASCII", "ignore").strip()
def getFPGAType(self):
"Get the FPGA architecture."
diff --git a/libtoprammer/util.py b/libtoprammer/util.py
index 19de93e..5156077 100644
--- a/libtoprammer/util.py
+++ b/libtoprammer/util.py
@@ -30,16 +30,22 @@ class TOPException(Exception): pass
def byte2int(byte):
- if isinstance(byte, int):
+ if isinstance(byte, int): # It's already int
+ assert 0 <= byte <= 0xFF
return byte
+ if isinstance(byte, str): # Compat for old code
+ assert len(byte) == 1
+ return ord(byte)
assert isinstance(byte, (bytes, bytearray))
+ assert len(byte) == 1
return byte[0]
def int2byte(integer):
- if isinstance(integer, (bytes, bytearray)):
+ if isinstance(integer, (bytes, bytearray)): # It's already bytes
return bytes(integer)
assert isinstance(integer, int)
- return bytes( (integer, ) )
+ assert 0 <= integer <= 0xFF
+ return b"%c" % integer
def hex2bin(hexdata):
assert(len(hexdata) % 2 == 0)
@@ -55,9 +61,9 @@ def bytes2hex(bindata):
return "".join(byte2hex(b) for b in bindata)
def byte2ascii(c):
- ci = byte2int(c)
- if ci >= 32 and ci <= 126:
- return c.decode("ASCII")
+ c = byte2int(c)
+ if c >= 32 and c <= 126:
+ return "%c" % c
return "."
def bytes2ascii(bindata):
bues.ch cgit interface