Add simple webserver for RPL status
[contiki-2.x.git] / tools / avr-make-symbols
blobd8365f5ba44abbda3c6cbdb360de54b180b46a1f
1 #!/bin/sh
3 NM=avr-nm
5 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`
6 SYMBOLS=`expr $SYMBOLS + 1`
8 echo \#ifndef __SYMBOLS_H__ > symbols.h
9 echo \#define __SYMBOLS_H__ >> symbols.h
10 echo \#include '"loader/symbols-def.h"' >> symbols.h
11 echo "extern const struct symbols symbols[$SYMBOLS];" >> symbols.h
12 echo \#endif >> symbols.h
14 echo \#include '"symbols.h"' > symbols.c
15 echo \#include '<avr/pgmspace.h>' >> symbols.c
16 $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 "static const prog_char s_$1 [] = \"$1\";\n" if(/(\w+) = (\w+)/)' | sort >> symbols.c
18 echo "PROGMEM const struct symbols symbols[] = {" >> symbols.c
19 avr-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 "{(const char*)s_$1, (void*)$2},\n" if(/(\w+) = (\w+)/)' | sort >> symbols.c
20 echo "{(const char *)0, (void*)0} };" >> symbols.c