In order to deal with binary data, instead of loading them as file, you can transform them in source code format and included them as normal files. Bin2Txt is a tool that can transform any kind of binary file in the equivalent assembly or C source code.


To transform a binary file as a texte file:

	%OSDK%\bin\Bin2Txt [switches] binary_file text_file label_name

The -s switch control the size of data:

-s1 => 8 bits
-s2 => 16 bits
-s4 => 32 bits

The -f switch controls the output format

-f1 => C output
-f2 => S output (assembly code)	
-f3 => BASIC output (lines of DATA)

The -l switch defines the line parameters when exporting to BASIC mode. It must be followed by one or two values separated by a : character. By default the numerating starts at line 10 and increase by 10 every line.

-l100  => Output will start at line 100, then increase by 10 (100, 110, 120, 130, ...)
-l90:5 => Output will start at line 90, then increase by 5 (90, 95, 100, 105, ...)

The -e switch controls the endianness of the source data. This affects only the 16 and 32 bits mode.

-e1 => Little Endian format (default)
-e2 => Big Endian format

The -h switch controls if the output should be done in decimal or hexadecimal.

-h1 => Hexadecimal format (default)
-h2 => Decimal format

The -n switch controls the number of values to export per line

-n6 => 6 values per line
-n16 => 16 values per line
-n48 => 48 valies per line
... etc

Known issues

No known problem - please signal any issue on the Cross development tools forum.

comments powered by Disqus
Version 0.4
  • Added -f3 (Export to BASIC) output format.
  • Added -h switch to select between hexadecimal and decimal format.
  • Added -e switch to control the endianess of source data.
  • Added -l switch to control line numbering (BASIC only)
Version 0.3
  • Added -n switch to set the number of values per line
Version 0.2
  • First released version