Skip to content

Commit 77d01e4

Browse files
rivos-eblotloiclefort
authored andcommitted
[ot] scripts/opentitan: cfggen.py: ensure keys are alpha-sorted
Preserving order help tracking changes across sessions. Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
1 parent e54d2cc commit 77d01e4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/opentitan/cfggen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def _generate_roms(self, cfg: ConfigParser, socid: Optional[str] = None,
155155
nameargs.append(f'rom{rom}')
156156
romname = '.'.join(nameargs)
157157
romdata = {}
158-
for kname, val in data.items():
158+
for kname, val in sorted(data.items()):
159159
self.add_pair(romdata, kname, val)
160160
cfg[f'ot_device "{romname}"'] = romdata
161161

@@ -172,6 +172,7 @@ def _generate_otp(self, cfg: ConfigParser, socid: Optional[str] = None) \
172172
self.add_pair(otpdata, 'lc_trscnt_last', self._lc_transitions[-1])
173173
for kname, val in self._otp.items():
174174
self.add_pair(otpdata, kname, val)
175+
otpdata = dict(sorted(otpdata.items()))
175176
cfg[f'ot_device "{otpname}"'] = otpdata
176177

177178
def _generate_life_cycle(self, cfg: ConfigParser,

0 commit comments

Comments
 (0)