#!@pathperl@ -w # # This script generates an ihex binary image and XML description # from an srec binary image. These are used by the Deluge binary # image dissemination service. # #$Id$ #@author Jonathan Hui # use strict; my $MaxNameLength = 10; if ( @ARGV == 0 ) { print "usage: tos-write-image [ident_flags] [exe_file]\n"; exit 0; } my %ident_flags = (); my $exe = ""; my $ihex = ""; my $objdump = "avr-objdump"; 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 =~ /^--ihex=(.+)$/) { $ihex = $1; } elsif ($arg =~ /^--exe=(.+)$/) { $exe = $1; } elsif ($arg =~ /^--objdump=(.+)$/) { $objdump = $1; } elsif ($arg =~ /^--platform=(.+)$/) { $platform = $1; } } my $deluge_support = "no"; # See if app has deluge included open( EXE, "$objdump -t $exe |") or die "Cannot open exe file: $!\n"; while() { if ( /Deluge/ ) { $deluge_support = "yes"; } } close(EXE); $ident_flags{"deluge_support"} = $deluge_support; $ident_flags{"platform"} = $platform; open ( IHEX, $ihex ) or die "Cannot open ihex file: $!\n"; print "\n"; print " \n"; for my $flag (keys %ident_flags) { print " <$flag>$ident_flags{$flag}\n"; } print " \n"; print " \n"; while ( my $line = ) { print $line; } print " \n"; print "\n";