Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
9590cb339This file is pinned to the selected release. Download the original to open it in your design tool.
#!/usr/bin/env python
import re
import sys
import os
config = []
for infile in sys.argv[2:]:
with open(infile) as f:
config.append((os.path.splitext(os.path.basename(infile))[0], f.read()))
code = open(sys.argv[1], 'w')
code.write("//generated by " + sys.argv[0] + " DO NOT EDIT\n\n")
code.write("#include \"config.h\"\n\n")
code.write("const uint32_t num_of_config_templates = " + str(len(config)) + ";\n\n")
code.write("config_template_t config_templates[] = {\n")
for index, (file_name, content) in enumerate(config):
code.write("{\n")
code.write(".name = \"" + file_name + "\",\n")
code.write(".config = \"\\\n")
for line in content.splitlines():
code.write(line + "\\n\\\n")
code.write("\"\n},\n\n")
code.write("};\n")
code.close()