1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>bin2obj</TITLE>
8<LINK rel="stylesheet" href="../css/nitro.css" type="text/css">
9<STYLE type="text/css">
10<!--
11.sample_source{
12  background-color : #e8e8e8;
13}
14H3{
15  color : teal;
16}
17.command_list{
18  margin-bottom : 16pt;
19}
20.command_desc{
21  }
22.command_item{
23  margin-top : 16pt;
24  background-color : #e8e8e8;
25}
26.blockquoted_table {
27  border : 1px;
28  width : 80%;
29}
30TD,TH{
31  border-color	: #c0d8d8;
32  padding       : 1pt 4pt 1pt 4pt;
33  border-width  : 1px;
34  border-style  : solid;
35}
36-->
37</STYLE>
38</HEAD>
39<BODY>
40<H1 align="left">bin2obj <IMG src="../image/NTR.gif" align="middle"><IMG src="../image/TWL.gif" align="middle"></H1>
41<H2>Description</H2>
42<P><CODE>bin2obj</CODE> is a tool that converts binary files into object files that can be directly linked by the linkers of C compilers in CodeWarrior.</P>
43<H2>Using the Tool</H2>
44<H3>Start Command</H3>
45<PRE><CODE>% bin2obj BINARY_FILE OBJECT_FILE
46                  [-b|--begin SYMBOL_BEGIN] [-e|--end SYMBOL_END]
47                  [-C|--compatible] [-a|--align ALIGNMENT] [-r|--readonly] [-s|--section SECTION]</CODE></PRE>
48<P>Converts the binary file specified by <CODE>BINARY_FILE</CODE> into a linkable object format and outputs the file with the name <CODE>OBJECT_FILE</CODE>. This tool operates the same way as the the BinToElf tool that comes with the CodeWarrior for NINTENDO DS package.</P>
49<P>The <CODE>-b</CODE> and <CODE>-e</CODE> options specify symbols that enable the data in the binary file to be accessed from programs written in C and other languages. You can use the long names for the options, <CODE>--begin</CODE> and <CODE>--end</CODE> instead of <CODE>-b</CODE> and <CODE>-e</CODE>.</P>
50<P>The name for the symbol at the start of the data region is specified using <CODE>SYMBOL_BEGIN</CODE>. Similarly, the name for the symbol at the end of the data region (more specifically, the next address after the last data) is specified using  <CODE>SYMBOL_END</CODE>. The size of the binary region is calculated by subtracting the value of <CODE>SYMBOL_BEGIN</CODE> from the value of <CODE>SYMBOL_END</CODE>. </P>
51<P>When specifying the symbol name, you can use the special keywords <CODE>%f, %t, %b, and %e</CODE>. These keywords reference a portion of a binary file, as shown below for the file specified by <CODE>BINARY_FILE</CODE>.</P>
52<BLOCKQUOTE>
53<DL>
54  <DT><CODE>%f</CODE> or <CODE>%t</CODE>
55  <DD>The portion of <CODE>BINARY_FILE</CODE> excluding the directory.
56  <DT><CODE>%b&nbsp;</CODE>
57  <DD>The portion of <CODE>BINARY_FILE</CODE> excluding the directory and the file extension.
58  <DT><CODE>%e</CODE>
59  <DD>The file extension of <CODE>BINARY_FILE</CODE> (excluding the dot)
60</DL>
61</BLOCKQUOTE>
62<P>When these options are not specified, the default values are <CODE>%b_begin</CODE> for <CODE>SYMBOL_BEGIN</CODE> and <CODE>%b_end</CODE> for <CODE>SYMBOL_END</CODE>.</P>
63<P>The <CODE>-C</CODE> option generates a symbol that is compatible with the BinToElf tool that is included in CodeWarrior for NINTENDO DS. You can use the long name <CODE>--compatible</CODE> instead of <CODE>-C </CODE>. The <CODE>-C </CODE> option is equivalent to the following option specifications:</P>
64<BLOCKQUOTE>
65<P><CODE>-b _binary_%f -e _binary_%f_end</CODE></P>
66</BLOCKQUOTE>
67<P>The <CODE>-a</CODE> option specifies the alignment value for the data block when the binary file is made into an object. You can use the long name <CODE>--align</CODE> instead of <CODE>-a</CODE>. The default value is 4.</P>
68<P>When the <CODE>-r</CODE> option is specified, the data block is handled as a read-only section (normally a <CODE>.rodata</CODE> section.) You can use the long name <CODE>--readonly</CODE>  instead of  <CODE>-r</CODE>. If this option is not specified, the data block is treated as a readable/writable section (normally a <CODE>.data</CODE> section).</P>
69<P>The <CODE>-s</CODE> option can be used to specify the data block section name. You can use the long name <CODE>--section</CODE>  for  <CODE>-s</CODE>. If this option is not specified, <CODE>.rodata</CODE> is used as the name for a read-only data block and <CODE>.data</CODE> gets used as the name for a readable/writable data block.</P>
70<H2>Location</H2>
71<P><CODE>$TwlSDK/tools/bin/bin2obj.exe</CODE></P>
72<H2>See Also</H2>
73<P>The BinToElf tool in the CodeWarrior for NINTENDO DS package.</P>
74<H2>Revision History</H2>
75<P>2005/06/14 Initial version.</P>
76<hr><p>CONFIDENTIAL</p></body>
77</HTML>