add option to write all bytes

This commit is contained in:
matthias@rpi 2023-12-04 21:08:39 +01:00
parent b48947d9b1
commit 3be0ea12f4

View File

@ -12,10 +12,10 @@ import atexit
gpio_l = [2, 3, 4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26]
gpio_r = [14, 15, 18, 23, 24, 25, 8, 7, 12, 16, 20, 21]
#
# Defining which 6502 pin goes to which GPIO pin
#
A = [
# 27, 22, 10, 9, 11, 5, 6, 13,
13, 6, 5, 11, 9, 10, 22, 27, # A0 - A7
@ -278,7 +278,7 @@ def read_byte(address: int, verbose=True, debug=False) -> int:
GPIO.output(WEb, 1)
setup_io_pins(IN)
# set the address valid
ad_bin = set_address(address, bits=15)
set_address(address, bits=15)
# low in chip/output enable -> enable
GPIO.output(CEb, 0)
@ -426,6 +426,7 @@ def main():
parser.add_argument("--write", "-w", dest="write", action="store_true", default=False, help="write binary file onto the EEPROM")
parser.add_argument("--page", "-p", dest="use_page_write", action="store_true", default=False, help="use page write mode")
parser.add_argument("--no-validate", dest="validate_write", action="store_false", default=True, help="dont validate write operations")
parser.add_argument("--full", dest="only_diff", action="store_false", default=True, help="write all bytes, not just ones that are mismatched")
parser.add_argument("--compare", "-c", dest="compare", action="store_true", default=False, help="compare EEPROM content to binary file")
parser.add_argument("--read", "-r", dest="read", action="store_true", default=False, help="read the contents of the EEPROM")
parser.add_argument("--erase", "-e", dest="erase", action="store_true", default=False, help="erase the contents of the EEPROM")
@ -453,7 +454,6 @@ def main():
file = read_binary_file(args.file, from_ad=args.from_ad, to_ad=args.to_ad)
if args.to_ad != args.from_ad + len(file) - 1:
args.to_ad = args.from_ad + len(file) - 1
else:
file = None
@ -463,7 +463,7 @@ def main():
if args.erase:
erase(from_ad=args.from_ad, to_ad=args.to_ad, delay=args.delay, debug=args.debug, verbose=True)
if args.write:
write(file, from_ad=args.from_ad, delay=args.delay, debug=args.debug, verbose=True, check_written=args.validate_write, use_page_write=args.use_page_write)
write(file, from_ad=args.from_ad, delay=args.delay, debug=args.debug, verbose=True, check_written=args.validate_write, use_page_write=args.use_page_write, only_diff=args.only_diff)
if args.read:
read(from_ad=args.from_ad, to_ad=args.to_ad, delay=args.delay, debug=args.debug, verbose=True, ignore=args.ignore)
if args.compare: