assert(), __FILE__, Path and other cool GNU gcc Tricks to be aware of

It is always good to have a close look what ends up in a microcontroller FLASH memory. For example using EHEP Eclipse plugin to inspect the binary file:

Source File Name in Binary Image

Source File Name in Binary Image

Obviously it has path and source file information in it. Why is that? And is this really needed?

What about:

  • Privacy: the path or file name might expose information (secret project name?) or might be used for reverse engineering?
  • Size: The strings add up to the final data/FLASH size, so this increases the need for ROM space?

So let’s have a look what is the reason for this and how it could be avoided or at least reduced.

Continue reading