Skip to content

Commit

Permalink
lmkconf: It is now possible to choose a custom name for the struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Lopez committed Oct 20, 2016
1 parent bb0a354 commit f8ee2c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lmkconf/lmkconf
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ 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',
epilog='lmkconf - 2016, Jose Lopez Jimenez - joselj@ugr.es')
epilog='lmkconf - 2016, Jose Lopez Jimenez - joselj@ugr.es\n\n')

parser.add_argument("inputfile", help="Input file from CodeLoader")
parser.add_argument("outputfile", help="Output file")
parser.add_argument("-s","--struct", dest="sname", default="tilmk03086_regs_WR", help="Name of the const struct")

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")
outf.write("const struct {int reg; uint32_t val;} "+args.sname+"[] = {\n")
for line in inf:
tmp=line.split("\t")
reg=tmp[0].partition(' ')[0][1:]
Expand Down

0 comments on commit f8ee2c2

Please sign in to comment.