Updated script for generating symbols.[ch]

This commit is contained in:
adamdunkels 2006-12-19 08:57:26 +00:00
parent 1e23eb29ba
commit 0cd74875da

View file

@ -1,13 +1,24 @@
#!/bin/sh
echo \#include '"loader/symbols.h"'
echo "const struct symbols symbols[] = {"
NM=msp430-nm
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`
SYMBOLS=`expr $SYMBOLS + 1`
echo \#ifndef __SYMBOLS_H__ > symbols.h
echo \#define __SYMBOLS_H__ >> symbols.h
echo \#include '"loader/symbols-def.h"' >> symbols.h
echo "extern const struct symbols symbols[$SYMBOLS];" >> symbols.h
echo \#endif >> symbols.h
echo \#include '"symbols.h"' > symbols.c
echo "const struct symbols symbols[$SYMBOLS] = {" >> symbols.c
if [ -f $* ] ; then
msp430-nm $* | perl -ne 'print ".global $2\n$2 = 0x$1\n" if(/([0-9a-f]+) [ABDRST] (.+)$/);' | grep -v _reset_vector | grep = | perl -ne 'print "{\"$1\", (char *)$2},\n" if(/(\w+) = (\w+)/)' | sort
$NM $* | perl -ne 'print ".global $2\n$2 = 0x$1\n" if(/([0-9a-f]+) [ABDRST] (.+)$/);' | grep -v _reset_vector | grep = | perl -ne 'print "{\"$1\", (char *)$2},\n" if(/(\w+) = (\w+)/)' | sort >> symbols.c
# 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
status=$?
fi
echo "{(void *)0, 0} };"
echo "{(void *)0, 0} };" >> symbols.c
exit $status