blob: 0ba2554d59dba96ced0bb92edd7abd69b1ada2c6 [file] [log] [blame]
#!/usr/bin/perl -w
#use strict;
use lib "tools/perl";
use Spreadsheet::ParseExcel;
my $CUSTOMDIR;
if ($#ARGV == 0) {
$CUSTOMDIR = $ARGV[0];
} else {
$CUSTOMDIR = "$ENV{'WORKDIR'}/custom/build";
}
my $FileName = "$CUSTOMDIR/flash_partition.xls";
my $parser = Spreadsheet::ParseExcel->new();
my $workbook = $parser->parse($FileName);
die $parser->error(), ".\n" if ( !defined $workbook );
# Iterate through all worksheets
system("rm -rf $CUSTOMDIR/*.txt");
for my $worksheet ( $workbook->worksheets() ) {
# Find out the worksheet ranges
my ( $row_min, $row_max ) = $worksheet->row_range();
my ( $col_min, $col_max ) = $worksheet->col_range();
my $FILE = "$CUSTOMDIR/$worksheet->{Name}.txt";
open (MYFILE, ">$FILE");
print MYFILE "############################################################################################################\n";
print MYFILE "#\n";
print MYFILE "# Layout Setting\n";
print MYFILE "#\n";
print MYFILE "############################################################################################################\n";
for my $row ( $row_min .. $row_max ) {
next if ($row == 0);
$tmp = $row;
print MYFILE "- partition_index: SYS", $tmp - 1, "\n";
for my $col ( $col_min .. $col_max ) {
# Return the cell object at $row and $col
my $cell = $worksheet->get_cell( $row, $col );
next unless $cell;
if ($col == 0 ) { print MYFILE " partition_name: ", $cell->value(), "\n"}
if ($col == 1 ) {
=head
if($cell->value() eq "modem.img")
{
if($ENV{'MODEM_NAME'} eq "modem.img")
{
#Default Value
print MYFILE " file_name: ", $cell->value(), "\n"
}else{
print MYFILE " file_name: ", $ENV{'MODEM_NAME'}, "\n"
}
}elsif($cell->value() eq "modemc2k.img"){
if($ENV{'MODEMC2K_NAME'} eq "modemc2k.img")
{
#Default Value
print MYFILE " file_name: ", $cell->value(), "\n"
}else{
print MYFILE " file_name: ", $ENV{'MODEMC2K_NAME'}, "\n"
}
}elsif($cell->value() eq "dsp.bin"){
if($ENV{'DSP_NAME'} eq "dsp.bin")
{
#Default Value
print MYFILE " file_name: ", $cell->value(), "\n"
}else{
print MYFILE " file_name: ", $ENV{'DSP_NAME'}, "\n"
}
}else{
print MYFILE " file_name: ", $cell->value(), "\n"
}
=cut
print MYFILE " file_name: ", $cell->value(), "\n"
}
if ($col == 2 ) { print MYFILE " is_download: ", $cell->value(), "\n"}
if ($col == 3 ) { print MYFILE " type: ", $cell->value(), "\n"}
if ($col == 4 ) { print MYFILE " linear_start_addr: ", $cell->value(), "\n"}
if ($col == 5 ) { print MYFILE " physical_start_addr: ", $cell->value(), "\n"}
if ($col == 6 ) { print MYFILE " partition_size: ", $cell->value(), "\n"}
if ($col == 7 ) { print MYFILE " region: ", $cell->value(), "\n"}
if ($col == 8 ) { print MYFILE " storage: ", $cell->value(), "\n"}
if ($col == 9 ) { print MYFILE " boundary_check: ", $cell->value(), "\n"}
if ($col == 10) { print MYFILE " is_reserved: ", $cell->value(), "\n"}
if ($col == 11) { print MYFILE " operation_type: ", $cell->value(), "\n"}
if ($col == 12) { print MYFILE " reserve: ", $cell->value(), "\n"}
}
print MYFILE "\n";
}
print MYFILE "\n";
close (MYFILE);
}