######################################################################## # COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED. # # Module name : jats_runtime_arm251.pm # Module type : Makefile system # Compiler(s) : Perl # Description : JATS Make Time Support for the ARM251 toolchain # # This package contains functions that are invoked by the JATS # generated makefiles to perform complicated operations at Make Time # # The functions are designed to be invoked as: # $(GBE_PERL) -Mjats_runtime_arm251 -e -- + # # The functions in this packages are designed to take parameters # from @ARVG as this makes the interface easier to read. # # This package is used to speedup and simplify the JATS builds # Some things are easier to do in Perl than shell hidden inside # a makefile # #......................................................................# require 5.006_001; use strict; use warnings; package jats_runtime_arm251; our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION); use Exporter; use JatsError qw(:name=ARM251); $VERSION = 1.00; @ISA = qw(Exporter); # Symbols to autoexport (:DEFAULT tag) @EXPORT = qw( create_heap printenv ); # # Parsed options are stored globally # our %opts; #BEGIN #{ # print "-------jats_runtime_arm251 initiated\n"; #} #------------------------------------------------------------------------------- # Function : process_options # # Description : Extract options from the front of the command stream # # Options of the form --Opt=Val are split out # Options of the form --Opt will set (or increment a value) # # Inputs : None: Uses global ARGV # # Returns : None: Resets global argv # Populates the %opts hash # sub process_options { while ( my $entry = shift @ARGV ) { if ( $entry =~ m/^--(.*)/ ) { if ( $1 =~ m/(.*)=(.*)/ ) { $opts{$1} = $2; } else { $opts{$1}++; } } else { unshift @ARGV, $entry; last; } } # # Process some known options # These are the same as those provided by 'jats_runtime' # $opts{'Progress'} = $opts{'Verbose'} if ( $opts{'Verbose'} ); ErrorConfig( 'name', $opts{Name}) if ( $opts{'Name'} ); ErrorConfig( 'verbose', $opts{Verbose}) if ( $opts{'Verbose'} ); DebugDumpData("RunTime Opts", \%opts ) if ( $opts{'ShowOpts'} );; Message ("RunTime args: @ARGV") if ( $opts{'ShowArgs'} ); printenv() if ( $opts{'ShowEnv'} ); Message ($opts{'Message'}) if ( $opts{'Message'} ); } #------------------------------------------------------------------------------- # Function : printenv # # Description : Display all EnvVars # # Inputs : None # # Returns : # sub printenv { foreach my $entry ( sort keys %ENV ) { print " $entry=$ENV{$entry}\n"; } } #------------------------------------------------------------------------------- # Function : create_heap # # Description : Create an assembler file to hold the heap data # # Inputs : @ARGV # --Heap=nn # --OutFile=Filename # # Returns : # sub create_heap { process_options(); Error ("No Heap size provided") unless ( defined $opts{'Heap'} ); Error ("No Outfile provided") unless ( defined $opts{'OutFile'} ); Message ("Create Heap File"); # # Create a file and place known data into it # open (FH, '>', $opts{'OutFile'} ) || Error ("Cannot create: $opts{'OutFile'}", "Reason: $!"); print FH << "EOT"; GBLS VBar VBar SETS "|" ;------------------------------------------------------------------------ ; Macro to start a bss section ;------------------------------------------------------------------------ MACRO BSS_SECTION \$name [ "\$name" = "" AREA |C\$\$bss|, NOINIT | LCLS AName AName SETS VBar:CC:"\$name":CC:"\$":CC:"\$code":CC:VBar AREA \$AName, NOINIT ] MEND BSS_SECTION ApplicationHeap EXPORT ApplicationHeap ApplicationHeap \% $opts{'Heap'} END EOT close FH; } 1;