[util] Add a --quiet mode to gen-otp-img.py and use in Meson
This avoids printing its large info messages to the terminal on every
software build.
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/sw/device/meson.build b/sw/device/meson.build
index aa6da5e..b4c6d55 100644
--- a/sw/device/meson.build
+++ b/sw/device/meson.build
@@ -52,6 +52,7 @@
make_otp_img_inputs = [meson.source_root() / 'hw/ip/otp_ctrl/data/otp_ctrl_img_dev.hjson']
make_otp_img_command = [
prog_python, meson.source_root() / 'util/design/gen-otp-img.py',
+ '--quiet',
'--img-cfg', '@INPUT@',
'--out', '@OUTPUT@',
]
diff --git a/util/design/gen-otp-img.py b/util/design/gen-otp-img.py
index 8b5f0da..b9f56d2 100755
--- a/util/design/gen-otp-img.py
+++ b/util/design/gen-otp-img.py
@@ -71,6 +71,8 @@
description=wrapped_docstring(),
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.register('action', 'extend', ExtendAction)
+ parser.add_argument('--quiet', '-q', action='store_true',
+ help='''Don't print out progress messages.''')
parser.add_argument('--img-seed',
type=int,
metavar='<seed>',
@@ -142,6 +144,9 @@
args = parser.parse_args()
+ if args.quiet:
+ log.getLogger().setLevel(log.WARNING)
+
log.info('Loading LC state definition file {}'.format(lc_state_def_file))
with open(lc_state_def_file, 'r') as infile:
lc_state_cfg = hjson.load(infile)