The following steps can be used to build binutils for the c4x or alternatively you can use the script c4x-binutils-build . Note that you need to have previously installed the binutils for the c4x.
Acquire and unpack binutils source tree. You can either download the gcc-2.11.1 tarball or use CVS (see the script c4x-binutils-update for an example of how to do this.)
Patch binutils source tree with c4x patches. The latest stable version is binutils-2_11_1-c4x-20010623.patch.gz.
Create a build directory, say
mkdir obj-c4x-binutils .
Configure binutils:
cd obj-binutils-c4x
../binutils/configure --target=c4x --prefix=/usr
(Note that /usr/local is the default prefix.)
Build binutils:
make
Install binutils (usually as root):
make install
The C4x assembler (c4x-as) will assemble code for the C3x with a -m30 switch (or -m31, -m32, etc.) It is rather lenient in the syntax it accepts and as a consequence the error messages can be a bit terse (it is designed primarily for the code generated by c4x-gcc). Note that it is largely compatible with the TI asm30 assembler syntax, although macros need their arguments escaped with a backslash. Some of the debugging directives and listing control directives are quietly ignored ;-)
c4x-gcc uses an extension provided by c4x-as for loading the 16
MSBs of a symbol address on the C40. This is specified using the
^ operator, for example, ldhi ^foo, ar0.
The C4x linker (c4x-ld) uses scripts to determine where to place the various program sections into memory.
The default linker scripts are usually found in /usr/local/c4x/lib/ldscripts/. These are automagically generated from a master template which has been specifically customised for my C30 target system. This template should probably be generalised to cater for the weird diversity of target systems. I'd welcome suggestions.
To get the linker (c4x-ld) to output the old COFF format (V0),
add the following line to the start of your linker scripts.
OUTPUT_FORMAT("coff-c4x-old")
instead of
OUTPUT_FORMAT("coff-c4x")
Alternatively, you can also use the linker option --oformat coff-c4x-old to do the same from the command line.
Object files can be debugged and disassembled using c4x-objdump.
Object files can be converted to different formats using c4x-objcopy.
Copyright ©1997,1998,1999,2000,2001 Michael Hayes (m.hayes@elec.canterbury.ac.nz)
Last modified: Sat Jun 23 14:55:39 NZST 2001