mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-07-22 22:50:53 -04:00
tools: Prune and document tools
Add a tools/README.md. Remove: - create_flash_image.py: role now overtaken by tkeyimage which does more. - reset-tk1: Leftover from when production_test was removed. Rename: - makehex.py: Moved up one level.
This commit is contained in:
parent
a1f37d17c9
commit
4ec58ce04c
6 changed files with 37 additions and 47 deletions
26
hw/application_fpga/tools/makehex.py
Executable file
26
hw/application_fpga/tools/makehex.py
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# This is free and unencumbered software released into the public domain.
|
||||
#
|
||||
# Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
# distribute this software, either in source code form or as a compiled
|
||||
# binary, for any purpose, commercial or non-commercial, and by any
|
||||
# means.
|
||||
|
||||
from sys import argv
|
||||
|
||||
binfile = argv[1]
|
||||
nwords = int(argv[2])
|
||||
|
||||
with open(binfile, "rb") as f:
|
||||
bindata = f.read()
|
||||
|
||||
assert len(bindata) < 4*nwords
|
||||
assert len(bindata) % 4 == 0
|
||||
|
||||
for i in range(nwords):
|
||||
if i < len(bindata) // 4:
|
||||
w = bindata[4*i : 4*i+4]
|
||||
print("%02x%02x%02x%02x" % (w[3], w[2], w[1], w[0]))
|
||||
else:
|
||||
print("0")
|
Loading…
Add table
Add a link
Reference in a new issue