This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

zero padding to binary file

Hi,

Is it possible during compilation to pad the binary file with zeros at the end??

And is it possible to calculate CRC of he binary image during compilation?

  • Hi,

    Your first question is confusing - what do you mean by "padding the binary file to the end"? The .bin file is as much as the generated code (plus some info) and nothing else; if you refer to the RAM, then at run time the RAM is really initialised with zero at the beginning; if you mean the FLASH, to be padded with zero to the end of the FLASH area, then it is not a good idea, since you already write something and is not anymore clean (you may have some data to be written and then you need to erase first...).

    As for your second question, yes, it is possible, attached there is an example code written by Chester on CCS forum:

    3301.TI_ARM_text_segment_size.zip

    Petrei

  • Hi Petrei,

    Thank you for your response.

    I wanted to add trailing zeros at the end of binary file so that I can fix the file size to a fixed value. i.e. Suppose my binary file is of 12kB then I want to add trailing zeros to it to make it 15kB.

    Best Regards,

    Rushikesh

  • I wanted to add trailing zeros at the end of binary file so that I can fix the file size to a fixed value. i.e. Suppose my binary file is of 12kB then I want to add trailing zeros to it to make it 15kB.

    Padding binaries with zero is not common practice in the MCU business. As the erased state of a Flash cell is 1, this would force longer programming duration (as all this "0" bit need actual programming), and put additional stress on the onboard programming circuitry.

  • Yeah, correct.

    Thanks for your reply :)