Byte-swapping can also be a requirement of this process and can also be managed by the tools.
Byte-swapping is the translation of bits in the file from D[7-0] to D[0-7] format.
This article covers how PROMGen can be used to perform these translations.
The following are typical use models and examples of how to use the tools.
1 - Transform a .mcs file into a .hex file.
Here the -r flag is used as a "recursive' input flag into the PROMGen tool.
promgen -p hex -r input.mcs -o output.hex
2 - Byte-swap an existing .mcs file.
This is a two tier process which will first create a byte-swapped .hex file and then translate this to a .mcs file.
promgen -p hex -b -r input.mcs -o temp.hex
promgen -p mcs -r temp.hex -o swapped.mcs
3 - Add other files into a prom file, this can be done with the -data_file flag.
This flag will translate .bin files into .hex data when translating to a .mcs file.
Below is an example of creating a .mcs file with a .bit and a binary user data file from a specific address.
promgen -p mcs -u 0 input.bit -data_file u 80000 user_data.bin -o outfile.mcs
This flag will also translate .hex files into ASCII data in a .mcs file, so when adding a hex file that is intended to be a hex file, first translate the file to a .bin file format using:
promgen -p bin -r input.hex -o outfile.bin