aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/flash-ar100.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/flash-ar100.py')
-rwxr-xr-xscripts/flash-ar100.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/scripts/flash-ar100.py b/scripts/flash-ar100.py
index 33198e23..0896ae07 100755
--- a/scripts/flash-ar100.py
+++ b/scripts/flash-ar100.py
@@ -21,11 +21,11 @@ R_CPU_CFG_SIZE = R_CPU_CFG_PAGE_LIMIT - R_CPU_CFG_PAGE_BASE
R_CPU_CFG_OFFSET = 0xC00
R_CPU_CLK_OFFSET = 0x400
-parser = argparse.ArgumentParser(description='Flash and reset SRAM A2 of A64')
-parser.add_argument('filename', nargs='?', help='binary file to write')
-parser.add_argument('--reset', action='store_true', help='reset the AR100')
-parser.add_argument('--halt', action='store_true', help='Halt the AR100')
-parser.add_argument('--bl31', action='store_true', help='write bl31')
+parser = argparse.ArgumentParser(description="Flash and reset SRAM A2 of A64")
+parser.add_argument("filename", nargs="?", help="binary file to write")
+parser.add_argument("--reset", action="store_true", help="reset the AR100")
+parser.add_argument("--halt", action="store_true", help="Halt the AR100")
+parser.add_argument("--bl31", action="store_true", help="write bl31")
args = parser.parse_args()
@@ -33,21 +33,20 @@ args = parser.parse_args()
def write_exception_vectors():
print("Writing exception vectors")
with open("/dev/mem", "w+b") as f:
- exc = mmap.mmap(f.fileno(),
- length=EXCEPTIONS_SIZE,
- offset=EXCEPTIONS_BASE)
+ exc = mmap.mmap(f.fileno(), length=EXCEPTIONS_SIZE, offset=EXCEPTIONS_BASE)
for i in range(NR_OF_EXCEPTIONS):
add = i * 0x100
- exc[add:add + 4] = ((EXCEPTIONS_JUMP - add) >> 2).to_bytes(
- 4, byteorder='little')
+ exc[add : add + 4] = ((EXCEPTIONS_JUMP - add) >> 2).to_bytes(
+ 4, byteorder="little"
+ )
exc.close()
def assert_deassert_reset(ass):
with open("/dev/mem", "w+b") as f:
- r_cpucfg = mmap.mmap(f.fileno(),
- length=R_CPU_CFG_SIZE,
- offset=R_CPU_CFG_PAGE_BASE)
+ r_cpucfg = mmap.mmap(
+ f.fileno(), length=R_CPU_CFG_SIZE, offset=R_CPU_CFG_PAGE_BASE
+ )
if ass:
r_cpucfg[R_CPU_CFG_OFFSET] &= ~0x01
if r_cpucfg[R_CPU_CFG_OFFSET] & 0x01:
@@ -68,7 +67,7 @@ def write_file(filename):
print("Writing file to SRAM A2")
with open("/dev/mem", "w+b") as f:
sram_a2 = mmap.mmap(f.fileno(), length=FW_SIZE, offset=FW_BASE)
- sram_a2[0:len(data)] = data
+ sram_a2[0 : len(data)] = data
sram_a2.close()