| 6177 |
dpurdie |
1 |
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
|
| 227 |
dpurdie |
2 |
#
|
|
|
3 |
# Module name : mos_mri
|
|
|
4 |
# Module type : Makefile system
|
|
|
5 |
# Compiler(s) : ANSI C
|
|
|
6 |
# Environment(s): MOS
|
|
|
7 |
#
|
|
|
8 |
# Description:
|
|
|
9 |
# MRI 68k/CF toolset for MOS
|
|
|
10 |
# This file provides Toolset initialisation and plugin functions
|
|
|
11 |
# to makelib.pl2
|
|
|
12 |
#
|
|
|
13 |
# Contents: MRI 68k/CF rules as used for the MOS
|
|
|
14 |
#
|
|
|
15 |
#............................................................................#
|
|
|
16 |
|
|
|
17 |
use strict;
|
|
|
18 |
use warnings;
|
|
|
19 |
|
|
|
20 |
#
|
|
|
21 |
# Toolset Global variables
|
|
|
22 |
#
|
|
|
23 |
my $Toolset_DebugCode;
|
|
|
24 |
my $Toolset_DebugData;
|
|
|
25 |
my $Toolset_Product = '';
|
| 239 |
dpurdie |
26 |
my $Toolset_Production_Only;
|
| 227 |
dpurdie |
27 |
|
| 6276 |
dpurdie |
28 |
my $globName = 'glob$(GBE_TYPE)'; # Name of the MOS global library file
|
| 227 |
dpurdie |
29 |
|
|
|
30 |
##############################################################################
|
|
|
31 |
# ToolsetInit()
|
|
|
32 |
# Runtime initialisation
|
|
|
33 |
#
|
|
|
34 |
##############################################################################
|
|
|
35 |
|
|
|
36 |
ToolsetInit();
|
|
|
37 |
|
|
|
38 |
sub ToolsetInit
|
|
|
39 |
{
|
|
|
40 |
my( $version, $flavour );
|
|
|
41 |
my $no_defines;
|
|
|
42 |
my( @defines );
|
|
|
43 |
my $board = '';
|
|
|
44 |
|
|
|
45 |
#.. Parse Toolset arguments
|
|
|
46 |
#
|
|
|
47 |
Debug( "mos_mri(@::ScmToolsetArgs)\n" );
|
|
|
48 |
|
|
|
49 |
$version = 0; # Default (not great)
|
|
|
50 |
$flavour = '68k';
|
|
|
51 |
foreach $_ ( @::ScmToolsetArgs ) {
|
|
|
52 |
if (/^--Version=(.*)/) { # Compiler version
|
|
|
53 |
$version = "$1";
|
|
|
54 |
} elsif (/^--68k/) { # Compiler flavour
|
|
|
55 |
$flavour = '68k';
|
|
|
56 |
} elsif (/^--coldfire/) { # Compiler flavour
|
|
|
57 |
$flavour = 'cf';
|
|
|
58 |
} elsif (/^--NoDefines/) { # Vanila defines
|
|
|
59 |
$no_defines = 1;
|
|
|
60 |
} else {
|
|
|
61 |
Message( "mos_mri: unknown toolset argument $_ -- ignored" );
|
|
|
62 |
}
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
#.. Parse Platform Arguments
|
|
|
66 |
#
|
|
|
67 |
foreach $_ ( @::ScmPlatformArgs ) {
|
|
|
68 |
if (/^--product=(.*)/) { # GBE product
|
|
|
69 |
$Toolset_Product = $1;
|
|
|
70 |
} elsif (/^--board=(.*)/) { # Board subtypes
|
|
|
71 |
$board = $1;
|
|
|
72 |
} else {
|
|
|
73 |
Message( "mos_mri: unknown platform argument $_ -- ignored" );
|
|
|
74 |
}
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
#
|
| 239 |
dpurdie |
78 |
# Is this a ProductionOnly build, then we don't need the debug code and data
|
|
|
79 |
# when building a THX. Determine, if this is a ProductionOnly build.
|
|
|
80 |
#
|
|
|
81 |
foreach ( @{$::BUILDINFO{$::ScmPlatform}{ARGS}} )
|
|
|
82 |
{
|
|
|
83 |
if ( m~^--OnlyProd~ )
|
|
|
84 |
{
|
|
|
85 |
$Toolset_Production_Only = 1;
|
|
|
86 |
last;
|
|
|
87 |
}
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
#
|
| 227 |
dpurdie |
91 |
# Definitions common to all platforms
|
|
|
92 |
# These will be picked up when no platform has been defined: ie when
|
|
|
93 |
# simply building for MOS68K or MOSCF
|
|
|
94 |
#
|
|
|
95 |
# Note: _MICROTEC is predefined by the compiler
|
|
|
96 |
#
|
|
|
97 |
unless ( $no_defines )
|
|
|
98 |
{
|
|
|
99 |
push @defines, 'MOS';
|
|
|
100 |
push @defines, '_MOS';
|
|
|
101 |
push @defines, '_MOS_=1';
|
|
|
102 |
push @defines, '_MOS_PERTH_=1';
|
|
|
103 |
push @defines, 'MICROTEC=1';
|
|
|
104 |
push @defines, 'MRI=1';
|
|
|
105 |
push @defines, 'BIG_ENDIAN=1';
|
|
|
106 |
push @defines, 'CcCpuBigEndian=1';
|
|
|
107 |
push @defines, 'CcSupervisor=$(MODE_CCSUPERVISOR)';
|
|
|
108 |
push @defines, 'CcCpu=$(mri_cpu_code)';
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
#
|
|
|
112 |
# Platform specific definitions
|
|
|
113 |
# Set default code and data for development purposes only
|
|
|
114 |
# This can be overridden
|
|
|
115 |
#
|
|
|
116 |
if ( $Toolset_Product eq "GAK" || $Toolset_Product eq "TPT" )
|
|
|
117 |
{
|
|
|
118 |
# Example only
|
|
|
119 |
#push @defines, ' SSM_DV';
|
|
|
120 |
#push @defines, ' DES_ALIGN_CHECK';
|
|
|
121 |
#push @defines, ' AMCCIF=15';
|
|
|
122 |
#push @defines, ' PACKED=packed';
|
|
|
123 |
|
|
|
124 |
if ( $flavour eq '68k' )
|
|
|
125 |
{
|
|
|
126 |
$Toolset_DebugCode = "08100000H";
|
|
|
127 |
$Toolset_DebugData = "0800800CH";
|
|
|
128 |
}
|
|
|
129 |
else
|
|
|
130 |
{
|
|
|
131 |
$Toolset_DebugCode = "08200000H";
|
|
|
132 |
$Toolset_DebugData = "0800800CH";
|
|
|
133 |
}
|
|
|
134 |
}
|
|
|
135 |
elsif ( $Toolset_Product eq "PCP" )
|
|
|
136 |
{
|
|
|
137 |
$board = "08200000H,0800800CH" if ( $board =~ m/development/i );
|
|
|
138 |
$Toolset_DebugCode = "08100000H";
|
|
|
139 |
$Toolset_DebugData = "0800800CH";
|
|
|
140 |
}
|
|
|
141 |
elsif ( $Toolset_Product eq "VCP" )
|
|
|
142 |
{
|
|
|
143 |
$Toolset_DebugCode = "08100000H";
|
|
|
144 |
$Toolset_DebugData = "0800800CH";
|
|
|
145 |
}
|
| 303 |
dpurdie |
146 |
elsif ( $Toolset_Product eq "TP5" or $Toolset_Product eq "PICP" )
|
| 227 |
dpurdie |
147 |
{
|
|
|
148 |
$board = "08000000H,0400800CH" if ( $board =~ m/green/i );
|
|
|
149 |
$Toolset_DebugCode = "05C00000H";
|
|
|
150 |
$Toolset_DebugData = "0400800CH";
|
|
|
151 |
}
|
|
|
152 |
elsif ( $Toolset_Product eq "SSU" )
|
|
|
153 |
{
|
|
|
154 |
# $Toolset_DebugCode = "08100000H";
|
|
|
155 |
# $Toolset_DebugData = "0800800CH";
|
|
|
156 |
}
|
|
|
157 |
elsif ( $Toolset_Product eq "DDU" )
|
|
|
158 |
{
|
|
|
159 |
# $Toolset_DebugCode = "08100000H";
|
|
|
160 |
# $Toolset_DebugData = "0800800CH";
|
|
|
161 |
}
|
|
|
162 |
elsif ( $Toolset_Product eq "HCP" )
|
|
|
163 |
{
|
|
|
164 |
# $Toolset_DebugCode = "08100000H";
|
|
|
165 |
# $Toolset_DebugData = "0800800CH";
|
|
|
166 |
}
|
|
|
167 |
elsif ( $Toolset_Product eq "OBFTP" )
|
|
|
168 |
{
|
|
|
169 |
$Toolset_DebugCode = "08200000H";
|
|
|
170 |
$Toolset_DebugData = "0800800CH";
|
|
|
171 |
}
|
|
|
172 |
elsif ( $Toolset_Product )
|
|
|
173 |
{
|
| 303 |
dpurdie |
174 |
Message( "mos_mri: Unknown product: $Toolset_Product -- ignored" )
|
|
|
175 |
unless ( $board );
|
| 227 |
dpurdie |
176 |
}
|
|
|
177 |
|
|
|
178 |
#
|
|
|
179 |
# Decode any --board option
|
|
|
180 |
# This will override any defaults
|
|
|
181 |
#
|
|
|
182 |
if ($board )
|
|
|
183 |
{
|
|
|
184 |
if ( $board =~ m~(0[0-9A-F]+H),(0[0-9A-F]+H)~i )
|
|
|
185 |
{
|
|
|
186 |
$Toolset_DebugCode = $1;
|
|
|
187 |
$Toolset_DebugData = $2;
|
|
|
188 |
Message("Building for a $Toolset_Product DEVELOPMENT board: Code:$Toolset_DebugCode, Data:$Toolset_DebugData");
|
|
|
189 |
}
|
|
|
190 |
else
|
|
|
191 |
{
|
|
|
192 |
Error( "Bad board definition: $board",
|
|
|
193 |
"Expecting two hex numbers of the form 012345H" );
|
|
|
194 |
}
|
|
|
195 |
}
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
if ( $Toolset_Product && (! $Toolset_DebugCode || ! $Toolset_DebugData ))
|
|
|
199 |
{
|
|
|
200 |
Message( "mos_mri: $Toolset_Product: Debug Code and Data not specified" );
|
|
|
201 |
}
|
|
|
202 |
|
|
|
203 |
#.. Standard.rul requirements
|
|
|
204 |
#
|
|
|
205 |
$::s = 'asm'; # Assembler source file
|
|
|
206 |
$::o = 'obj'; # Object file
|
|
|
207 |
$::a = 'lib'; # Library file
|
|
|
208 |
$::so = 'thx'; # Shared library
|
|
|
209 |
$::exe = '.abs'; # Dummy, Cannot generate executables
|
|
|
210 |
|
|
|
211 |
#.. Toolset configuration
|
|
|
212 |
#
|
|
|
213 |
$::ScmToolsetVersion = "1.0.0"; # our version
|
|
|
214 |
$::ScmToolsetGenerate = 0; # generate optional
|
| 323 |
dpurdie |
215 |
$::ScmToolsetProgDependancies = 0; # handle Prog dependancies myself 7 "I:\jats_cbuilder\JATS\MASS_Dev_Infra\core_devl\CFG\TOOLSET\ACEX.PL"
|
| 227 |
dpurdie |
216 |
|
|
|
217 |
#.. Define MRI environment
|
|
|
218 |
#
|
|
|
219 |
#
|
|
|
220 |
# Define initialisation targets
|
|
|
221 |
# These will be used to ensure that correct versions of the toolset are present
|
|
|
222 |
#
|
|
|
223 |
Init( "mri", "mri2" );
|
|
|
224 |
|
|
|
225 |
ToolsetDefine ( "#################################################" );
|
|
|
226 |
ToolsetDefine ( "# MOS MRI compiler version" );
|
|
|
227 |
ToolsetDefine ( "#" );
|
|
|
228 |
ToolsetDefine ( "mri_ver = $version" );
|
|
|
229 |
ToolsetDefine ( "mri_type = $flavour" );
|
|
|
230 |
ToolsetDefine ( "" );
|
|
|
231 |
ToolsetDefine ( "#" );
|
|
|
232 |
ToolsetDefines( "mos_mri_${flavour}.def" );
|
|
|
233 |
ToolsetRules ( "mos_mri.rul" );
|
|
|
234 |
ToolsetRules ( "standard.rul" );
|
|
|
235 |
|
|
|
236 |
PlatformEntry( "MRI_DEFINES\t=", "\n", "\\\n\t", "", @defines )
|
|
|
237 |
if ( scalar @defines );
|
|
|
238 |
|
|
|
239 |
#
|
|
|
240 |
# Other toolsets used
|
|
|
241 |
#
|
|
|
242 |
PlatformDefine ("LINT_COFILE\t= MOS_MRI.LNT");
|
|
|
243 |
PlatformDefine ("LINT_PRJ_FILE\t=lint.mri");
|
|
|
244 |
ToolsetRequire( "pclint" ); # using pclint
|
|
|
245 |
|
|
|
246 |
#
|
|
|
247 |
# The debug files need to be compiled up with absolute paths to the source files
|
|
|
248 |
# The easiest way to do this is with the makefile rules created with absolute
|
|
|
249 |
# paths. Set a global flag to enable this option
|
|
|
250 |
#
|
|
|
251 |
$::UseAbsObjects = 1;
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
#.. Extend the CompilerOption directive
|
|
|
255 |
# Create a standard data structure
|
|
|
256 |
# This is a hash of hashes
|
|
|
257 |
# The first hash is keyed by CompileOption keyword
|
|
|
258 |
# The second hash contains pairs of values to set or remove
|
|
|
259 |
#
|
|
|
260 |
%::ScmToolsetCompilerOptions =
|
|
|
261 |
(
|
|
|
262 |
'ccsupervisor' => { 'MODE_CCSUPERVISOR' , '1' },
|
|
|
263 |
|
|
|
264 |
#
|
|
|
265 |
# When using MOS fast intermodule calls the optimizer will preload commonly
|
|
|
266 |
# used memory addresses into a register BEFORE the GDP has been correctly set
|
|
|
267 |
# up. Use the following option to supress this optimisation
|
|
|
268 |
#
|
|
|
269 |
'noglobaloptimization' => { 'NO_OPT_GLOBAL' , '1' },
|
|
|
270 |
|
|
|
271 |
#
|
|
|
272 |
# To enable 32-bit relative PC addressing on platforms that
|
|
|
273 |
# don't have this as a default
|
|
|
274 |
#
|
|
|
275 |
'longrelative' => { 'USE_32BIT_RELATIVE' , '1' },
|
|
|
276 |
'nolongrelative' => { 'USE_32BIT_RELATIVE' , undef },
|
| 6276 |
dpurdie |
277 |
|
|
|
278 |
#
|
|
|
279 |
# Flag the buildng of the MOS OS
|
|
|
280 |
#
|
|
|
281 |
'buildmosos' => {'BUILD_MOS_OS', '1'},
|
| 227 |
dpurdie |
282 |
|
|
|
283 |
);
|
|
|
284 |
|
|
|
285 |
#
|
|
|
286 |
# Set default options
|
|
|
287 |
# $::ScmCompilerOpts{'xxxx'} = 'yyy';
|
|
|
288 |
$::ScmCompilerOpts{'MODE_CCSUPERVISOR'} = '0';
|
|
|
289 |
$::ScmCompilerOpts{'NO_OPT_GLOBAL'} = undef;
|
|
|
290 |
$::ScmCompilerOpts{'USE_32BIT_RELATIVE'} = undef;
|
| 6276 |
dpurdie |
291 |
$::ScmCompilerOpts{'BUILD_MOS_OS'} = undef;
|
| 227 |
dpurdie |
292 |
}
|
|
|
293 |
|
|
|
294 |
##############################################################################
|
|
|
295 |
# ToolsetPreprocess()
|
|
|
296 |
# Process collected data before the makefile is generated
|
|
|
297 |
# This, optional, routine is called from within MakefileGenerate()
|
|
|
298 |
# It allows the toolset to massage any of the collected data before
|
|
|
299 |
# the makefile is created
|
|
|
300 |
#
|
|
|
301 |
##############################################################################
|
|
|
302 |
|
|
|
303 |
sub ToolsetPreprocess
|
|
|
304 |
{
|
|
|
305 |
#
|
|
|
306 |
# If the user has specified a Prog or Shared library, then the
|
|
|
307 |
# tools within this file will need to be able to access
|
|
|
308 |
# a few external resouces. These will be provided by packages
|
|
|
309 |
# that should exist
|
|
|
310 |
#
|
|
|
311 |
#
|
|
|
312 |
if ( $#::TESTPROGS >= 0 || $#::PROGS >= 0 || $#::SHLIBS >= 0)
|
|
|
313 |
{
|
|
|
314 |
my %need = ( "brt.exe" => "TOOL_BRT",
|
|
|
315 |
"modcrc.exe" => "TOOL_MODCRC",
|
|
|
316 |
"rel.exe" => "TOOL_REL",
|
|
|
317 |
"vclickpaths.exe" => "TOOL_VPATHS"
|
|
|
318 |
);
|
|
|
319 |
my %found = ();
|
|
|
320 |
|
|
|
321 |
#
|
|
|
322 |
# Locate the required files
|
|
|
323 |
#
|
|
|
324 |
for my $program ( keys( %need ))
|
|
|
325 |
{
|
|
|
326 |
if ( my $path = ToolExtensionProgram( $program ) )
|
|
|
327 |
{
|
|
|
328 |
$found{ $need{$program} } = $path;
|
|
|
329 |
delete( $need{$program} );
|
|
|
330 |
}
|
|
|
331 |
}
|
|
|
332 |
|
|
|
333 |
::Error( "Tool program(s) required by toolset not found:",
|
|
|
334 |
sort( keys %need),
|
|
|
335 |
"Check that the daf_tools and mos_tools packages are present" )
|
|
|
336 |
if ( scalar keys %need );
|
|
|
337 |
|
|
|
338 |
#
|
| 6276 |
dpurdie |
339 |
# Determine the name of the MOS global library
|
|
|
340 |
# Old MOS builds provided a library named glob.lib
|
|
|
341 |
# Newer MOS builds provide a library name globP.lib or globD.lib
|
|
|
342 |
# When building the MOS OS use the newer form
|
|
|
343 |
#
|
|
|
344 |
my $globFound = '';
|
|
|
345 |
my $globJatsFound = '' ;
|
|
|
346 |
unless ($::ScmCompilerOpts{'BUILD_MOS_OS'}) {
|
|
|
347 |
foreach my $entry ( getPackageList() ) {
|
|
|
348 |
foreach my $libdir ($entry->getLibDirs(3)) {
|
|
|
349 |
$globFound = $libdir if ( -f CatPaths($libdir, 'glob.lib') );
|
|
|
350 |
$globJatsFound = $libdir if ( -f CatPaths($libdir, 'globP.lib') );
|
|
|
351 |
$globJatsFound = $libdir if ( -f CatPaths($libdir, 'globD.lib') );
|
|
|
352 |
}
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
unless ($globJatsFound) {
|
|
|
356 |
$globName = 'glob';
|
|
|
357 |
}
|
|
|
358 |
}
|
|
|
359 |
|
|
|
360 |
if ($globFound && $globJatsFound ) {
|
|
|
361 |
Warning("Both glob.lib and glob[PD].lib found - using glob.lib")
|
|
|
362 |
}
|
|
|
363 |
::Debug("Glob library: $globName");
|
|
|
364 |
|
|
|
365 |
#
|
| 227 |
dpurdie |
366 |
# Generate the definitions
|
|
|
367 |
#
|
|
|
368 |
|
|
|
369 |
ToolsetDefine ( "#################################################" );
|
|
|
370 |
ToolsetDefine ( "# The path to tools required to build MOS Programs" );
|
|
|
371 |
ToolsetDefine ( "#" );
|
|
|
372 |
for my $defn ( keys %found )
|
|
|
373 |
{
|
|
|
374 |
ToolsetDefine ( "$defn := $found{$defn}" );
|
|
|
375 |
}
|
|
|
376 |
ToolsetDefine ( "" );
|
|
|
377 |
ToolsetDefine ( "# The drive path to prefix to the vision click paths" );
|
|
|
378 |
EnvImport( "GBE_DRV" );
|
|
|
379 |
ToolsetDefine ( "GBE_VCLICKDRV = $::GBE_DRV" );
|
|
|
380 |
}
|
|
|
381 |
}
|
|
|
382 |
|
|
|
383 |
###############################################################################
|
|
|
384 |
# ToolsetCC( $source, $obj, \@args )
|
|
|
385 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
386 |
# required to compile the source file 'source' to 'obj'
|
|
|
387 |
#
|
|
|
388 |
# Implementation Note:
|
|
|
389 |
# The MRI compilers that are being used have a problem.
|
|
|
390 |
# If the source filename is relative and longer that ~80 characters and the
|
|
|
391 |
# -Gf switch is being used, then the compiler warns that the pathname is
|
|
|
392 |
# too long to be stored in the ABS file. It then stores the relative name to
|
|
|
393 |
# the file in thr ABS file. This confuses visionclick and vclickpaths
|
|
|
394 |
#
|
|
|
395 |
# If the source file is an absolute path, then none of these problems
|
|
|
396 |
# occur, BUT the displayed error messages get chopped so that the user
|
|
|
397 |
# cannot determine the file being compiled.
|
|
|
398 |
#
|
|
|
399 |
# Solution:
|
|
|
400 |
# * Give the compiler an absolute path name
|
|
|
401 |
# * Display a shortened filename on the JATS output
|
|
|
402 |
#
|
|
|
403 |
###############################################################################
|
|
|
404 |
|
|
|
405 |
sub ToolsetCC
|
|
|
406 |
{
|
|
|
407 |
MakePrint( "\n\t\$(CC)\n" );
|
|
|
408 |
}
|
|
|
409 |
|
|
|
410 |
###############################################################################
|
|
|
411 |
# ToolsetCCDepend( $depend, \@sources )
|
|
|
412 |
# This subroutine takes the user options and builds the
|
|
|
413 |
# rule(s) required to build the dependencies for the source
|
|
|
414 |
# files 'sources' to 'depend'.
|
|
|
415 |
#
|
|
|
416 |
###############################################################################
|
|
|
417 |
|
|
|
418 |
sub ToolsetCCDepend
|
|
|
419 |
{
|
|
|
420 |
MakePrint( "\t\$(CCDEPEND)\n" );
|
|
|
421 |
}
|
|
|
422 |
|
|
|
423 |
|
|
|
424 |
###############################################################################
|
|
|
425 |
# ToolsetCXX( $source, $obj, \@args )
|
|
|
426 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
427 |
# required to compile the source file 'source' to 'obj'
|
|
|
428 |
#
|
|
|
429 |
###############################################################################
|
|
|
430 |
|
|
|
431 |
sub ToolsetCXX
|
|
|
432 |
{
|
|
|
433 |
MakePrint( "\n\t\$(CXX)\n" );
|
|
|
434 |
}
|
|
|
435 |
|
|
|
436 |
###############################################################################
|
|
|
437 |
# ToolsetCXXDepend( $depend, \@sources )
|
|
|
438 |
# This subroutine takes the user options and builds the
|
|
|
439 |
# rule(s) required to build the dependencies for the source
|
|
|
440 |
# files 'sources' to 'depend'.
|
|
|
441 |
#
|
|
|
442 |
###############################################################################
|
|
|
443 |
|
|
|
444 |
sub ToolsetCXXDepend
|
|
|
445 |
{
|
| 287 |
dpurdie |
446 |
ToolsetCCDepend();
|
| 227 |
dpurdie |
447 |
}
|
|
|
448 |
|
|
|
449 |
|
|
|
450 |
###############################################################################
|
|
|
451 |
# ToolsetAS( $source, $obj, \@args )
|
|
|
452 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
453 |
# required to compile the source file 'source' to 'obj'
|
|
|
454 |
#
|
|
|
455 |
###############################################################################
|
|
|
456 |
|
|
|
457 |
sub ToolsetAS
|
|
|
458 |
{
|
|
|
459 |
MakePrint( "\n\t\$(AS)\n" );
|
|
|
460 |
}
|
|
|
461 |
|
|
|
462 |
sub ToolsetASDepend
|
|
|
463 |
{
|
|
|
464 |
}
|
|
|
465 |
|
|
|
466 |
###############################################################################
|
|
|
467 |
# ToolsetAR( $name, \@args, \@objs )
|
|
|
468 |
# This subroutine takes the user options and builds the rules
|
|
|
469 |
# required to build the library 'name'.
|
|
|
470 |
|
|
|
471 |
#
|
|
|
472 |
# Arguments:
|
|
|
473 |
# --xxx No arguments currently defined
|
|
|
474 |
#
|
|
|
475 |
# Output:
|
|
|
476 |
# [ $(BINDIR)/name$.${a}: .... ]
|
|
|
477 |
# $(AR)
|
|
|
478 |
#
|
|
|
479 |
###############################################################################
|
|
|
480 |
|
|
|
481 |
sub ToolsetAR
|
|
|
482 |
{
|
|
|
483 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
484 |
my $lib_file = "${name}\$(GBE_TYPE)";
|
|
|
485 |
my $lib_base = "\$(LIBDIR)/$lib_file";
|
|
|
486 |
my $lib_name = "$lib_base.${a}";
|
|
|
487 |
|
|
|
488 |
Debug("ToolsetAR");
|
|
|
489 |
|
|
|
490 |
#.. Parse arguments
|
|
|
491 |
#
|
|
|
492 |
foreach $_ ( @$pArgs ) {
|
|
|
493 |
if (/^--/) {
|
|
|
494 |
Message( "AR: unknown option $_ -- ignored" );
|
|
|
495 |
}
|
|
|
496 |
}
|
|
|
497 |
|
|
|
498 |
#.. Target
|
|
|
499 |
#
|
|
|
500 |
MakeEntry( "$lib_name:\t", "", "\\\n\t\t", ".$::o", @$pObjs );
|
|
|
501 |
MakePrint( "\n\t\$(AR)\n\n" );
|
|
|
502 |
|
|
|
503 |
}
|
|
|
504 |
|
|
|
505 |
###############################################################################
|
|
|
506 |
# ToolsetARLINT( $name, \@args, \@objs )
|
|
|
507 |
# This subroutine takes the user options and builds the rules
|
|
|
508 |
# required to build the library 'name'.
|
|
|
509 |
#
|
|
|
510 |
# Arguments:
|
|
|
511 |
# --xxx No arguments currently defined
|
|
|
512 |
#
|
|
|
513 |
# Output:
|
|
|
514 |
# [ $(LIBDIR)/name$_lint: .... ]
|
|
|
515 |
# $(ARLINT)
|
|
|
516 |
#
|
|
|
517 |
###############################################################################
|
|
|
518 |
|
|
|
519 |
sub ToolsetARLINT
|
|
|
520 |
{
|
|
|
521 |
PCLintAR( @_ );
|
|
|
522 |
}
|
|
|
523 |
|
|
|
524 |
###############################################################################
|
|
|
525 |
# ToolsetARMerge()
|
|
|
526 |
# Generate the recipe to merge libraries.
|
|
|
527 |
# The dependency list is created by the caller.
|
|
|
528 |
#
|
|
|
529 |
###############################################################################
|
|
|
530 |
|
|
|
531 |
sub ToolsetARMerge
|
|
|
532 |
{
|
|
|
533 |
MakePrint( "\n\t\$(ARMERGE)\n\n" );
|
|
|
534 |
}
|
|
|
535 |
|
|
|
536 |
|
|
|
537 |
###############################################################################
|
|
|
538 |
# ToolsetSHLD $name, \@args, \@objs, \@libraries )
|
|
|
539 |
# This subroutine takes the user options and builds the rules
|
|
|
540 |
# required to link a shared library with any associated stub files
|
|
|
541 |
#
|
|
|
542 |
# Arguments:
|
|
|
543 |
# --xxx No Arguments currently specified
|
|
|
544 |
#
|
|
|
545 |
# Linker specific:
|
|
|
546 |
# --Data Generate a Data Module
|
|
|
547 |
# --Debug Generate a debug module
|
|
|
548 |
# --DebugCode=nnnnnH Generate a debug module with code at address
|
|
|
549 |
# --DebugData=nnnnnH Generate a debug module with data at address
|
|
|
550 |
# --Rel=file Specify the Release file
|
|
|
551 |
# --Implib=objfile Specify an import library object
|
|
|
552 |
# --StubOnly Only generate the stub library
|
|
|
553 |
# --BinaryImage Generate binary image instead of a THX file
|
|
|
554 |
#
|
|
|
555 |
# Output:
|
|
|
556 |
#
|
|
|
557 |
# name.thx - Loadable module
|
|
|
558 |
# name.lib - Module interface stub library
|
|
|
559 |
# name.abs - Precursor to .thx
|
|
|
560 |
# name_o.abs - Used to generate relocation information
|
|
|
561 |
# name_0.abs - Used to generate relocation information
|
|
|
562 |
#
|
|
|
563 |
# name_debug.bdx - File for debugger
|
|
|
564 |
# name_debug.ab - File for debugger
|
|
|
565 |
# name_debug.abs - Precursor to .bdx and .ab files
|
|
|
566 |
#
|
|
|
567 |
# This is a very complicated process:
|
|
|
568 |
# Generate stub library
|
|
|
569 |
# Create module header object file
|
|
|
570 |
# Link all at one address
|
|
|
571 |
# Link all at another address
|
|
|
572 |
# Determine relocation information
|
|
|
573 |
# Compile up relocation information
|
|
|
574 |
# Link all with relocation information
|
|
|
575 |
# Create VisionClick debug files
|
|
|
576 |
# Generate CRC over module
|
|
|
577 |
#
|
|
|
578 |
# $(LIBDIR)/name.thx $(BINDIR)/name.bdx $(BINDIR)/name.ab :
|
|
|
579 |
# $(BINDIR)/name.abs
|
|
|
580 |
#
|
|
|
581 |
# $(LIBDIR)/name.abs :
|
|
|
582 |
# objs ....
|
|
|
583 |
# libs ....
|
|
|
584 |
# $(OBJDIR)/linker_cmd_file
|
|
|
585 |
#
|
|
|
586 |
# $(LIBDIR)/linker_cmd_file :
|
|
|
587 |
# $(GBE_PLATFORM).mk
|
|
|
588 |
# ...
|
|
|
589 |
###############################################################################
|
|
|
590 |
|
|
|
591 |
sub ToolsetSHLD
|
|
|
592 |
{
|
|
|
593 |
my( $name, $pArgs, $pObjs, $pLibs ) = @_;
|
|
|
594 |
my $module_type = '';
|
|
|
595 |
my $debug_code = $Toolset_DebugCode || 0;
|
|
|
596 |
my $debug_data = $Toolset_DebugData || 0;
|
|
|
597 |
my( $u_rel_file, $rel_file, $head_file, $implib, $stub_only, $bin_image);
|
|
|
598 |
my $pSlibs;
|
|
|
599 |
|
|
|
600 |
|
|
|
601 |
#.. Parse arguments
|
|
|
602 |
#
|
|
|
603 |
foreach $_ ( @$pArgs )
|
|
|
604 |
{
|
|
|
605 |
|
|
|
606 |
#.. Target specific
|
|
|
607 |
#
|
|
|
608 |
|
|
|
609 |
#.. Toolset specific
|
|
|
610 |
#
|
|
|
611 |
if (/^--Data$/) { # Generate a data module
|
|
|
612 |
$module_type = "data";
|
|
|
613 |
|
|
|
614 |
} elsif (/^--Acon$/) { # Generate an ACON module
|
|
|
615 |
$module_type = "acon";
|
|
|
616 |
|
|
|
617 |
} elsif (/^--Rel=(.*)/) { # The base REL file
|
|
|
618 |
$u_rel_file = $1;
|
|
|
619 |
|
|
|
620 |
} elsif (/^--Implib=(.*)/) { # The import library object file
|
|
|
621 |
$implib = $1;
|
|
|
622 |
|
|
|
623 |
} elsif (/^--Stubonly/) { # Only generate the stub library
|
|
|
624 |
$stub_only = 1;
|
|
|
625 |
|
|
|
626 |
} elsif (/^--BinaryImage/) { # Generate binary image instead of a THX file
|
|
|
627 |
$bin_image = 1;
|
|
|
628 |
|
|
|
629 |
} elsif (/^--DebugData=(.*)/) { # Generate a debug module
|
|
|
630 |
$debug_data = $1;
|
|
|
631 |
$module_type = "debug";
|
|
|
632 |
|
|
|
633 |
} elsif (/^--DebugCode=(.*)/) { # Generate a debug module
|
|
|
634 |
$debug_code = $1;
|
|
|
635 |
$module_type = "debug";
|
|
|
636 |
|
|
|
637 |
} else {
|
|
|
638 |
Message( "Prog: unknown option $_ -- ignored" );
|
|
|
639 |
}
|
|
|
640 |
}
|
|
|
641 |
|
|
|
642 |
#
|
| 239 |
dpurdie |
643 |
# Cannot create binaries unless we know where to place them
|
| 227 |
dpurdie |
644 |
# This error could be detected earlier, but by detecting it only when
|
|
|
645 |
# we need the values so that we can add new product groups without
|
|
|
646 |
# knowning all the details.
|
|
|
647 |
#
|
| 239 |
dpurdie |
648 |
unless ( $Toolset_Production_Only )
|
|
|
649 |
{
|
|
|
650 |
Error( "mos_mri: $Toolset_Product: Debug Code and Data not specified" )
|
|
|
651 |
if ( ! $debug_data || ! $debug_code );
|
| 227 |
dpurdie |
652 |
|
| 239 |
dpurdie |
653 |
}
|
| 227 |
dpurdie |
654 |
|
|
|
655 |
#
|
|
|
656 |
# Sanity check
|
|
|
657 |
# - Ensure the use has provided a REL file
|
|
|
658 |
#
|
|
|
659 |
unless ( $u_rel_file )
|
|
|
660 |
{
|
|
|
661 |
$u_rel_file = "$name.rel";
|
|
|
662 |
Warning( "Prog: Rel file not provided. Using $u_rel_file" );
|
|
|
663 |
}
|
|
|
664 |
|
|
|
665 |
#
|
|
|
666 |
# Locate the true path of the provided REL file
|
|
|
667 |
# If it is a generate file so it will be in the SRCS hash
|
|
|
668 |
# Other wise the use will have to use Src to locate the file
|
|
|
669 |
#
|
|
|
670 |
$rel_file = MakeSrcResolve ( $u_rel_file );
|
|
|
671 |
|
|
|
672 |
#
|
|
|
673 |
# Locate the true path of the head.asm file
|
|
|
674 |
# This WILL be located within an external package as it is provided
|
|
|
675 |
# by the MOS hardware package.
|
|
|
676 |
#
|
| 6276 |
dpurdie |
677 |
if ($::ScmCompilerOpts{'BUILD_MOS_OS'})
|
|
|
678 |
{
|
|
|
679 |
# Building the MOS OS
|
|
|
680 |
# The head.asm file will be foound in the local in directory
|
|
|
681 |
$head_file = '$(INCDIR_LOCAL)/head.asm';
|
|
|
682 |
}
|
|
|
683 |
else
|
|
|
684 |
{
|
|
|
685 |
#
|
|
|
686 |
# Non-OS build
|
|
|
687 |
# The head.asm file will be found in an external package
|
|
|
688 |
#
|
|
|
689 |
$head_file = MakeSrcResolveExtended ( 1, "head.asm" );
|
|
|
690 |
}
|
| 227 |
dpurdie |
691 |
|
|
|
692 |
#
|
|
|
693 |
# If we are also creating an import (stub) library then remove
|
|
|
694 |
# the stub library object file from the list of user provided objects
|
|
|
695 |
# Done to allow the use of @OBJS in a library object list
|
|
|
696 |
#
|
|
|
697 |
if ( $implib )
|
|
|
698 |
{
|
|
|
699 |
my @newobjs;
|
|
|
700 |
for ( @$pObjs )
|
|
|
701 |
{
|
|
|
702 |
push @newobjs, $_
|
|
|
703 |
unless ( m~/$implib$~ );
|
|
|
704 |
}
|
|
|
705 |
$pObjs = \@newobjs;
|
|
|
706 |
}
|
|
|
707 |
|
|
|
708 |
#
|
|
|
709 |
# Extend the list of libraries with MOS specific libraries
|
|
|
710 |
# This list may need multiple passes and will be replicated. Do not include
|
|
|
711 |
# the compiler RTL library in this list as it will cause problems. It must be
|
|
|
712 |
# linked last and linked only once.
|
|
|
713 |
#
|
| 6276 |
dpurdie |
714 |
push( @$pLibs, $globName );
|
| 227 |
dpurdie |
715 |
|
|
|
716 |
# Create a list of system (RTL) libraries
|
|
|
717 |
# We only want to use the compiler RTL library as a last resort and will only
|
|
|
718 |
# make one pass over it.
|
|
|
719 |
#
|
|
|
720 |
push( @$pSlibs, '$(mri_linker_lib)' );
|
|
|
721 |
|
|
|
722 |
#
|
|
|
723 |
# Create a ABSRuleGenerator
|
|
|
724 |
# This inherits from a a ToolsetPrinter and extends it to
|
|
|
725 |
# allow addition data to be held
|
|
|
726 |
#
|
|
|
727 |
my ($io) = ABSRuleGenerator::New( $name, $pObjs, $pLibs, $pSlibs );
|
|
|
728 |
|
|
|
729 |
|
|
|
730 |
########################################################################
|
|
|
731 |
#
|
|
|
732 |
# Create a stub library to allow inter-module calls
|
|
|
733 |
#
|
|
|
734 |
if ( $implib )
|
|
|
735 |
{
|
|
|
736 |
$io->Label( "Import(stub) library", $name );
|
|
|
737 |
my $stub_lib = "\$(LIBDIR)/${name}\$(GBE_TYPE).${a}";
|
|
|
738 |
|
|
|
739 |
#
|
|
|
740 |
# Rules and recipe to generate the stub library
|
|
|
741 |
#
|
|
|
742 |
# If the implib was not named in the object list to this SharedLib
|
|
|
743 |
# then it will not be in OBJSOURCE and will not have a rule
|
|
|
744 |
#
|
|
|
745 |
#
|
|
|
746 |
$::OBJSOURCE{"$name/$implib"} = $::OBJSOURCE{"$implib"}
|
|
|
747 |
unless( $::OBJSOURCE{"$name/$implib"} );
|
|
|
748 |
$io->Prt( "$stub_lib:\t\$(OBJDIR)/$name/$implib.$::o\n" );
|
|
|
749 |
$io->Prt( "\t\$(AR)\n" );
|
|
|
750 |
$io->Newline();
|
|
|
751 |
|
|
|
752 |
#
|
|
|
753 |
# Files to be cleanup up
|
|
|
754 |
#
|
|
|
755 |
ToolsetGenerate( $stub_lib );
|
|
|
756 |
|
|
|
757 |
#
|
|
|
758 |
# If the THX is being packaged/installed then add the static
|
|
|
759 |
# stub library to the packaging lists as a static library.
|
|
|
760 |
# This will allow the stub library to be installed with the
|
|
|
761 |
# static libraries and thus allow DLL's with mutual imports
|
|
|
762 |
#
|
|
|
763 |
PackageShlibAddLibFiles ($name, $stub_lib );
|
|
|
764 |
|
|
|
765 |
#
|
|
|
766 |
# Add the stub library to the list of libraries being created
|
|
|
767 |
#
|
|
|
768 |
push @::LIBS, $name;
|
|
|
769 |
|
|
|
770 |
}
|
|
|
771 |
|
|
|
772 |
#
|
|
|
773 |
# If we are only creating a sub library, then out work is done
|
|
|
774 |
#
|
|
|
775 |
if ( $stub_only )
|
|
|
776 |
{
|
|
|
777 |
Error ("Request for stub library without specifying the Import file")
|
|
|
778 |
unless ($implib);
|
|
|
779 |
return;
|
|
|
780 |
}
|
|
|
781 |
|
|
|
782 |
########################################################################
|
|
|
783 |
#
|
|
|
784 |
# Create the module header
|
|
|
785 |
# This is a two step process
|
|
|
786 |
# 1) Create the head.inc file from the modules REL file
|
|
|
787 |
# 2) Compile the head.asm file
|
|
|
788 |
#
|
|
|
789 |
# Note: "head.inc" is a fixed filename. It is created on demand
|
|
|
790 |
# and left around
|
|
|
791 |
#
|
|
|
792 |
|
|
|
793 |
$io->Label( "Module Header", $name );
|
|
|
794 |
$io->Prt( "\$(OBJDIR)/${name}/head.$::o: $head_file $rel_file");
|
|
|
795 |
$io->Prt( "\n\t\$(call AS_HEAD,$rel_file,$head_file,\$(OBJDIR)/${name}/head.$::o,\$(OBJDIR)/${name}/head.inc)\n" );
|
|
|
796 |
$io->Newline();
|
|
|
797 |
|
|
|
798 |
ToolsetObj ( "\$(OBJDIR)/${name}/head" );
|
|
|
799 |
ToolsetGenerate( "\$(OBJDIR)/${name}/head.inc" );
|
|
|
800 |
ToolsetGenerate( "\$(OBJDIR)/head.inc" );
|
|
|
801 |
|
|
|
802 |
#
|
|
|
803 |
# Create rules and recipes to generate two .abs files that are
|
|
|
804 |
# used to generate relocation information
|
|
|
805 |
#
|
|
|
806 |
$io->GenAbsFile( "OBJDIR", "_o", "S[3]", $module_type, "800000H", "100000H" );
|
|
|
807 |
$io->GenAbsFile( "OBJDIR", "_0", "S[3]", $module_type, "400000H", "000000H" );
|
|
|
808 |
|
|
|
809 |
#
|
|
|
810 |
# Create the relocation information from the two .abs files
|
|
|
811 |
# This file will be used to add to other abs files
|
|
|
812 |
#
|
|
|
813 |
|
|
|
814 |
$io->Prt( "\$(OBJDIR)/${name}_rtab_d.asm \$(OBJDIR)/${name}_rtab_cd.asm: BRTROOT=${name}\n" );
|
|
|
815 |
$io->Entry( "\$(OBJDIR)/${name}_rtab_d.asm \$(OBJDIR)/${name}_rtab_cd.asm:\t", "", "\\\n\t\t\$(OBJDIR)/", ".abs ", ( "${name}_o", "${name}_0" ) );
|
|
|
816 |
$io->Prt( "\n\t\$(BRT)\n" );
|
|
|
817 |
$io->Newline();
|
|
|
818 |
|
|
|
819 |
ToolsetGenerate( "\$(OBJDIR)/${name}_rtab_d.asm" );
|
|
|
820 |
ToolsetGenerate( "\$(OBJDIR)/${name}_rtab_cd.asm" );
|
|
|
821 |
|
|
|
822 |
#
|
|
|
823 |
# Rules to allow the two assembler files to be created
|
|
|
824 |
# Override user assembler flags to control the assembler environment
|
|
|
825 |
#
|
|
|
826 |
$io->Prt( "\$(OBJDIR)/${name}_rtab_d.$::o: ASFLAGS=-fNOPCR -frel32\n");
|
|
|
827 |
$io->Prt( "\$(OBJDIR)/${name}_rtab_d.$::o: \$(OBJDIR)/${name}_rtab_d.asm");
|
|
|
828 |
$io->Prt( "\n\t\$(AS)\n" );
|
|
|
829 |
$io->Newline();
|
|
|
830 |
|
|
|
831 |
$io->Prt( "\$(OBJDIR)/head.$::o: ASFLAGS=-fNOPCR -frel32\n");
|
|
|
832 |
$io->Prt( "\$(OBJDIR)/${name}_rtab_cd.$::o: ASFLAGS=-fNOPCR -frel32\n");
|
|
|
833 |
$io->Prt( "\$(OBJDIR)/${name}_rtab_cd.$::o: \$(OBJDIR)/${name}_rtab_cd.asm");
|
|
|
834 |
$io->Prt( "\n\t\$(AS)\n" );
|
|
|
835 |
$io->Newline();
|
|
|
836 |
|
|
|
837 |
ToolsetObj( "\$(OBJDIR)/${name}_rtab_d" );
|
|
|
838 |
ToolsetObj( "\$(OBJDIR)/${name}_rtab_cd" );
|
|
|
839 |
|
|
|
840 |
|
|
|
841 |
#
|
|
|
842 |
# Create rules and recipes to generate the final .abs file which will feed into
|
|
|
843 |
# the required .thx file. this file will now have embedded relocation information
|
|
|
844 |
#
|
|
|
845 |
$io->GenAbsFile( "LIBDIR", "\$(GBE_TYPE)", "S[3]", $module_type, "400000H", "000000H", "\$(OBJDIR)/${name}_rtab_cd" );
|
|
|
846 |
|
|
|
847 |
#
|
|
|
848 |
# Create rules and recipes to generate a debug-able .abs file
|
|
|
849 |
# This is a totally different beast and is then used to
|
|
|
850 |
# create some debugger friendly files
|
|
|
851 |
#
|
|
|
852 |
$io->GenAbsFile( "LIBDIR", "\$(GBE_TYPE)_debug", "IEEE", "debug", $debug_data, $debug_code, "\$(OBJDIR)/${name}_rtab_d" );
|
|
|
853 |
|
|
|
854 |
|
|
|
855 |
########################################################################
|
|
|
856 |
#
|
|
|
857 |
# VisionClick support
|
|
|
858 |
# Physivcal files will not be generated if the tool it not available
|
|
|
859 |
# Either generate the files or provide phony targets
|
|
|
860 |
#
|
|
|
861 |
$io->Label( "VisionClick support", $name );
|
|
|
862 |
$io->Prt( "ifdef VISIONCLICK\n".
|
|
|
863 |
"\$(LIBDIR)/${name}\$(GBE_TYPE)_vpaths.txt ".
|
|
|
864 |
"\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.bdx ".
|
|
|
865 |
"\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abx ".
|
|
|
866 |
"\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.ab: ".
|
|
|
867 |
"\\\n\t\t\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abs".
|
|
|
868 |
"\n\t\t\$(call VCLICK, \$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abs,\\".
|
|
|
869 |
"\n\t\t \$(LIBDIR)/${name}\$(GBE_TYPE)_vpaths.txt,\\".
|
|
|
870 |
"\n\t\t \$(GBE_VCLICKDRV) )".
|
|
|
871 |
"\nelse".
|
|
|
872 |
"\n.PHONY:\t\$(LIBDIR)/${name}\$(GBE_TYPE)_vpaths.txt".
|
|
|
873 |
"\n.PHONY:\t\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.bdx".
|
|
|
874 |
"\n.PHONY:\t\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abx".
|
|
|
875 |
"\n.PHONY:\t\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.ab".
|
|
|
876 |
"\nendif\n\n" );
|
|
|
877 |
|
|
|
878 |
#
|
|
|
879 |
# Vision Click files for cleanup
|
|
|
880 |
#
|
|
|
881 |
ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.bdx" );
|
|
|
882 |
ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.ab" );
|
|
|
883 |
ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abx" );
|
|
|
884 |
ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abg" );
|
|
|
885 |
ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE)_vpaths.txt" );
|
|
|
886 |
|
|
|
887 |
#
|
|
|
888 |
# Add the Visionclick files to the package lists
|
|
|
889 |
# These will only be packaged if VISIONCLICK is defined
|
|
|
890 |
#
|
|
|
891 |
PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.bdx" , 'defined=VISIONCLICK', 'Class=debug' );
|
|
|
892 |
PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.ab" , 'defined=VISIONCLICK', 'Class=debug' );
|
|
|
893 |
PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abx" , 'defined=VISIONCLICK', 'Class=debug' );
|
|
|
894 |
PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE)_vpaths.txt", 'defined=VISIONCLICK', 'Class=debug' );
|
|
|
895 |
|
|
|
896 |
|
|
|
897 |
########################################################################
|
|
|
898 |
#
|
|
|
899 |
# Rules and recipes to create the .THX (.BIN) file
|
|
|
900 |
# This ties together all the previous components
|
|
|
901 |
#
|
|
|
902 |
#
|
|
|
903 |
my $sh_ext = $bin_image ? 'bin' : $::so;
|
|
|
904 |
|
|
|
905 |
$io->Label( "MOS Module", $name );
|
|
|
906 |
$io->Prt( "\$(LIBDIR)/${name}\$(GBE_TYPE).$sh_ext :" .
|
|
|
907 |
"\\\n\t\t\$(OBJDIR)/${name}_o.abs " .
|
|
|
908 |
"\\\n\t\t\$(OBJDIR)/${name}_0.abs " .
|
|
|
909 |
"\\\n\t\t\$(OBJDIR)/${name}_rtab_cd.asm " .
|
|
|
910 |
"\\\n\t\t\$(OBJDIR)/${name}_rtab_d.asm " .
|
|
|
911 |
"\\\n\t\t\$(LIBDIR)/${name}\$(GBE_TYPE).abs " .
|
|
|
912 |
"\\\n\t\t\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abs " .
|
|
|
913 |
"\\\n\t\t\$(LIBDIR)/${name}\$(GBE_TYPE)_vpaths.txt ".
|
|
|
914 |
"\\\n\t\t\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.bdx ".
|
|
|
915 |
"\\\n\t\t\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abx ".
|
|
|
916 |
"\\\n\t\t\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.ab "
|
|
|
917 |
);
|
|
|
918 |
|
|
|
919 |
if ( $bin_image)
|
|
|
920 |
{
|
|
|
921 |
$io->Prt( "\n\t\t\$(MODCRC_BIN)\n");
|
|
|
922 |
}
|
|
|
923 |
else
|
|
|
924 |
{
|
|
|
925 |
$io->Prt( "\n\t\t\$(MODCRC)\n");
|
|
|
926 |
}
|
|
|
927 |
|
|
|
928 |
#
|
|
|
929 |
# Register generated file for cleanup
|
|
|
930 |
# The MODCRC process generates a .bak file. Ensure that it gets removed
|
|
|
931 |
#
|
|
|
932 |
ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE).$sh_ext" );
|
|
|
933 |
ToolsetGenerate( "\$(LIBDIR)/${name}\$(GBE_TYPE).bak" );
|
|
|
934 |
|
|
|
935 |
#
|
|
|
936 |
# Specify the files to be packaged as part of the shared library
|
|
|
937 |
#
|
|
|
938 |
PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE).$sh_ext" );
|
|
|
939 |
PackageShlibAddFiles( $name, "\$(LIBDIR)/${name}\$(GBE_TYPE)_debug.abs", 'Class=debug' );
|
|
|
940 |
}
|
|
|
941 |
|
|
|
942 |
|
|
|
943 |
#-------------------------------------------------------------------------------
|
|
|
944 |
# package : ABSRuleGenerator
|
|
|
945 |
#
|
|
|
946 |
# Description : Package to contain data to generate rules to create
|
|
|
947 |
# ABS files.
|
|
|
948 |
#
|
|
|
949 |
# This is implemented as a class to allow blocks of
|
|
|
950 |
# data to be simply maintained
|
|
|
951 |
#
|
|
|
952 |
# This class ISA ToolsetPrinter too
|
|
|
953 |
#
|
|
|
954 |
# Parameters : name - Basic name of the library
|
|
|
955 |
# pObjs - Ref to an array of object files to be linked
|
| 6276 |
dpurdie |
956 |
# pLibs - Ref to an array of libraries to be linked
|
| 227 |
dpurdie |
957 |
# pSlibs - Ref to an array of system libraries to be linked
|
|
|
958 |
# These libraries will only be linked ONCE
|
|
|
959 |
#
|
|
|
960 |
package ABSRuleGenerator;
|
|
|
961 |
|
|
|
962 |
use vars qw(@ISA);
|
|
|
963 |
@ISA = ("ToolsetPrinter");
|
|
|
964 |
|
|
|
965 |
sub New
|
|
|
966 |
{
|
|
|
967 |
my ($name, $pObjs, $pLibs, $pSlibs) = @_;
|
|
|
968 |
|
|
|
969 |
my $self = ToolsetPrinter::New();
|
|
|
970 |
|
|
|
971 |
$self->{name} = $name;
|
|
|
972 |
$self->{pObjs} = $pObjs;
|
|
|
973 |
$self->{pLibs} = $pLibs;
|
|
|
974 |
$self->{sLibs} = $pSlibs;
|
|
|
975 |
|
|
|
976 |
return bless $self, __PACKAGE__;
|
|
|
977 |
}
|
|
|
978 |
|
|
|
979 |
#-------------------------------------------------------------------------------
|
|
|
980 |
# Function : GenAbsFile
|
|
|
981 |
#
|
|
|
982 |
# Description : Internal helper function to generate an ABS file
|
|
|
983 |
# with desirable characteristics
|
|
|
984 |
#
|
|
|
985 |
# Note: This function is not within the ToolsetSHLD to
|
|
|
986 |
# make closure problems obvious
|
|
|
987 |
#
|
|
|
988 |
# Inputs : $1 - Name of the output directory (LIBDIR or OBJDIR)
|
|
|
989 |
# $2 - basename of the output file
|
|
|
990 |
# $3 - basename sufix
|
|
|
991 |
# $4 - Type of output IEEE /S[3]
|
|
|
992 |
# $5 - Kind of module - "acon", "data", "debug" or ""
|
|
|
993 |
# $6 - Base of the data segment
|
|
|
994 |
# $7 - Base of the code segment
|
|
|
995 |
# $8 - Extra (internal) object file to be linked in
|
|
|
996 |
#
|
|
|
997 |
# Returns :
|
|
|
998 |
#
|
|
|
999 |
sub GenAbsFile
|
|
|
1000 |
{
|
|
|
1001 |
my ( $io, $dir, $suf, $otype, $kind, $data_base, $code_base, $eObjs ) = @_;
|
|
|
1002 |
my $name = $io->{'name'};
|
|
|
1003 |
my $pLibs = $io->{'pLibs'};
|
|
|
1004 |
my $pSlibs = $io->{'sLibs'};
|
| 335 |
dpurdie |
1005 |
my $lib = $name . $suf;
|
| 227 |
dpurdie |
1006 |
|
|
|
1007 |
#
|
|
|
1008 |
# Generate a full list of object files
|
|
|
1009 |
#
|
|
|
1010 |
my @allObjs = @{$io->{'pObjs'}};
|
|
|
1011 |
push @allObjs, $eObjs
|
|
|
1012 |
if ( $eObjs);
|
|
|
1013 |
|
|
|
1014 |
#
|
|
|
1015 |
#.. Linker command file
|
|
|
1016 |
#
|
|
|
1017 |
# Piecing together a variable $(name_ld) which ends up in the command file.
|
|
|
1018 |
# This bit of magic will be performed by the LDABS recipe
|
|
|
1019 |
#
|
| 335 |
dpurdie |
1020 |
$io->Reset(); # Reset internal state
|
|
|
1021 |
$io->SetTag( "${lib}_shld" ); # macro tag
|
|
|
1022 |
$io->Label( "Linker commands", $lib ); # label
|
| 227 |
dpurdie |
1023 |
|
|
|
1024 |
$io->Cmd("FORMAT $otype" );
|
|
|
1025 |
$io->Cmd("CHIP \$(mri_cpu_type)" );
|
|
|
1026 |
$io->Cmd("LISTMAP CROSSREF,INTERNALS,PUBLICS" );
|
|
|
1027 |
|
|
|
1028 |
$io->Cmd("DEBUG_SYMBOLS" ) if ( $kind eq "debug" );
|
|
|
1029 |
|
|
|
1030 |
unless ( $kind eq "acon" || $kind eq "data" )
|
|
|
1031 |
{
|
|
|
1032 |
$io->Cmd("MERGE vars StartPixInit,pixinit,EndPixInit" );
|
|
|
1033 |
$io->Cmd("MERGE vars StartInitFini,initfini,EndInitFini" );
|
|
|
1034 |
$io->Cmd("MERGE vars cxx_rtti,cxx_edt" );
|
|
|
1035 |
$io->Cmd("INITDATA vars" );
|
|
|
1036 |
$io->Cmd("INDEX ?A5,zerovars" );
|
|
|
1037 |
$io->Cmd("EXTERN __mosSoftTrap" );
|
|
|
1038 |
}
|
|
|
1039 |
|
|
|
1040 |
if ( $kind eq "data" )
|
|
|
1041 |
{
|
|
|
1042 |
$io->Cmd("SECT header = 0H" );
|
|
|
1043 |
$io->Cmd("ORDER header,ascode,code,const" );
|
|
|
1044 |
$io->Cmd("ORDER modtitle,lastsync" );
|
|
|
1045 |
}
|
|
|
1046 |
elsif ( $kind eq "acon" )
|
|
|
1047 |
{
|
|
|
1048 |
$io->Cmd("SECT header = 0H" );
|
|
|
1049 |
$io->Cmd("ORDER header,const,code,ascode" );
|
|
|
1050 |
$io->Cmd("ORDER modtitle,lastsync" );
|
|
|
1051 |
}
|
|
|
1052 |
else
|
|
|
1053 |
{
|
|
|
1054 |
$io->Cmd("SECT zerovars = $data_base" );
|
|
|
1055 |
$io->Cmd("SECT header = $code_base" );
|
|
|
1056 |
|
|
|
1057 |
$io->Cmd("ORDER zerovars,vars,uninivars" ) if ( $kind eq "debug" );
|
|
|
1058 |
$io->Cmd("ORDER header,ascode,code" );
|
|
|
1059 |
$io->Cmd("ORDER literals,strings,const" );
|
|
|
1060 |
$io->Cmd("ORDER ??INITDATA,modtitle,rellist,lastsync" );
|
|
|
1061 |
$io->Cmd("ORDER zerovars,vars,uninivars" ) unless ( $kind eq "debug" );
|
|
|
1062 |
$io->Cmd("ORDER stack" ) if ( $kind eq "debug" );
|
|
|
1063 |
}
|
|
|
1064 |
$io->Cmd("ALIGN lastsync,4" );
|
|
|
1065 |
$io->Newline();
|
|
|
1066 |
|
|
|
1067 |
#
|
|
|
1068 |
# Must load GLOB.LIB first so that "well-known" variables
|
|
|
1069 |
# in zerovars are at a known location
|
|
|
1070 |
#
|
|
|
1071 |
$io->Prt("# Load the Global Library first\n");
|
|
|
1072 |
$io->Newline();
|
| 6276 |
dpurdie |
1073 |
$io->LibList( $name, [$globName], \&ToolsetLibRecipe );
|
| 227 |
dpurdie |
1074 |
$io->Newline();
|
|
|
1075 |
|
|
|
1076 |
$io->Prt("# Load the module header and target specfic library\n");
|
|
|
1077 |
$io->Prt("#\n");
|
|
|
1078 |
$io->Cmd("LOAD \$(OBJDIR)/${name}/head.$::o" );
|
|
|
1079 |
$io->Newline();
|
|
|
1080 |
|
|
|
1081 |
$io->Prt("# List all the object files to be loaded\n");
|
|
|
1082 |
$io->Prt("#\n");
|
|
|
1083 |
|
|
|
1084 |
$io->ObjList( $name, \@allObjs, \&ToolsetObjRecipe );
|
|
|
1085 |
$io->Newline();
|
|
|
1086 |
|
| 6276 |
dpurdie |
1087 |
$io->Prt("# Load the library files three times to overcome single pass linker problems\n");
|
| 227 |
dpurdie |
1088 |
$io->Prt("#\n");
|
|
|
1089 |
|
|
|
1090 |
$io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
|
|
|
1091 |
$io->Newline();
|
|
|
1092 |
$io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
|
|
|
1093 |
$io->Newline();
|
|
|
1094 |
$io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
|
|
|
1095 |
$io->Newline();
|
|
|
1096 |
|
|
|
1097 |
$io->LibList( $name, $pSlibs, \&ToolsetLibRecipe );
|
|
|
1098 |
$io->Newline();
|
|
|
1099 |
|
|
|
1100 |
$io->Prt("#.. Map file options\n");
|
|
|
1101 |
$io->Cmd("LISTMAP LENGTH 64");
|
|
|
1102 |
$io->Cmd("LISTMAP CROSSREF,INTERNALS,PUBLICS/by_addr");
|
|
|
1103 |
$io->Cmd("END");
|
|
|
1104 |
$io->Newline();
|
|
|
1105 |
|
| 335 |
dpurdie |
1106 |
#
|
|
|
1107 |
# Create the shared library dependency information
|
|
|
1108 |
#
|
|
|
1109 |
my $dep = $io->SetShldTarget( $lib, $dir );
|
| 227 |
dpurdie |
1110 |
|
|
|
1111 |
#
|
|
|
1112 |
# Create the rules and recipes to create the required file
|
|
|
1113 |
#
|
| 335 |
dpurdie |
1114 |
$io->Prt( "\$($dir)/$lib.abs:\tSHBASE=${name}${suf}\n" );
|
|
|
1115 |
$io->Prt( "\$($dir)/$lib.abs:\tSHNAME=${name}${suf}\n" );
|
|
|
1116 |
$io->Prt( "\$($dir)/$lib.abs:\t\$(SCM_MAKEFILE)" );
|
|
|
1117 |
$io->Prt( "\\\n\t\t$dep " );
|
| 323 |
dpurdie |
1118 |
$io->Entry( "", "", "\\\n\t\t", ".$::o ", @allObjs );
|
| 227 |
dpurdie |
1119 |
$io->Prt( "\\\n\t\t\$(OBJDIR)/${name}/head.$::o " );
|
|
|
1120 |
$io->Prt( "\n\t\$(SHLDABS)\n" );
|
|
|
1121 |
$io->Newline();
|
|
|
1122 |
|
|
|
1123 |
|
|
|
1124 |
#.. Dependency link,
|
| 335 |
dpurdie |
1125 |
# Create a library dependency file
|
|
|
1126 |
# Create command file to build applicaton dependency list
|
|
|
1127 |
# from the list of dependent libraries
|
| 227 |
dpurdie |
1128 |
#
|
| 335 |
dpurdie |
1129 |
# Create makefile directives to include the dependency
|
|
|
1130 |
# list into the makefile.
|
| 227 |
dpurdie |
1131 |
#
|
| 335 |
dpurdie |
1132 |
$io->DepRules( $pLibs, \&ToolsetLibRecipe, "\$($dir)/$lib.abs" );
|
|
|
1133 |
$io->DepRules( $pSlibs,\&ToolsetLibRecipe, "\$($dir)/$lib.abs" );
|
|
|
1134 |
$io->SHLDDEPEND( $lib, $lib );
|
| 227 |
dpurdie |
1135 |
|
|
|
1136 |
#.. Cleanup rules
|
|
|
1137 |
#
|
| 335 |
dpurdie |
1138 |
::ToolsetGenerate( "\$($dir)/$lib.ld" );
|
|
|
1139 |
::ToolsetGenerate( "\$($dir)/$lib.abs" );
|
|
|
1140 |
::ToolsetGenerate( "\$($dir)/$lib.map" );
|
| 227 |
dpurdie |
1141 |
|
|
|
1142 |
}
|
|
|
1143 |
|
|
|
1144 |
########################################################################
|
|
|
1145 |
#
|
|
|
1146 |
# Generate a linker object recipe. This is a helper function used
|
|
|
1147 |
# within this toolset.
|
|
|
1148 |
#
|
|
|
1149 |
# Arguments:
|
|
|
1150 |
# $io I/O stream
|
|
|
1151 |
#
|
|
|
1152 |
# $target Name of the target
|
|
|
1153 |
#
|
|
|
1154 |
# $obj Library specification
|
|
|
1155 |
#
|
|
|
1156 |
########################################################################
|
|
|
1157 |
|
|
|
1158 |
sub ToolsetObjRecipe
|
|
|
1159 |
{
|
|
|
1160 |
my ($io, $target, $obj) = @_;
|
|
|
1161 |
|
|
|
1162 |
$io->Cmd("LOAD $obj.$::o");
|
|
|
1163 |
}
|
|
|
1164 |
|
|
|
1165 |
########################################################################
|
|
|
1166 |
#
|
|
|
1167 |
# Generate a linker/depend library recipe. This is a helper function
|
|
|
1168 |
# used within this toolset.
|
|
|
1169 |
#
|
|
|
1170 |
# Arguments:
|
|
|
1171 |
# $io I/O stream
|
|
|
1172 |
#
|
|
|
1173 |
# $target Name of the target
|
|
|
1174 |
#
|
|
|
1175 |
# $lib Library specification
|
|
|
1176 |
#
|
|
|
1177 |
# $dp If building a depend list, the full target name.
|
|
|
1178 |
#
|
|
|
1179 |
########################################################################
|
|
|
1180 |
|
|
|
1181 |
sub ToolsetLibRecipe
|
|
|
1182 |
{
|
|
|
1183 |
my ($io, $target, $lib, $dp) = @_;
|
|
|
1184 |
|
|
|
1185 |
if ( !defined($dp) ) { # linker
|
|
|
1186 |
$io->Cmd("LOAD @(vpath2,$lib.$::a,MRI_LIB)" );
|
|
|
1187 |
|
|
|
1188 |
} else { # depend
|
|
|
1189 |
$io->Cmd( "$dp:\t@(vlib2,$lib.$::a,MRI_LIB)" );
|
|
|
1190 |
}
|
|
|
1191 |
}
|
|
|
1192 |
|
|
|
1193 |
package main;
|
|
|
1194 |
|
|
|
1195 |
###############################################################################
|
|
|
1196 |
# ToolsetSHLDLINT $name, \@args, \@objs, \@libraries )
|
|
|
1197 |
# This subroutine takes the user options and builds the rules
|
|
|
1198 |
# required to lint the program 'name'.
|
|
|
1199 |
#
|
|
|
1200 |
# Arguments:
|
|
|
1201 |
# (none)
|
|
|
1202 |
#
|
|
|
1203 |
# Output:
|
|
|
1204 |
# [ $(LIBDIR)/$name_lint: .... ]
|
|
|
1205 |
# $(SHLIBLINT)
|
|
|
1206 |
#
|
|
|
1207 |
###############################################################################
|
|
|
1208 |
|
|
|
1209 |
sub ToolsetSHLDLINT
|
|
|
1210 |
{
|
|
|
1211 |
PCLintSHLIB( @_ );
|
|
|
1212 |
}
|
|
|
1213 |
|
|
|
1214 |
|
|
|
1215 |
#.. Successful termination
|
|
|
1216 |
1;
|
|
|
1217 |
|