gen_app_partitions.py: make generated/app_smem_*.ld files deterministic
Dictionaries are not ordered in Python 3.5 and before, so building twice in a row could lead to a different partition order, different build/zephyr/include/generated/app_smem_*.ld files and different binaries. Fix with a minor change to the "for" loop in the output function: make it iterate on sorted(partitions.items()) instead of the raw and randomly ordered partitions dictionary. It is easy to reproduce the issue even without downgrading to an obsolete Python version; pick a test like samples/userspace/shared_mem/ and simply change the code to this: --- a/scripts/gen_app_partitions.py +++ b/scripts/gen_app_partitions.py @@ -159,10 +159,12 @@ def parse_elf_file(partitions): partitions[partition_name][SZ] += size +import random def generate_final_linker(linker_file, partitions): string = linker_start_seq size_string = '' - for partition, item in sorted(partitions.items()): + for partition, item in sorted(partitions.items(), + key=lambda x: random.random()): string += data_template.format(partition) if LIB in item: for lib in item[LIB]: Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
parent
6ccd026f7c
commit
725abdf430
|
@ -162,7 +162,7 @@ def parse_elf_file(partitions):
|
|||
def generate_final_linker(linker_file, partitions):
|
||||
string = linker_start_seq
|
||||
size_string = ''
|
||||
for partition, item in partitions.items():
|
||||
for partition, item in sorted(partitions.items()):
|
||||
string += data_template.format(partition)
|
||||
if LIB in item:
|
||||
for lib in item[LIB]:
|
||||
|
|
Loading…
Reference in a new issue