Simple Build Info v2.0r1
Simple Build Info library provides macros for creating and handling build info from flash.
Loading...
Searching...
No Matches
SBuildInfo

Classes

struct  build_info_t
 Build info struct. More...
 

Macros

#define SBI_VERSION   "v2.0r1"
 Library version string.
 
#define SBI_APP_NAME_LEN   16
 Maximum length of application name.
 
#define SBI_APP_VER_LEN   16
 Maximum length of application version.
 
#define SBI_APP_HW_LEN   16
 Maximum length of hardware version.
 
#define SBI_APP_FLAGS_LEN   12
 Maximum length of build flags.
 
#define __SBI(_name, _ver, _rev, _flags)
 Code snippet for creating application build info in flash memory.
 
#define __SBI_EXT(_tag, _variant, _ver, _rev, _flags)
 Code snippet for creating extended application build info in flash memory.
 
#define SBI_NAME   __buildInfo.app.name
 Macro for application name.
 
#define SBI_TAG   __buildInfo.app.tag
 Macro for application tag.
 
#define SBI_VARIANT   __buildInfo.app.variant
 Macro for application variant.
 
#define SBI_VER   __buildInfo.appVer
 Macro for application version.
 
#define SBI_HW   __buildInfo.hwRev
 Macro for application hardware revision.
 
#define SBI_DATE   __buildInfo.buildDate
 Macro for application build date. Example date: Aug 8 2019 (day is padded).
 
#define SBI_FLAGS   __buildInfo.buildFlags
 Macro for application build flags. Example: D flag for debug build.
 
#define SBI_USED   (void)(SBI_NAME)
 Code snippet for preventing compiler from removing build info from flash memory.
 

Variables

volatile const build_info_t __buildInfo
 

Detailed Description

Simple Build Info library

Library can be used only with GCC toolchain.

If SBI_NO_FIX is not defined during build, application build info is placed inside sBuildInfo section. User must ensure it exists in linker script.

Define SBI_NO_FIX in build and build info will not be placed at fixed location in flash memory.

Set maximum length of build info by providing SBI_APP_NAME_LEN, SBI_APP_VER_LEN, SBI_APP_HW_LEN and SBI_APP_FLAGS_LEN defines during build. Default length for info is 16 chars(12 for build flags) and 8 chars for application tag and variant.

Build flags example: DFT (one character per build flag)

Macro Definition Documentation

◆ __SBI

#define __SBI (   _name,
  _ver,
  _rev,
  _flags 
)
Value:
volatile const build_info_t __buildInfo __attribute__((section(".sBuildInfo"))) = \
{ \
_name, \
_ver, \
_rev, \
__DATE__, \
_flags \
}
Build info struct.
Definition sBuildInfo.h:183

Code snippet for creating application build info in flash memory.

Application build info will be placed on fixed location in flash memory with user-defined sBuildInfo section within linker script.

Parameters
_nameApplication name. Max SBI_APP_NAME_LEN chars.
_verApplication version. Max SBI_APP_VER_LEN chars.
_revHardware revision. Max SBI_APP_HW_LEN chars.
_flagsBuild flags. Max SBI_APP_FLAGS_LEN chars.

Definition at line 84 of file sBuildInfo.h.

◆ __SBI_EXT

#define __SBI_EXT (   _tag,
  _variant,
  _ver,
  _rev,
  _flags 
)
Value:
volatile const build_info_t __buildInfo __attribute__((section(".sBuildInfo"))) = \
{ \
{ \
.tag = _tag, \
_variant \
}, \
_ver, \
_rev, \
__DATE__, \
_flags \
}
const char tag[SBI_APP_NAME_LEN/2]
C-string for application tag.
Definition sBuildInfo.h:193

Code snippet for creating extended application build info in flash memory.

Application build info will be placed on fixed location in flash memory with user-defined sBuildInfo section within linker script. With this snippet, application name is replaced with application tag and variant, both SBI_APP_NAME_LEN/2 characters long.

Parameters
_tagApplication tag. Max SBI_APP_NAME_LEN/2 chars.
_variantApplication variant. Max SBI_APP_NAME_LEN/2 chars.
_verApplication version. Max SBI_APP_VER_LEN chars.
_revHardware revision. Max SBI_APP_HW_LEN chars.
_flagsBuild flags. Max SBI_APP_FLAGS_LEN chars.
Warning
GCC 11.3+ is required for this snippet.

Definition at line 108 of file sBuildInfo.h.

◆ SBI_APP_FLAGS_LEN

#define SBI_APP_FLAGS_LEN   12

Maximum length of build flags.

Definition at line 67 of file sBuildInfo.h.

◆ SBI_APP_HW_LEN

#define SBI_APP_HW_LEN   16

Maximum length of hardware version.

Definition at line 63 of file sBuildInfo.h.

◆ SBI_APP_NAME_LEN

#define SBI_APP_NAME_LEN   16

Maximum length of application name.

Definition at line 55 of file sBuildInfo.h.

◆ SBI_APP_VER_LEN

#define SBI_APP_VER_LEN   16

Maximum length of application version.

Definition at line 59 of file sBuildInfo.h.

◆ SBI_DATE

#define SBI_DATE   __buildInfo.buildDate

Macro for application build date. Example date: Aug 8 2019 (day is padded).

Definition at line 172 of file sBuildInfo.h.

◆ SBI_FLAGS

#define SBI_FLAGS   __buildInfo.buildFlags

Macro for application build flags. Example: D flag for debug build.

Definition at line 173 of file sBuildInfo.h.

◆ SBI_HW

#define SBI_HW   __buildInfo.hwRev

Macro for application hardware revision.

Definition at line 171 of file sBuildInfo.h.

◆ SBI_NAME

#define SBI_NAME   __buildInfo.app.name

Macro for application name.

Definition at line 167 of file sBuildInfo.h.

◆ SBI_TAG

#define SBI_TAG   __buildInfo.app.tag

Macro for application tag.

Definition at line 168 of file sBuildInfo.h.

◆ SBI_USED

#define SBI_USED   (void)(SBI_NAME)

Code snippet for preventing compiler from removing build info from flash memory.

Definition at line 174 of file sBuildInfo.h.

◆ SBI_VARIANT

#define SBI_VARIANT   __buildInfo.app.variant

Macro for application variant.

Definition at line 169 of file sBuildInfo.h.

◆ SBI_VER

#define SBI_VER   __buildInfo.appVer

Macro for application version.

Definition at line 170 of file sBuildInfo.h.

◆ SBI_VERSION

#define SBI_VERSION   "v2.0r1"

Library version string.

Definition at line 52 of file sBuildInfo.h.