mirror of
https://github.com/espressif/openthread.git
synced 2026-07-22 12:04:06 +00:00
Let platforms specify linker section for version string (#1334)
`PLATFORM_VERSION_ATTR_PREFIX` and `PLATFORM_VERSION_ATTR_SUFFIX` are intended to be used to specify compiler directives to indicate what linker section the platform version string should be stored. This is useful for specifying an exact locaiton of where the version string will be located so that it can be easily retrieved from the raw firmware image. If `PLATFORM_VERSION_ATTR_PREFIX` is unspecified, the keyword `static` is used instead. If both are unspecified, the location of the string in the firmware image will be undefined and may change.
This commit is contained in:
committed by
Jonathan Hui
parent
5ca4b9908a
commit
0e812192e2
+27
-4
@@ -1155,16 +1155,39 @@ void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback a
|
||||
|
||||
const char *otGetVersionString(void)
|
||||
{
|
||||
static const char sVersion[] =
|
||||
/**
|
||||
* PLATFORM_VERSION_ATTR_PREFIX and PLATFORM_VERSION_ATTR_SUFFIX are
|
||||
* intended to be used to specify compiler directives to indicate
|
||||
* what linker section the platform version string should be stored.
|
||||
*
|
||||
* This is useful for specifying an exact locaiton of where the version
|
||||
* string will be located so that it can be easily retrieved from the
|
||||
* raw firmware image.
|
||||
*
|
||||
* If PLATFORM_VERSION_ATTR_PREFIX is unspecified, the keyword `static`
|
||||
* is used instead.
|
||||
*
|
||||
* If both are unspecified, the location of the string in the firmware
|
||||
* image will be undefined and may change.
|
||||
*/
|
||||
|
||||
#ifdef PLATFORM_VERSION_ATTR_PREFIX
|
||||
PLATFORM_VERSION_ATTR_PREFIX
|
||||
#else
|
||||
static
|
||||
#endif
|
||||
const char sVersion[] =
|
||||
PACKAGE_NAME "/" PACKAGE_VERSION
|
||||
#ifdef PLATFORM_INFO
|
||||
"; " PLATFORM_INFO
|
||||
#endif
|
||||
#if defined(__DATE__)
|
||||
"; " __DATE__ " " __TIME__;
|
||||
#else
|
||||
;
|
||||
"; " __DATE__ " " __TIME__
|
||||
#endif
|
||||
#ifdef PLATFORM_VERSION_ATTR_SUFFIX
|
||||
PLATFORM_VERSION_ATTR_SUFFIX
|
||||
#endif
|
||||
; // Trailing semicolon to end statement.
|
||||
|
||||
return sVersion;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user