Subversion Repositories DevTools

Rev

Rev 5709 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
363 dpurdie 1
########################################################################
6177 dpurdie 2
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
363 dpurdie 3
#
4
# Module name   : jats_runtime_arm251.pm
5
# Module type   : Makefile system
6
# Compiler(s)   : Perl
7
# Description   : JATS Make Time Support for the ARM251 toolchain
8
#
9
#                 This package contains functions that are invoked by the JATS
10
#                 generated makefiles to perform complicated operations at Make Time
11
#
12
#                 The functions are designed to be invoked as:
13
#                   $(GBE_PERL) -Mjats_runtime_arm251 -e <function> -- <args>+
14
#
15
#                 The functions in this packages are designed to take parameters
16
#                 from @ARVG as this makes the interface easier to read.
17
#
18
#                 This package is used to speedup and simplify the JATS builds
19
#                 Some things are easier to do in Perl than shell hidden inside
20
#                 a makefile
21
#
22
#......................................................................#
23
 
24
require 5.006_001;
25
use strict;
26
use warnings;
27
 
28
package jats_runtime_arm251;
29
 
30
our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION);
31
use Exporter;
32
use JatsError qw(:name=ARM251);
33
 
34
$VERSION = 1.00;
35
@ISA = qw(Exporter);
36
 
37
# Symbols to autoexport (:DEFAULT tag)
38
@EXPORT = qw( create_heap
39
              printenv
40
            );
41
 
42
#
43
#   Parsed options are stored globally
44
#
45
our %opts;
46
 
47
#BEGIN
48
#{
49
#    print "-------jats_runtime_arm251 initiated\n";
50
#}
51
 
52
#-------------------------------------------------------------------------------
53
# Function        : process_options
54
#
55
# Description     : Extract options from the front of the command stream
56
#
57
#                   Options of the form --Opt=Val are split out
58
#                   Options of the form --Opt will set (or increment a value)
59
#
60
# Inputs          : None: Uses global ARGV
61
#
62
# Returns         : None: Resets global argv
63
#                         Populates the %opts hash
64
#
65
sub process_options
66
{
67
    while ( my $entry = shift @ARGV )
68
    {
69
        if ( $entry =~  m/^--(.*)/  )
70
        {
71
            if ( $1 =~ m/(.*)=(.*)/ )
72
            {
73
                $opts{$1} = $2;
74
            }
75
            else
76
            {
77
                $opts{$1}++;
78
            }
79
        }
80
        else
81
        {
82
            unshift @ARGV, $entry;
83
            last;
84
        }
85
    }
86
    #
87
    #   Process some known options
88
    #   These are the same as those provided by 'jats_runtime'
89
    #
90
    $opts{'Progress'} = $opts{'Verbose'}    if ( $opts{'Verbose'} );
91
    ErrorConfig( 'name', $opts{Name})       if ( $opts{'Name'} );
92
    ErrorConfig( 'verbose', $opts{Verbose}) if ( $opts{'Verbose'} );
93
    DebugDumpData("RunTime Opts", \%opts )  if ( $opts{'ShowOpts'} );;
94
    Message ("RunTime args: @ARGV")         if ( $opts{'ShowArgs'} );
95
    printenv()                              if ( $opts{'ShowEnv'} );
96
    Message ($opts{'Message'})              if ( $opts{'Message'} );
97
}
98
 
99
#-------------------------------------------------------------------------------
100
# Function        : printenv
101
#
102
# Description     : Display all EnvVars
103
#
104
# Inputs          : None
105
#
106
# Returns         :
107
#
108
sub printenv
109
{
110
    foreach my $entry ( sort keys %ENV )
111
    {
112
        print "    $entry=$ENV{$entry}\n";
113
    }
114
}
115
 
116
#-------------------------------------------------------------------------------
117
# Function        : create_heap
118
#
119
# Description     : Create an assembler file to hold the heap data
120
#
121
# Inputs          : @ARGV
122
#                       --Heap=nn
123
#                       --OutFile=Filename
124
#
125
# Returns         : 
126
#
127
sub create_heap
128
{
129
    process_options();
130
    Error ("No Heap size provided") unless ( defined $opts{'Heap'} );
131
    Error ("No Outfile provided") unless ( defined $opts{'OutFile'} );
132
    Message ("Create Heap File");
133
 
134
    #
135
    #   Create a file and place known data into it
136
    #
137
    open (FH, '>', $opts{'OutFile'} ) || Error ("Cannot create: $opts{'OutFile'}", "Reason: $!");
138
    print FH << "EOT";
139
    	GBLS    VBar
140
VBar    SETS    "|"
141
 
142
;------------------------------------------------------------------------
143
; Macro to start a bss section
144
;------------------------------------------------------------------------
145
       MACRO
146
       BSS_SECTION     \$name
147
    [ "\$name" = ""
148
       AREA    |C\$\$bss|, NOINIT
149
       |
150
       LCLS    AName
151
AName  SETS    VBar:CC:"\$name":CC:"\$":CC:"\$code":CC:VBar
152
       AREA    \$AName, NOINIT
153
    ]
154
       MEND
155
 
156
       BSS_SECTION ApplicationHeap
157
       EXPORT ApplicationHeap
158
ApplicationHeap   \%     $opts{'Heap'}
159
       END
160
EOT
161
 
162
    close FH;
163
}
164
 
165
 
166
1;