9 years, 9 months ago.

What is my File name

I have been writing software for a couple of PCB I have made,

The big problem is now, I have no idea of what code/version is in each board !!

Is there any way I can retrieve the file-name, version, build Date Time etc,

so I can print it out, using serial, usually at power up, or request, etc.

Cheers

Ceri

1 Answer

9 years, 9 months ago.

Hi ceri,

If you have embedded anything unique into your program, and if you can extract that binary image back out, you could search for strings in the file. [There are several small applications people have created to extract strings from binary files]

What I commonly do is this:

const char * PROG_INFO = "My Program: " __DATE__ ", " __TIME__;

...
    // soon after the entry point to main( )
    printf("\r\n%s\r\n", PROG_INFO);


These get you the build date and time (in the time-zone of the build-computer). There have been requests to the mbed team asking for "version" elements defined in the pre-processor, so you could embed something traceable back to a specific check-in, but to my knowledge that is not available.

For devices with a display, I usually show the build information on the display too.

Thanks for the response. I was really hoping for a one line fix for getting the project name. Version and date would be good too... Most of my current projects do not have a display. .. The one I was planning on using as a debugging add on is I2C. .. So if it is not connected. . Code won't run

posted by ceri clatworthy 14 Feb 2015