From b2cbaa46d04efa453ce44a89ed7bc8c43cd45d69 Mon Sep 17 00:00:00 2001 From: Dan White Date: Mon, 29 Apr 2013 14:12:06 -0500 Subject: [PATCH] update asm include system to GCC syntax --- Makefile | 2 +- inc2syms.py | 10 ++++++---- mmap2inc.sh | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index afc2a76..a52c798 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ default: rom.asm x.asm ./rcf2ihex.py $< > $@ %.asm: %.hex ns430-atoi.inc - msp430-objdump --disassemble-all --architecture=msp:54 $< \ + msp430-objdump --disassemble-all --architecture=msp $< \ | ./inc2syms.py ns430-atoi.inc | ./rename_regs.sh > $@ %.h: %.mmap diff --git a/inc2syms.py b/inc2syms.py index ec036ed..8b58c29 100755 --- a/inc2syms.py +++ b/inc2syms.py @@ -20,11 +20,13 @@ syms = {} addrs = {} print 'Symbol Table:' for line in incfile: - if 'equ' in line: + if line.startswith('.equ'): sp = line.strip().split() - syms[sp[0]] = '0x' + sp[2][:-1] - addrs[syms[sp[0]]] = sp[0] - print ' %s: %s' % (sp[0], syms[sp[0]]) + sym = sp[1][:-1] + value = sp[2] + syms[sym] = value + addrs[syms[sym]] = sym + print ' %s: %s' % (sym, syms[sym]) lines = asmfile.readlines() diff --git a/mmap2inc.sh b/mmap2inc.sh index 3e7e82f..eb26992 100755 --- a/mmap2inc.sh +++ b/mmap2inc.sh @@ -5,6 +5,6 @@ # transform to assembler equ's egrep -o '#.*' $1 \ | cut -c 2- \ - | tr -d = \ - | awk '{print $1 " equ " $2}' + | tr -d =h \ + | awk '{print ".equ " $1 ", 0x" $2}' -- 2.25.1