-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New script 'lmkconf' converts raw Codeloader reg file to a C struct.
- Loading branch information
Jose Lopez
committed
Oct 20, 2016
1 parent
bd0686c
commit 1a24987
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
R0 (INIT) 0x80020140 | ||
R0 0x00001F40 | ||
R1 0x800001C1 | ||
R2 0x80001EA2 | ||
R3 0x000000A3 | ||
R4 0x80000C84 | ||
R5 0x80000145 | ||
R6 0xC0010006 | ||
R7 0x01C00007 | ||
R8 0x04000008 | ||
R9 0x55555549 | ||
R10 0x9142400A | ||
R11 0x3761100B | ||
R12 0x130C006C | ||
R13 0x3B03826D | ||
R14 0x0300000E | ||
R16 0xC1550410 | ||
R24 0x00200018 | ||
R26 0xAFA8001A | ||
R28 0x0020001C | ||
R29 0x0080015D | ||
R30 0x0500015E | ||
R31 0x001F001F |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description='Converts a raw register file from Texas Instruments CodeLoader\nto a C struct ready to be copypasted in Zynq-based HW first-stage bootloaders') | ||
|
||
parser.add_argument("inputfile", help="Input file from CodeLoader") | ||
parser.add_argument("outputfile", help="Output file") | ||
|
||
args = parser.parse_args() | ||
|
||
infile, outfile = args.inputfile, args.outputfile | ||
|
||
with open(infile,"r") as inf, open(outfile,"w") as outf: | ||
outf.write("const struct {int reg; uint32_t val;} tilmk03086_regs_WR[] = {\n") | ||
for line in inf: | ||
tmp=line.split("\t") | ||
reg=tmp[0].partition(' ')[0][1:] | ||
int_reg=int(reg) | ||
val=tmp[1].rstrip() | ||
if int_reg<31 : | ||
outf.write("{"+reg+", "+val+"},\n") | ||
else : | ||
outf.write("{"+reg+", "+val+"}};") | ||
|
||
|
||
|
||
|