From 65964692dd05b1ee0e441d8d77f0568492716786 Mon Sep 17 00:00:00 2001 From: Mateusz Karlic Date: Mon, 17 Oct 2022 08:16:32 +0200 Subject: [PATCH] json2renode: Add auto-align hint --- litex/tools/litex_json2renode.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/litex/tools/litex_json2renode.py b/litex/tools/litex_json2renode.py index ced32904a..1cfe82e3d 100755 --- a/litex/tools/litex_json2renode.py +++ b/litex/tools/litex_json2renode.py @@ -772,6 +772,8 @@ def filter_memory_regions(raw_regions, alignment=None, autoalign=[]): size_mismatch = r['size'] % alignment address_mismatch = r['base'] % alignment + def print_autoalign_hint(): + print('Hint: use "--auto-align {}" to force automatic alignement of the region'.format(r['name'])) if address_mismatch != 0: if r['name'] in autoalign: r['original_address'] = r['base'] @@ -779,6 +781,7 @@ def filter_memory_regions(raw_regions, alignment=None, autoalign=[]): print('Re-aligning `{}` memory region base address from {} to {} due to limitations in Renode'.format(r['name'], hex(r['original_address']), hex(r['base']))) else: print('Error: `{}` memory region base address ({}) is not aligned to {}. This configuration cannot be currently simulated in Renode'.format(r['name'], hex(r['size']), hex(alignment))) + print_autoalign_hint() sys.exit(1) if size_mismatch != 0: @@ -788,6 +791,7 @@ def filter_memory_regions(raw_regions, alignment=None, autoalign=[]): print('Extending `{}` memory region size from {} to {} due to limitations in Renode'.format(r['name'], hex(r['original_size']), hex(r['size']))) else: print('Error: `{}` memory region size ({}) is not aligned to {}. This configuration cannot be currently simulated in Renode'.format(r['name'], hex(r['size']), hex(alignment))) + print_autoalign_hint() sys.exit(1) if r['size'] == 0: