diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2021-03-24 17:10:54 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2021-03-25 09:57:18 -0700 |
| commit | aec0ef3cbfafb79c32592c1ee39832c787f4f202 (patch) | |
| tree | 5375824afd89c10fbaf8ab2f6194ebfe10ef6531 /tools | |
| parent | e9ceb9263e4939920678921c95d595cf5444d29a (diff) | |
Switch devices.h to nvm.toml data
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/gen_nvm_devices.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/gen_nvm_devices.py b/tools/gen_nvm_devices.py new file mode 100644 index 000000000..3cda8671f --- /dev/null +++ b/tools/gen_nvm_devices.py @@ -0,0 +1,23 @@ +import sys +import cascadetoml +import pathlib +import typer +from jinja2 import Template + + +def main(input_template: pathlib.Path, output_path: pathlib.Path): + flashes = cascadetoml.filter_toml(pathlib.Path("../../data/nvm.toml"), []) + + template = Template(input_template.read_text()) + + settings = {"nvms": []} + for flash in flashes["nvm"]: + if "sku" not in flash or flash["sku"] == flash["manufacturer"]: + continue + settings["nvms"].append(dict(flash)) + + output_path.write_text(template.render(settings)) + + +if __name__ == "__main__": + typer.run(main) |
