From 742d9605d866e62bec6fc0f27344b278d11d31dd Mon Sep 17 00:00:00 2001 From: beutel Date: Fri, 17 Aug 2007 15:47:30 +0000 Subject: [PATCH] added new extra target tos_buildinfo to create an xml file containing metrics and info of the builds, e.g. memory sizes --- support/make/avr/avr.rules | 5 +- support/make/msp/msp.rules | 3 ++ support/make/tos_buildinfo.extra | 9 ++++ tools/configure.ac | 1 + tools/tinyos/misc/Makefile.am | 1 + tools/tinyos/misc/tos-write-buildinfo.in | 59 ++++++++++++++++++++++++ 6 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 support/make/tos_buildinfo.extra create mode 100644 tools/tinyos/misc/tos-write-buildinfo.in diff --git a/support/make/avr/avr.rules b/support/make/avr/avr.rules index d61f14f0..9d398109 100644 --- a/support/make/avr/avr.rules +++ b/support/make/avr/avr.rules @@ -48,7 +48,7 @@ ifndef DEFAULT_PROGRAM DEFAULT_PROGRAM = dapa endif -BUILDLESS_DEPS += bytes +BUILDLESS_DEPS += bytes ifndef NOWIRING include $(TINYOS_MAKE_PATH)/wiring.extra @@ -83,6 +83,9 @@ delsetid: FORCE srec: exe FORCE $(OBJCOPY) --output-target=srec $(MAIN_EXE) $(MAIN_SREC) +tos_buildinfo: ihex build_buildinfo FORCE + @: + tosimage: ihex build_tosimage FORCE @: diff --git a/support/make/msp/msp.rules b/support/make/msp/msp.rules index 0c98cf45..6253da4e 100644 --- a/support/make/msp/msp.rules +++ b/support/make/msp/msp.rules @@ -72,6 +72,9 @@ endif setid: FORCE @cmd () { echo "$$@"; $$@; }; if [ x = x$(NODEID) ]; then cmd cp $(MAIN_IHEX) $(INSTALL_IHEX); else cmd $(SET_ID) --objcopy $(OBJCOPY) --objdump $(OBJDUMP) --target ihex $(MAIN_IHEX) $(INSTALL_IHEX) TOS_NODE_ID=$(NODEID) $(AMADDR)=$(NODEID); fi +tos_buildinfo: ihex build_buildinfo FORCE + @: + tosimage: ihex build_tosimage FORCE @: diff --git a/support/make/tos_buildinfo.extra b/support/make/tos_buildinfo.extra new file mode 100644 index 00000000..b4c18fe7 --- /dev/null +++ b/support/make/tos_buildinfo.extra @@ -0,0 +1,9 @@ +#-*-Makefile-*- vim:syntax=make +#$Id$ + +TOS_BUILDINFO_PL ?= tos-write-buildinfo +IDENT_PROGRAM_NAME ?= $(COMPONENT) + +build_buildinfo: FORCE + @echo " writing TOS buildinfo" + @$(TOS_BUILDINFO_PL) $(IDENT_FLAGS) --exe="$(MAIN_EXE)" --size="$(SIZE)" --platform="$(PLATFORM)" > $(BUILDDIR)/tos_buildinfo.xml diff --git a/tools/configure.ac b/tools/configure.ac index a024efa0..8b90e887 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -138,6 +138,7 @@ AC_OUTPUT( tinyos/misc/tos-ident-flags tinyos/misc/tos-install-jni tinyos/misc/tos-set-symbols + tinyos/misc/tos-write-buildinfo tinyos/misc/tos-write-image tinyos/misc/tos-storage-at45db tinyos/misc/tos-storage-stm25p diff --git a/tools/tinyos/misc/Makefile.am b/tools/tinyos/misc/Makefile.am index 6c2ee153..276314be 100644 --- a/tools/tinyos/misc/Makefile.am +++ b/tools/tinyos/misc/Makefile.am @@ -23,6 +23,7 @@ bin_SCRIPTS = tos-ident-flags \ tos-mviz \ tos-serial-configure \ tos-set-symbols \ + tos-write-buildinfo \ tos-write-image \ tos-check-env \ tos-storage-stm25p \ diff --git a/tools/tinyos/misc/tos-write-buildinfo.in b/tools/tinyos/misc/tos-write-buildinfo.in new file mode 100644 index 00000000..980e0c96 --- /dev/null +++ b/tools/tinyos/misc/tos-write-buildinfo.in @@ -0,0 +1,59 @@ +#!@pathperl@ -w +# +# This script generates an XML description of the buildinformation. This is +# primarily used by other tools such as checkers, tests and continuous +# integration. +# +#$Id$ +#@author Jan Beutel +# +use strict; + +my $MaxNameLength = 10; + +if ( @ARGV == 0 ) { + print "usage: tos-write-buildinfo [ident_flags] [exe_file]\n"; + exit 0; +} + +my %ident_flags = (); +my $exe = ""; +my $size = "avr-size"; +my $platform = ""; + +for my $arg (@ARGV) { + if ($arg =~ /^-DIDENT_(.+)=0x(.+)$/) { + $ident_flags{lc($1)} = uc($2); + } + elsif ($arg =~ /^-DIDENT_(.+)="(.+)"$/) { + $ident_flags{lc($1)} = $2; + } + elsif ($arg =~ /^--exe=(.+)$/) { + $exe = $1; + } + elsif ($arg =~ /^--size=(.+)$/) { + $size = $1; + } + elsif ($arg =~ /^--platform=(.+)$/) { + $platform = $1; + } +} + + +my @text; +my $rc2 = qx"$size $exe |grep main "; +#print $rc2; +print $size; +@text = split(' ', $rc2); + +print "\n"; +print " "; +print $text[1]; +print "\n"; +print " "; +print $text[0]; +print "\n"; +print " "; +print $text[2]; +print "\n"; +print "\n"; -- 2.39.2