Add simple webserver for RPL status
[contiki-2.x.git] / tools / msp430-make-symbols
blobe434d3bc062726c54ac168cd24b607508dd70445
1 #!/bin/sh
2 NM=msp430-nm
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
16 if [ -f $* ] ; then
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
19 status=$?
22 echo "{(void *)0, 0} };" >> symbols.c
24 exit $status