4 SYMBOLS
=`$NM $* | perl -ne 'print ".global $2\n$2 = 0x$1\n" if(/([0-9a-f]+) [ABDRST] (.+)$/);' | grep -v ^_ | grep -v _reset_vector | grep = | perl -ne 'print "{\"$1\", (char *)$2},\n" if(/(\w+) = (\w+)/)' | wc -l`
5 SYMBOLS
=`expr $SYMBOLS + 1`
7 echo \
#ifndef __SYMBOLS_H__ > symbols.h
8 echo \
#define __SYMBOLS_H__ >> symbols.h
9 echo \
#include '"loader/symbols-def.h"' >> symbols.h
10 echo "extern const struct symbols symbols[$SYMBOLS];" >> symbols.h
11 echo \
#endif >> symbols.h
13 echo \
#include '"symbols.h"' > symbols.c
14 echo "const struct symbols symbols[$SYMBOLS] = {" >> symbols.c
17 $NM $
* | perl
-ne 'print ".global $2\n$2 = 0x$1\n" if(/([0-9a-f]+) [ABDRST] (.+)$/);' |
grep -v ^_ |
grep -v _reset_vector |
grep = | perl
-ne 'print "{\"$1\", (char *)$2},\n" if(/(\w+) = (\w+)/)' |
sort >> symbols.c
18 # msp430-nm $* | perl -ne 'print ".global $2\n$2 = 0x$1\n" if(/([0-9a-f]+) [ABDRST] (.+)$/);' | grep -v ^_ | grep -v _reset_vector | grep = | perl -ne 'print "{\"$1\", (char *)$2},\n" if(/(\w+) = (\w+)/)' | sort
22 echo "{(void *)0, 0} };" >> symbols.c