1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML LANG="en-US">
3
4<HEAD>
5    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
6    <META http-equiv="Content-Style-Type" content="text/css">
7
8    <TITLE>Build System Development Guide (for DLLs)</TITLE>
9
10    <STYLE>
11        h1.left
12        {
13            color: #46f;
14            font-size: 120%;
15        }
16        ul.left, ul.left ul
17        {
18            margin: 0;
19            padding: 0;
20        }
21        ul.left
22        {
23            font-size: 0.8em;
24        }
25        ul.left li
26        {
27            margin: 0;
28            padding: 0;
29            margin-left: 1em;
30            line-height: 1.5em;
31        }
32        ul.left li a
33        {
34            margin: 0;
35            padding: 0;
36        }
37
38        H1
39        {
40            font-weight         : bold;
41            font-size           : 250%;
42            text-align          : left;
43            color               : #46f;
44            margin-bottom       : 0px;
45        }
46
47        H2
48        {
49            font-weight         : normal;
50            font-size           : 180%;
51            margin              : 24pt 0pt 6pt 0pt;
52            border-bottom-style : solid;
53            border-bottom-width : 1px;
54        }
55
56        H3
57        {
58            font-weight         : bold;
59            font-size           : 120%;
60            border-bottom-style : solid;
61            border-bottom-width : 1px;
62            width: 75%;
63            margin              : 18pt 0pt 6pt 30pt;
64        }
65
66        H4
67        {
68            font-weight         : bold;
69            font-size           : 100%;
70            margin              : 12pt 0pt 6pt 30pt;
71        }
72
73        H5
74        {
75            font-weight         : bold;
76            margin              : 12pt 0pt 6pt 30pt;
77        }
78
79        H6
80        {
81            font-weight         : bold;
82            margin              : 12pt 0pt 6pt 30pt;
83        }
84
85        DIV.date
86        {
87            text-align          : right;
88            color               : #46f;
89            margin-bottom       : 30pt;
90            line-height         : 150%;
91        }
92
93        P
94        {
95            margin              : 0pt 0pt 12pt 30pt;
96            line-height         : 150%;
97        }
98
99        OL,UL,DL
100        {
101            margin              : 6pt 0pt 6pt 50pt;
102        }
103        OL OL, UL UL
104        {
105            margin-left: 3em;
106        }
107
108        DT
109        {
110            font-family         : "Courier New", monospace;
111            margin-top : 0.3em;
112            margin-bottom : 0.3em;
113        }
114        DD
115        {
116            margin-top : 0.3em;
117            margin-bottom : 0.6em;
118        }
119
120        PRE
121        {
122            font-family         : "Courier New", monospace;
123            font-weight         : normal;
124
125            margin              : 0pt 0pt 20pt 50pt;
126            padding             : 2pt 8pt 2pt 8pt;
127            background-color    : #eee;
128
129            border-style        : solid;
130            border-width        : 1px;
131        }
132        em
133        {
134            font-style: normal;
135            color: red;
136        }
137        TABLE
138        {
139            margin-left         : 40pt;
140            margin-bottom       : 20pt;
141            border-color        : #aaa;
142            border-width        : 1pt;
143            border-style        : solid;
144        }
145        TD
146        {
147            font-style          : normal;
148            padding             : 2pt 4pt 2pt 4pt;
149
150            border-color        : #aaa;
151            border-width        : 1pt;
152            border-style        : solid;
153        }
154        div.footer
155        {
156            border-color: black;
157            padding-top: 0.5em;
158            border-top-style    : solid;
159            border-top-width    : 1px;
160            width:              100%;
161            margin-top: 2em;;
162        }
163        div.footer span
164        {
165            color               : #46f;
166            float: right;
167        }
168        table
169        {
170            border-collapse:    collapse;
171        }
172        table td
173        {
174        }
175        table th
176        {
177        }
178        ul
179        {
180            margin-top: 1em;
181            margin-bottom: 1em;
182        }
183        DL.history
184        {
185            margin: 1em;
186        }
187        DL.history DT
188        {
189            font-family         : sans-serif;
190            font-weight         : bold;
191            font-size           : 0.8em;
192            margin              : 0px;
193        }
194        DL.history DD
195        {
196            font-size           : 0.9em;
197            margin              : 0px 0px 4px 0px;
198        }
199    </STYLE>
200    <SCRIPT type="text/javascript">
201    <!--
202        function DeleteRule(index)
203        {
204            var ss = document.styleSheets.item(0);
205
206            if( ss.removeRule )
207            {
208                ss.removeRule(index);
209            }
210            else
211            {
212                ss.deleteRule(index);
213            }
214        }
215        function OnClickAnchor(e, anchor)
216        {
217            window.parent.frames[1].location.hash = anchor;
218
219            if( e.preventDefault )
220            {
221                e.preventDefault();
222            }
223            else
224            {
225                e.returnValue = false;
226            }
227        }
228        function TravLeft(obj)
229        {
230            var ary = new Array();
231            var index = 0;
232
233            for( var i = 0; i < obj.childNodes.length; ++i )
234            {
235                var c = obj.childNodes.item(i);
236
237                if( c.nodeType == 1 )
238                {
239                    if( c.tagName == "H2" || c.tagName == "H3" )
240                    {
241                        var a = c.childNodes.item(0);
242                        var text  = "";
243
244                        var anchor = "name-" + index;
245                        index++;
246
247                        if( a && a.tagName == "A" )
248                        {
249                            text  = a.innerHTML;
250                        }
251                        else
252                        {
253                            text  = c.innerHTML;
254                        }
255
256                        ary.push([c.tagName.substr(1,1), "<a target=\"right\" href=\"?right#" + anchor + "\" onclick=\"OnClickAnchor(event, '" + anchor + "')\">" + text + "</a>"]);
257                    }
258                    else
259                    {
260                        ary = ary.concat(TravLeft(c));
261                    }
262                }
263            }
264
265            return ary;
266        }
267        function TravRight(obj)
268        {
269            var index = 0;
270
271            for( var i = 0; i < obj.childNodes.length; ++i )
272            {
273                var c = obj.childNodes.item(i);
274
275                if( c.nodeType == 1 )
276                {
277                    if( c.tagName == "H2" || c.tagName == "H3" )
278                    {
279                        var anchor = "name-" + index;
280                        index++;
281
282                        c.innerHTML = "<a name=\"" + anchor + "\">" + c.innerHTML + "</a>"
283                    }
284                    else
285                    {
286                        TravRight(c);
287                    }
288                }
289            }
290        }
291        function OnLoad_Left()
292        {
293            var test = TravLeft(document.body);
294            var test2 = "";
295            var level = 2;
296
297            test2 += "<h1 class='left'>" + document.title + "</h1>";
298            test2 += "<ul class='left'>";
299            for( var i in test )
300            {
301                while( test[i][0] > level )
302                {
303                    level++;
304                    test2 += "<ul>";
305                }
306                while( test[i][0] < level )
307                {
308                    level--;
309                    test2 += "</ul>";
310                }
311
312                test2 += "<li>" + test[i][1];
313            }
314            test2 += "</ul>";
315
316            document.body.innerHTML = test2;
317            DeleteRule(0);
318        }
319        function OnLoad_Right()
320        {
321            TravRight(document.body);
322        }
323        function OnLoad_Frame()
324        {
325            var myname = location.pathname.substr(location.pathname.lastIndexOf("/") + 1);
326
327            var f = document.createElement("frameset");
328            var l = document.createElement("frame");
329            var r = document.createElement("frame");
330
331            f.appendChild(l);
332            f.appendChild(r);
333            f.cols = "250,*";
334
335            l.src  = myname + "?left"  + location.hash;
336            r.src  = myname + "?right" + location.hash;
337            l.name = "left";
338            r.name = "right";
339
340            var h = document.documentElement;
341            var b = h.getElementsByTagName("body").item(0);
342
343            h.replaceChild(f, b);
344        }
345
346
347        if( ! window.opera )
348        {
349            var search = location.search;
350
351            if( search == "?left" )
352            {
353                window.onload = OnLoad_Left;
354            }
355            else if( search == "" )
356            {
357                window.onload = OnLoad_Frame;
358            }
359            else if( search == "?right" )
360            {
361                window.onload = OnLoad_Right;
362            }
363
364            if( search != "?right" )
365            {
366                var ss = document.styleSheets.item(0);
367
368                if( ss.addRule )
369                {
370                    ss.addRule("body", "display: none", 0);
371                }
372                else
373                {
374                    ss.insertRule("body {display: none}", 0);
375                }
376            }
377        }
378    //-->
379    </SCRIPT>
380</HEAD>
381
382<BODY>
383
384
385
386
387
388<H1>Build System Development Guide (for DLLs)</H1>
389<DIV class="date">(2012/06/22)</DIV>
390
391
392
393
394
395<H2>Introduction</H2>
396
397<H3>About This Document</H3>
398<P>
399    This document explains how to create a build system that replaces the one provided in the SDK. It provides information necessary for building CRO files and for the CTR applications that use them.
400</P>
401<ul>
402    <li>CRO build sequence
403    <li>Sequence for building applications that use CRO files
404    <li>Procedures for creating each file
405</ul>
406
407<P>This document provides the minimum information necessary to create a build system equivalent to the one provided in the SDK.</P>
408
409<P>For more information about creating a more flexible and sophisticated build system, see the <I><a href="BuildSystemDevelopmentGuideForDllAdvanced.html" target="_parent">Build System Development Guide (for High-Level DLLs)</a></I>.</P>
410
411<P>For information about the structure and usage of the build system provided by the SDK, see the <I><a href="BuildSystemManualForDll.html" target="_parent">CTR-SDK Build System Manual (for DLLs)</a></I>.</P>
412
413<P>This document assumes basic knowledge of CTR-SDK terms. See the <I><a href="../Glossary/Glossary.html">CTR-SDK Glossary</a></I> for a glossary of basic CTR-SDK terms.</P>
414
415
416<H3>Notation Used in This Document</H3>
417<P>
418Content in shaded boxes, as shown below, indicate a sequence to be entered on the command line.
419</P>
420<pre>
421command option1 option2
422</pre>
423
424<P>
425    Do not enter text enclosed in angle brackets (&quot;<CODE>&lt;</CODE>&quot; and &quot;<CODE>&gt;</CODE>&quot;) verbatim as part of the command syntax. Instead, substitute an appropriate entry for the placeholder description. For example, the string <code>&lt;CTRSDK_ROOT&gt;</code> indicates that you must enter the CTR-SDK installation path.
426</P>
427<P>
428    Text enclosed by square brackets (&quot;<CODE>[</CODE>&quot; and <CODE>]</CODE>) is optional. In the following example, the <CODE>-a</CODE> parameter is optional and can be omitted.
429</P>
430<pre>
431command [-a]
432</pre>
433<P>
434    Elements in the command sequence joined by the pipe symbol (&quot;<CODE>|</CODE>&quot;) indicate available choices for a given parameter. In the following example, you can choose either the <CODE>-a</CODE> or <CODE>-b</CODE> option.
435</P>
436<pre>
437command -a|-b
438</pre>
439<P>
440    Strings in the command sequence surrounded by parentheses (<CODE>()</CODE>) and followed by an ellipsis (<CODE>...</CODE>) indicate elements that can be repeated an arbitrary number of times. In the following example, the sequence of <CODE>-a</CODE> followed by a path can be repeated.
441</P>
442<pre>
443command (-a &lt;PATH&gt;)...
444</pre>
445<P>
446    In this document, the names of Windows tools contained in the <CODE>tools/CommandLineTools</CODE> directory are abbreviated by omitting the leading <CODE>ctr_</CODE> and the ending numeric value and file extension. For example, the abbreviation for <CODE>ctr_makerom32.exe</CODE> is <CODE>makerom</CODE>.
447</P>
448
449
450<H2>Build Sequence</H2>
451
452<H3>Overall Sequence</H3>
453<p>
454    The following figure shows the build sequence when you do not use CRO. For example, if you were to create your application's AXF file from four source files and one static library. <br> <br> <a href="img/dll_flow_normal.png"><img src="img/dll_flow_normal.png" width="277" height="148"></a> <br><br> The following figure shows the changes when <CODE>module1.c</CODE> and <CODE>module2.cpp</CODE> are used to make CRO files. <br> <br> <a href="img/dll_flow_use_cro.png"><img src="img/dll_flow_use_cro.png" width="469" height="829"></a> <br> <br> Thus, 14 additional build steps are necessary to make an existing build system compatible with CRO.
455</p>
456<p>
457    The commands to execute at each of these build steps are described in the following sections.
458</p>
459
460
461
462<H3>Partial Linking</H3>
463<p>
464    The build system uses <CODE>armlink</CODE> to partially link the project and get the symbols that the various modules reference and export. <br> <br> <img src="img/dll_flow_partial.png"> <br> <br>Although you essentially use the same command as when creating an application AXF without using CRO, you must add the following options.
465</p>
466<pre>
467--no_scanlib
468--partial
469--vfemode=off
470</pre>
471<p>
472    If you are targeting a static module, do not designate static libraries as input files.
473</p>
474
475
476
477<H3>Create a List of Symbols</H3>
478<p>
479    Create a list of symbols from the PLF files, and create the first XRL file. Use <CODE>makecro</CODE> to create the list of symbols. <br> <br> <img src="img/dll_flow_listup.png"> <br> <br> Use <CODE>makecro</CODE> to create a list of symbols as follows.
480</p>
481<pre>
482makecro -l [-a] [-i|-e] -o &lt;INPUT_FILE&gt; &lt;PLF_FILE&gt;
483</pre>
484<p>
485    <CODE>OUTPUT_FILE</CODE> is an XRL file containing a list of the symbols referenced or defined by <CODE>PLF_FILE</CODE>. Specify the <CODE>-a</CODE> option if you are targeting a static module. Specify <CODE>-i</CODE> for a symbol export type of <CODE>index</CODE>, and specify <CODE>-e</CODE> for a symbol export type of <CODE>offset</CODE>. If you do not specify anything, the symbol export type is <CODE>name</CODE>.
486</p>
487
488
489
490<H3>Merge Undefined Symbols</H3>
491<p>
492    This updates the XRL file for the static module and specifies that symbols not defined in any module are defined in the static module. It links standard C functions and SDK functions required by the dynamic modules into the static module. Use <CODE>makecro</CODE> to merge undefined symbols. <br> <br> <img src="img/dll_flow_merge.png"> <br> <br>Use <CODE>makecro</CODE> to resolve symbol references as follows. (Although the following command is separated into multiple lines for readability, an actual command cannot contain newline characters.)
493</p>
494<pre>
495makecro
496    -c
497    [-i|-e]
498    -o &lt;OUTPUT_FILE&gt;
499    &lt;STATIC_MODULE_XRL_FILE&gt;
500    (-r &lt;DYNAMIC_MODULE_XRL_FILE&gt;)...
501</pre>
502<p>
503    <CODE>OUTPUT_FILE</CODE> is an XRL file created by adding the symbols referenced by <CODE>DYNAMIC_MODULE_XRL_FILE</CODE>, but not defined by any module to <CODE>STATIC_MODULE_XRL_FILE</CODE>. Specify <CODE>-i</CODE> for an export type of <CODE>index</CODE> for the added symbols and specify <CODE>-e</CODE> for an export type of <CODE>offset</CODE>. If you do not specify anything, the export type of the added symbols is <CODE>name</CODE>.
504</p>
505
506
507
508<H3>Resolve Symbol References</H3>
509<p>
510    For each symbol referenced by a module, find the module that defines it, and add this information to the XRL file. Use <CODE>makecro</CODE> to resolve the symbol references. <br> <br> <img src="img/dll_flow_resolve.png"> <br> <br>Use <CODE>makecro</CODE> to resolve symbol references as follows.
511</p>
512<pre>
513makecro -f -o &lt;OUTPUT_FILE&gt; &lt;XRL_FILE&gt; (-r &lt;REFERENCE_XRL_FILE&gt;)...
514</pre>
515<p>
516    <CODE>OUTPUT_FILE</CODE> is the original XRL file (<CODE>XRL_FILE</CODE>) updated with the contents of <CODE>REFERENCE_XRL_FILE</CODE>.
517</p>
518<p>
519    You must execute this command on the XRL files for each module, using that module's file as <CODE>XRL_FILE</CODE> and those of the other modules as <CODE>REFERENCE_XRL_FILE</CODE>. Assuming that your project comprises static module <CODE>App</CODE> and dynamic modules <CODE>Module1</CODE> and <CODE>Module2</CODE>, you would need to execute the following equivalent command on all three modules.
520</p>
521<pre>
522makecro -f -o App.f.xrl     App.xrl     -r Module1.xrl -r Module2.xrl
523makecro -f -o Module1.f.xrl Module1.xrl -r App.xrl     -r Module2.xrl
524makecro -f -o Module2.f.xrl Module2.xrl -r App.xrl     -r Module1.xrl
525</pre>
526
527
528
529<H3>Create Command File</H3>
530<p>
531    In the &quot;Merge Undefined Symbols&quot; step, you merged undefined symbols into the XRL file of the static module. Now, create a command-line options file to load these undefined symbols from the static library and export them. Use <CODE>makecro</CODE> to create the command file. <br> <br> <img src="img/dll_flow_uae.png"> <br> Use <CODE>makecro</CODE> as follows to create the command file.
532</p>
533<pre>
534makecro -x -o &lt;OUTPUT_FILE&gt; &lt;XRL_FILE&gt;
535</pre>
536<p>
537    <CODE>OUTPUT_FILE</CODE> is a command file generated based on <CODE>XRL_FILE</CODE>.
538</p>
539
540
541
542<H3>Create Steering Files</H3>
543<p>
544    Create a steering file to give the linker import and export instructions. Use <CODE>makecro</CODE> to create the steering file. <br> <br> <img src="img/dll_flow_edit.png"> <br> Use <CODE>makecro</CODE> as follows to create the steering file.
545</p>
546<pre>
547makecro -s -o &lt;OUTPUT_FILE&gt; &lt;XRL_FILE&gt;
548</pre>
549<p>
550    <CODE>OUTPUT_FILE</CODE> is a steering file generated based on <CODE>XRL_FILE</CODE>.
551</p>
552
553
554
555<H3>Link Static Module</H3>
556<p>
557    Use <CODE>armlink</CODE> to link the static module, adding the specifications of the command file and steering file to the command-line options. <br> <br> <img src="img/dll_flow_link_static.png"> <br> <br>Although you essentially use the same command as when creating an application AXF without using CRO, you must add the following options.
558</p>
559<pre>
560--base_platform
561--edit=&lt;STEERING_FILE&gt;
562--override_visi.
563--pltgot=direct
564--undefined_and_export=nnroAeabiAtexit_
565--vfemode=off
566--via &lt;COMMAND_FILE&gt;
567</pre>
568<p>
569    <CODE>STEERING_FILE</CODE> is the steering file you created in <b>Create Steering Files</b>, and <CODE>COMMAND_FILE</CODE> is the <CODE>use</CODE> file that you created in <b>Create Command File</b>.
570</p>
571
572
573
574<H3>Link Dynamic Modules</H3>
575<p>
576    Use <CODE>armlink</CODE> to link the dynamic modules, adding the specifications of the steering file to the command-line options. <br> <br> <img src="img/dll_flow_link_dynamic.png"> <br> <br>Although you essentially use the same command as when creating an application AXF without using CRO, you must add the following options.
577</p>
578<pre>
579--base_platform
580--dll
581--edit=&lt;STEERING_FILE&gt;
582--no_cppinit
583--no_scanlib
584--override_visi.
585--pltgot=direct
586--scatter=&lt;CTRSDK_ROOT&gt;/resources/specfiles/linker/CTR.Ro.MPCore.ldscript
587--undefined_and_export=nnroControlObject_
588--emit_non_debug_relocs
589</pre>
590<p>
591    Set <CODE>STEERING_FILE</CODE> to the steering file you created in <b>Create Steering Files</b>. Set the <CODE>--scatter</CODE> option to <CODE>CTR.Ro.MPCore.ldscript</CODE> rather than <CODE>CTR.Process.MPCore.ldscript</CODE>.
592</p>
593<p>
594    Do not specify the following option.
595</p>
596<pre>
597--keep=nnMain
598</pre>
599<p>
600    You also do not need to specify <CODE>crt0.o</CODE> as an input file.
601</p>
602<p>
603    You must also specify the following option if you use C++ exceptions.
604</p>
605<pre>
606--undefined=nnroEitNode_
607</pre>
608
609
610
611<H3>Create Command File 2</H3>
612<p>
613    Create a command-line option file to implement the changes for symbols for which there were changes to the references in <b>Resolve Symbolic References</b>. Use <CODE>makecro</CODE> to create command file 2. <br> <br> <img src="img/dll_flow_fil.png"> <br> Use <CODE>makecro</CODE> as follows to create command file 2.
614</p>
615<pre>
616makecro -w -o &lt;OUTPUT_FILE&gt; &lt;XRL_FILE&gt;
617</pre>
618<p>
619    Command file 2 is created based on <CODE>XRL_FILE</CODE> and generated as <CODE>OUTPUT_FILE</CODE>.
620</p>
621
622
623
624<H3>Forced References</H3>
625<p>
626    Implement changes to references for symbols for which there were changes to the references in <b>Resolve Symbolic References</b>. Use <CODE>fromelf</CODE>, which is included in ARMCC, to force the references. <br> <br> <img src="img/dll_flow_import.png"> <br> <br>Use <CODE>fromelf</CODE> to force the references, as follows.
627</p>
628<pre>
629fromelf &lt;AXF_FILE&gt; --elf -o &lt;OUTPUT_FILE&gt; --via &lt;COMMAND_FILE_2&gt;
630</pre>
631<p>
632    An AXF file for which the changes to the references in <CODE>AXF_FILE</CODE> were applied based on the specifications in <CODE>COMMAND_FILE_2</CODE> is output as <CODE>OUTPUT_FILE</CODE>.
633</p>
634
635
636
637<H3>Resolve Offsets</H3>
638<p>
639    Get symbol-offset information from the AXF file that the linker created, and update the XRL file. Use <CODE>makecro</CODE> to resolve offsets. <br> <br> <img src="img/dll_flow_offset.png"> <br> <br> Use <CODE>makecro</CODE> to resolve XRL offsets as follows.
640</p>
641<pre>
642makecro &lt;AXF_FILE&gt; -p -o &lt;OUTPUT_FILE&gt; -d &lt;XRL_FILE&gt;
643</pre>
644<p>
645    <CODE>OUTPUT_FILE</CODE> is the original XRL file (<CODE>XRL_FILE</CODE>) updated with offset information based on <CODE>AXF_FILE</CODE>.
646</p>
647
648
649
650<H3>Create the CRS File</H3>
651<p>
652    Create the CRS file from the static-module AXF file and XRL file. Use <CODE>makecro</CODE> to create the CRS file. <br> <br> <img src="img/dll_flow_crs.png"> <br> Use <CODE>makecro</CODE> as follows to create the CRS file. (Although the following command is separated into multiple lines for readability, an actual command cannot contain newline characters.)
653</p>
654<pre>
655makecro
656    &lt;AXF_FILE&gt;
657    -o &lt;OUTPUT_FILE&gt;
658    -d &lt;XRL_FILE&gt;
659    (-r &lt;REFERENCE_XRL_FILE&gt;)...
660</pre>
661<p>
662    This creates <CODE>OUTPUT_FILE</CODE> as a CRS file from <CODE>AXF_FILE</CODE>, in accordance with the specifications of <CODE>XRL_FILE</CODE>. Use <CODE>REFERENCE_XRL_FILE</CODE> to resolve the offsets of other modules.
663</p>
664<p>
665    You must execute the command using <CODE>XRL_FILE</CODE> to designate the XRL file corresponding to the static module, and <CODE>REFERENCE_XRL_FILE</CODE> to designate the other XRL files. Assuming that your project comprises static module <CODE>App</CODE> and dynamic modules <CODE>Module1</CODE> and <CODE>Module2</CODE>, you would use the following command to create the CRS file.
666</p>
667<pre>
668makecro App.axf -o App.crs -d App.xrl -r Module1.xrl -r Module2.xrl
669</pre>
670
671
672
673<H3>Create the CRO Files</H3>
674<p>
675    Create the CRO files from the dynamic-module AXF files and XRL files. Use <CODE>makecro</CODE> to create the CRO file. <br> <br> <img src="img/dll_flow_cro.png"> <br> Use <CODE>makecro</CODE> as follows to create the CRO file. (Although the following command is separated into multiple lines for readability, an actual command cannot contain newline characters.)
676</p>
677<pre>
678makecro
679    &lt;AXF_FILE&gt;
680    -o &lt;OUTPUT_FILE_1&gt;
681    -t &lt;OUTPUT_FILE_2&gt;
682    -d &lt;XRL_FILE&gt;
683    (-r &lt;REFERENCE_XRL_FILE&gt;)...
684</pre>
685<p>
686    This creates <CODE>OUTPUT_FILE_1</CODE> as the CRO file from <CODE>AXF_FILE</CODE>, in accordance with the specifications of <CODE>XRL_FILE</CODE>. At the same time, it creates <CODE>OUTPUT_FILE_2</CODE> as the <CODE>cro.rlt</CODE> file. Use <CODE>REFERENCE_XRL_FILE</CODE> to resolve the offsets of other modules.
687</p>
688<p>
689    You must execute the command using <CODE>XRL_FILE</CODE> to designate the XRL file corresponding to the target dynamic module, and <CODE>REFERENCE_XRL_FILE</CODE> to designate the other XRL files. Assuming that your project comprises static module <CODE>App</CODE> and dynamic modules <CODE>Module1</CODE> and <CODE>Module2</CODE>, you would use the following command to create the CRO files.
690</p>
691<pre>
692makecro Module1.axf -o Module1.cro -t Module1.cro.rlt -d Module1.xrl -r App.xrl -r Module2.xrl
693</pre>
694
695
696
697<H3>Create the CRR File</H3>
698<p>
699    This step creates the CRR file by merging the <CODE>.cro.rlt</CODE> files. Use <CODE>makecrr</CODE> to create the CRR file. <br> <br> <img src="img/dll_flow_crr.png"> <br> Use <CODE>makecrr</CODE> as follows.
700</p>
701<pre>
702makecrr [-d] -o &lt;output file&gt; (-r &lt;.cro.rlt file&gt;)...
703</pre>
704<p>
705    <CODE>OUTPUT_FILE</CODE> is a CRR file merging the <CODE>.cro.rlt</CODE> files (<CODE>CRO_RLT_FILE</CODE>). Specify the <CODE>-d</CODE> option to store information necessary for debugging the <CODE>CRO</CODE> object in the CRR file.
706</p>
707
708
709
710<H2>nnroUnresolved</H2>
711<p>
712    Using the <CODE>nnroUnresolved</CODE> function with the static module requires additional build steps. These are the additional build steps that are required to use the <CODE>nnroUnresolved</CODE> function with the static module.
713</p>
714<p>
715    For a detailed explanation of the  <CODE>nnroUnresolved</CODE> function, see the <i><a href="DllManual.html#nnroUnresolved" target="_parent">DLL Manual</a></i>.
716</p>
717
718<H3>Build Sequence</H3>
719<p>
720    The following image shows the build sequence surrounding the creation of a CCI file or a CXI file from the AFX file of the application, when DLLs are used. <br> <br> <img src="img/dll_flow_unr_old.png"> <br> <br> That is changed as follows.<br> <br> <br> <img src="img/dll_flow_unr_new.png"> <br> <br>In addition, you must specify an additional command-line option when creating the command file.
721</p>
722<p>
723    The commands to execute at each of these build steps are described in the following sections.
724</p>
725
726
727<H3>Create the Command File</H3>
728<p>
729    If the <CODE>nnroUnresolved</CODE> function is used with the static module, you must specify an additional command-line option in <b>Create the Command File</b>. The additional option is <code>-y nnroUnresolved</code>. Use <CODE>makecro</CODE> as follows.
730</p>
731<pre>
732makecro -x -y nnroUnresolved -o &lt;OUTPUT_FILE&gt; &lt;XRL_FILE&gt;
733</pre>
734
735<H3>Replacing References</H3>
736<p>
737    In the <CODE>.axf</CODE> file, overwrite the place where the DLL symbol is referenced to reference <CODE>nnroUnresolved</CODE>. Use <CODE>makecro</CODE> to replace the reference. <br> <br> <img src="img/dll_flow_replace.png"> <br> <br>Use <CODE>makecro</CODE> as follows to replace the reference.
738</p>
739<pre>
740makecro -u nnroUnresolved -o &lt;<CODE>OUTPUT_FILE</CODE>&gt; &lt;<CODE>INPUT_FILE</CODE>&gt;
741</pre>
742<p>
743    An AXF file based on the <CODE>INPUT_FILE</CODE>, but with the reference replaced, is created as the <CODE>OUTPUT_FILE</CODE>.
744</p>
745
746
747
748<H2>Revision History</H2>
749<dl class="history">
750    <dt>2012/07/10</dt>
751    <dd>
752        Added <CODE>--emit_non_debug_relocs</CODE> as a necessary option in the &quot;Link Dynamic Modules&quot; step.
753    </dd>
754
755    <dt>2012/06/22</dt>
756    <dd>
757        Added a link to <I>Guide to Developing a Build System (for High-Level DLLs)</I>.<br/>
758    </dd>
759
760    <dt>2012/04/23</dt>
761    <dd>
762        Updated &quot;Overall Sequence.&quot; Added &quot;Command File 2&quot; and &quot;Forced References.&quot;
763    </dd>
764
765    <dt>2012/02/27</dt>
766    <dd>
767        Corrected the command to create a CRS file in the &quot;Create CRS File&quot; section.<br> Corrected a typo.
768    </dd>
769
770    <dt>2012/02/20</dt>
771    <dd>
772        Corrected the command to create <CODE>app.crs</CODE> in the overall sequence chart.
773    </dd>
774
775    <dt>2011/12/12</dt>
776    <dd>
777        Added the section <B>nnroUnresolved</B>.
778    </dd>
779
780    <dt>2011/09/26</dt>
781    <dd>
782        Added description of the <CODE>-d</CODE> option to <B>Create the CRR File</B>. Added the Revision History section.
783    </dd>
784
785    <dt>2011/08/03</dt>
786    <dd>
787        Initial version.
788    </dd>
789</dl>
790
791
792<div class="footer"><span>Guide to Developing a Build System (for DLLs)</span></div>
793
794<p>CTR-06-0203-002-I<br>CONFIDENTIAL</p></body>
795</HTML>