Skip to content
Browse files

gen_app_partitions: deterministic _and_ decreasing app_smem_*.ld

Commit 212ec9a / feature #14121 already ordered partitions by
decreasing size, however it was common in samples/userspace/shared_mem/
/sample.kernel.memory_protection.shared_mem for two partitions to have
the same size and be randomly ordered between them. This adds the
partition name as a second sort key.

Unlike previous attempt in commit 725abdf this doesn't use the
partition name as the first (and only) key and doesn't break the
decreasing size order.  Huge thanks to Sigvart Hovland for spotting this
in a post-merge but prompt code review.

Signed-off-by: Marc Herbert <>
  • Loading branch information...
marc-hb authored and andrewboie committed Jun 27, 2019
1 parent 85bc0d2 commit eefea9da9cf01766c1aa3619d4e92c1744254542
Showing with 8 additions and 2 deletions.
  1. +8 −2 scripts/
@@ -220,8 +220,14 @@ def main():

partsorted = OrderedDict(sorted(partitions.items(),
key=lambda x: x[1][SZ], reverse=True))

# Sample partitions.items() list before sorting:
# [ ('part1', {'size': 64}), ('part3', {'size': 64}, ...
# ('part0', {'size': 334}) ]
decreasing_tuples = sorted(partitions.items(),
key=lambda x: (x[1][SZ], x[0]), reverse=True)

partsorted = OrderedDict(decreasing_tuples)

generate_final_linker(args.output, partsorted)
if args.verbose:

0 comments on commit eefea9d

Please sign in to comment.
You can’t perform that action at this time.