2016-11-15 11:58 PM
Hi,
i'm using the STM32f4_discovery.Is there a way to include version number/Varible that i can read its value/string,when just viewing the file.maybe an executable that reads the hex file and locate the variable ?I'm not interested in quering through uart.Thanks!!2017-01-12 12:11 PM
It is just a representation of the binary data in the firmware image, you could write an app in C to read and review the content. Not unduly complicated. See
http://srecord.sourceforge.net/
2017-01-12 12:45 PM
There is a compiler macro to fill a constant string with compile date and another macro for time. It will be in flash hence the hex or s19 or bin file. I usually display on Lcd at boot for 2 seconds as a mean to check what FW is running inside. Would this be sufficient?
2017-01-12 01:04 PM
There is a compiler macro to fill a constant string with compile date and another macro for time
namely __DATE__ and __TIME__ , as per C99 §6.10.8.
JW
2017-01-12 01:23 PM
This assumes that the value is placed on a fixed known address. This is the most probable scenario, but the OP should know first how to achieve that (and AFAIK that is toolchain-specific).
Automating display of a constant variable identified only by its name is somewhat more challenging...
JW
2017-01-12 01:35 PM
Normally one puts a searchable magic value in the front of the string. For variables/symbols by name the .ELF/.AXF is the way to go, but more complicated.
2017-01-12 01:48 PM
.text :
{
. = ALIGN(0x200);
KEEP(*(.text.METAINFO))
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
#define METAINFA __attribute__((__used__, section('.text.METAINFO')))
METAINFA const char META[] = {'LOCATION displays text test:' __DATE__ ', ' __TIME__ '.\r\n'};
For flash memory - the address of the text '.text.METAINFO' will be 0x08000200. Anytime and anywhere.
2017-01-12 02:00 PM
Like
static const char version[] = '(#)VERSION ' __DATE__ ' ' __TIME__;�?
2017-01-13 02:44 AM
Why did the forum flag this for moderation? I've had two posts yesterday with the Source Code Formatting automatically flagged and presumably not visible, and now with the wrong time stamp.