c5xtools vs TI - wgrzegorz/c5xtools GitHub Wiki

c5xtools and the TI toolchain

c5xtools is a clean-room reimplementation of the classic TMS320C5x development flow described in SPRU018D. It produces and consumes the same file formats, so its output interoperates with the original Texas Instruments tools. This page maps each c5xtools program to its TI counterpart, lists the options, and states what "compatible" means in each case.

The full option descriptions are in the installed manual pages (man c5xasm, man c5xlnk, man c5xhex, man c5xdis).

Processor-family support

The original SPRU018D toolchain served the whole first/second-generation fixed-point TMS320 line - C1x, C2x, C2xx and C5x - from one set of programs: the assembler picked a device's instruction set with a version option, while the linker, archiver and hex utility worked on the shared COFF object format no matter which device the code was for. c5xtools splits along the same line.

Instruction-set tools (c5xasm, c5xdis) target the TMS320C5x ('C50):

  • Because the 'C5x instruction set is upward compatible with the 'C2x/'C2xx, the C2x/C2xx-compatible subset assembles as well.
  • The few instructions that are not valid on the 'C5x - for example CONF and the serial-port forms FORT, RFSM, SFSM, RTXM and STXM - are rejected on purpose.
  • There is no support for 'C1x-only forms, nor for any later or different architecture (the floating-point 'C3x/'C4x, the 'C54x/'C55x, or the 'C62x/'C64x/'C67x): those are different instruction sets and, usually, a different object format.

Format-level tools (c5xlnk, c5xhex, the shared COFF code) are not instruction aware. They operate on sections, symbols and relocations in the TMS320 COFF whose target id is 0x0092, which the 'C2x, 'C2xx and 'C5x all share, so they link and convert objects built for any of those devices the same way, independent of the CPU that produced them.

In short, "for the TMS320C5x" is exact for the assembler and disassembler; the linker and hex converter are broader, covering the 'C2x/'C2xx/'C5x COFF family.

Compatibility with other families is unverified

The scope above is what the code implements and what has been exercised against the 'C5x. Compatibility with other TMS320 families has not been verified, for a plain reason: the author has no access to evaluation hardware or silicon for those other platforms and DSP families, so for the above reasons there was no way to test it. The boundaries stated here are deliberate and honest, not a claim that nothing else could ever work.

The toolchain could certainly be extended - both to more processor families (the assembler's instruction tables and the disassembler's decoder are the parts that would grow) and in the framework itself. Contributions in that direction are welcome.

And a genuine request: if you happen to have a spare period evaluation kit gathering dust - a 'C5x EVM, a 'C2x/'C2xx EVM, a 'C3x/'C4x or 'C54x/'C55x board, or anything similar - that you would be willing to donate to the author, please get in touch (the repository README lists how to reach the project). It would make verifying and extending family support actually possible.

The development flow

  source.asm --c5xasm--> object.obj --c5xlnk--> program.out --c5xhex--> rom.hex
                                                     |
                                                     +-----c5xdis----> listing.asm
c5xtools TI tool Role
c5xasm the reference assembler (dspa) assemble source to a COFF object
c5xlnk the reference linker (dsplnk) link objects to a COFF executable
c5xhex the reference hex utility (dsphex) convert a COFF image to a ROM format
c5xdis (no TI equivalent) disassemble an image back to source

Common conventions

Every tool prints a short banner on startup, accepts -h / -help for usage and -version for the version, takes -q / -quiet for one-line output and -v / -verbose for more, and writes its result with -o <file>. Errors and usage go to standard error; -help goes to standard output.

c5xasm (assembler)

Assembles C5x source into a TI COFF object, or into a flat word listing.

Option Meaning
-coff, -coff1, -coff2 write a COFF object (version 1 or version 2)
-o <file> output file
-v50 target the 'C5x (version stamp in the object)
-q, -quiet / -v, -verbose quieter or louder output
-h, -help / -version, -V usage / version

Compatibility: the COFF object (file header, section headers, section data, symbol table, string table and relocation entries) is byte-identical to the object the reference assembler emits for the same source, including the short-to-long immediate auto-promotion. This is verified by the toolchain's golden-object conformance test.

c5xlnk (linker)

Links one or more COFF objects, resolving symbols and placing sections, into a COFF executable plus an optional map and flat image.

Option Meaning
-o <file> output executable
-m <file> write a link map
-e <sym> set the entry point
-text, -data, -bss <addr> set default section origins
-l <lib>, -i <dir> search object library <lib>; add <dir> to the search path
-u <sym> force <sym> undefined (pull it from a library)
-x exhaustively re-read libraries
-r relocatable (partial) link
-a, -ar absolute / absolute-relocatable output
-b suppress the default output
-f <val> fill value for holes
-flat write a flat image
-s, -static strip / static behaviour

Compatibility: c5xlnk reads TI COFF v1 and v2 objects and archives (!<arch>), implements the MEMORY and SECTIONS command language (PAGE 0/1, GROUP, UNION, load-not-equal-run, NOLOAD, COPY, DSECT), link-time symbol assignment and expressions, and writes a COFF v1 executable whose linked words match the reference linker. See the Linker page for the command language.

c5xhex (hex/ROM converter)

Converts a linked COFF image into a ROM programming format.

Option Meaning
-f <format> output format: intel, srec (Motorola-S), tagged (TI-tagged), ascii, bin
-o <file> output file
-romwidth <8|16> ROM device width in bits
-order <lsb|msb> byte order within a word
-image contiguous memory image
-org <addr>, -len <n>, -fill <val> image origin, length and gap fill

Compatibility: the Intel-HEX and Motorola-S output is byte-identical (after CR stripping) to the reference hex utility's output for the same image, across plain and image-fill modes. See the Hex Conversion page for the record formats.

c5xdis (disassembler)

Decodes a C5x image back into re-assemblable source. It has no counterpart in the original toolchain.

Option Meaning
-f <fmt> input format (raw image or COFF)
-coff treat the input as a COFF file
-base <addr>, -entry <addr> load address and entry point
-addr show addresses in the listing
-symbols <file> apply an external symbol file
-trace recursive-descent analysis (call graph, code/data separation)
-o <file> output file

Compatibility: the decoder is the exact inverse of the shared instruction table, so its output re-assembles byte-for-byte with c5xasm (c5xdis -> c5xasm -> cmp is part of the test suite). -trace adds a recursive-descent mode with a call graph, per-function cross-references, code/data separation, data-page tracking and computed-jump resolution.

Why the output matches

All four tools share one instruction table (include/c5x_isa.h, derived from SPRU056D chapter 6) and one COFF module (lib/c5xcoff/), so the assembler's encoder, the disassembler's decoder, and the linker's and hex converter's COFF handling cannot drift apart. The match to the TI tools is checked offline against frozen golden objects and images with SHA-256 manifests, with no dependency on the original tools at build or test time.

License

MIT - (c) 2026 Grzegorz Worona [email protected]. See LICENSE.

⚠️ **GitHub.com Fallback** ⚠️