gen_isr_tables: error improvements

Random readability improvements:

- avoid a stack trace on error by using sys.exit()
- include "error:" in the error() output, for grep
- print conflicting addresses on multiple IRQ registration

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-04-14 21:24:35 -07:00 committed by Carles Cufí
commit 6d0896b7ec

View file

@ -32,8 +32,7 @@ def debug(text):
sys.stdout.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") sys.stdout.write(os.path.basename(sys.argv[0]) + ": " + text + "\n")
def error(text): def error(text):
sys.stderr.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") sys.exit(os.path.basename(sys.argv[0]) + ": error: " + text + "\n")
raise Exception()
def endian_prefix(): def endian_prefix():
if args.big_endian: if args.big_endian:
@ -304,6 +303,7 @@ def main():
if swt[table_index] != (0, spurious_handler): if swt[table_index] != (0, spurious_handler):
error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})"
+ f"\nExisting handler 0x{swt[table_index][1]:x}, new handler 0x{func:x}"
+ "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?"
) )