Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Bindesc Define

Binary Descriptor Definition. More...

Macros

#define BINDESC_ID_APP_VERSION_STRING   0x800
 The app version string such as "1.2.3".
 
#define BINDESC_ID_APP_VERSION_MAJOR   0x801
 The app version major such as 1.
 
#define BINDESC_ID_APP_VERSION_MINOR   0x802
 The app version minor such as 2.
 
#define BINDESC_ID_APP_VERSION_PATCHLEVEL   0x803
 The app version patchlevel such as 3.
 
#define BINDESC_ID_APP_VERSION_NUMBER   0x804
 The app version number such as 0x10203.
 
#define BINDESC_ID_KERNEL_VERSION_STRING   0x900
 The kernel version string such as "3.4.0".
 
#define BINDESC_ID_KERNEL_VERSION_MAJOR   0x901
 The kernel version major such as 3.
 
#define BINDESC_ID_KERNEL_VERSION_MINOR   0x902
 The kernel version minor such as 4.
 
#define BINDESC_ID_KERNEL_VERSION_PATCHLEVEL   0x903
 The kernel version patchlevel such as 0.
 
#define BINDESC_ID_KERNEL_VERSION_NUMBER   0x904
 The kernel version number such as 0x30400.
 
#define BINDESC_ID_BUILD_TIME_YEAR   0xa00
 The year the image was compiled in.
 
#define BINDESC_ID_BUILD_TIME_MONTH   0xa01
 The month of the year the image was compiled in.
 
#define BINDESC_ID_BUILD_TIME_DAY   0xa02
 The day of the month the image was compiled in.
 
#define BINDESC_ID_BUILD_TIME_HOUR   0xa03
 The hour of the day the image was compiled in.
 
#define BINDESC_ID_BUILD_TIME_MINUTE   0xa04
 The minute the image was compiled in.
 
#define BINDESC_ID_BUILD_TIME_SECOND   0xa05
 The second the image was compiled in.
 
#define BINDESC_ID_BUILD_TIME_UNIX   0xa06
 The UNIX time (seconds since midnight of 1970/01/01) the image was compiled in.
 
#define BINDESC_ID_BUILD_DATE_TIME_STRING   0xa07
 The date and time of compilation such as "2023/02/05 00:07:04".
 
#define BINDESC_ID_BUILD_DATE_STRING   0xa08
 The date of compilation such as "2023/02/05".
 
#define BINDESC_ID_BUILD_TIME_STRING   0xa09
 The time of compilation such as "00:07:04".
 
#define BINDESC_ID_HOST_NAME   0xb00
 The name of the host that compiled the image.
 
#define BINDESC_ID_C_COMPILER_NAME   0xb01
 The C compiler name.
 
#define BINDESC_ID_C_COMPILER_VERSION   0xb02
 The C compiler version.
 
#define BINDESC_ID_CXX_COMPILER_NAME   0xb03
 The C++ compiler name.
 
#define BINDESC_ID_CXX_COMPILER_VERSION   0xb04
 The C++ compiler version.
 
#define BINDESC_TAG_DESCRIPTORS_END   BINDESC_TAG(DESCRIPTORS_END, 0x0fff)
 
#define BINDESC_STR_DEFINE(name, id, value)
 Define a binary descriptor of type string.
 
#define BINDESC_UINT_DEFINE(name, id, value)
 Define a binary descriptor of type uint.
 
#define BINDESC_BYTES_DEFINE(name, id, value)
 Define a binary descriptor of type bytes.
 
#define BINDESC_GET_STR(name)   BINDESC_NAME(name).data
 Get the value of a string binary descriptor.
 
#define BINDESC_GET_UINT(name)   *(uint32_t *)&(BINDESC_NAME(name).data)
 Get the value of a uint binary descriptor.
 
#define BINDESC_GET_BYTES(name)   BINDESC_NAME(name).data
 Get the value of a bytes binary descriptor.
 
#define BINDESC_GET_SIZE(name)   BINDESC_NAME(name).len
 Get the size of a binary descriptor.
 

Detailed Description

Binary Descriptor Definition.

Macro Definition Documentation

◆ BINDESC_BYTES_DEFINE

#define BINDESC_BYTES_DEFINE (   name,
  id,
  value 
)

#include <zephyr/bindesc.h>

Value:
__BINDESC_ENTRY_DEFINE(name) = { \
.tag = BINDESC_TAG(BYTES, id), \
.len = (uint16_t)sizeof((uint8_t [])__DEBRACKET value), \
.data = __DEBRACKET value, \
}
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89

Define a binary descriptor of type bytes.

Define a uint8_t array that is registered in the binary descriptor header. The defined array can be accessed using BINDESC_GET_BYTES. The value should be given as an array literal, wrapped in parentheses, for example:

BINDESC_BYTES_DEFINE(name, id, ({1, 2, 3, 4}));
Note
The defined array is not static, so its name must not collide with any other symbol in the executable.
Parameters
nameName of the descriptor
idUnique ID of the descriptor
valueA uint8_t array as data for the descriptor

◆ BINDESC_GET_BYTES

#define BINDESC_GET_BYTES (   name)    BINDESC_NAME(name).data

#include <zephyr/bindesc.h>

Get the value of a bytes binary descriptor.

Get the value of a string binary descriptor, previously defined by BINDESC_BYTES_DEFINE. The returned value can be accessed as an array:

for (size_t i = 0; i < BINDESC_GET_SIZE(name); i++)
    BINDESC_GET_BYTES(name)[i];
Parameters
nameName of the descriptor

◆ BINDESC_GET_SIZE

#define BINDESC_GET_SIZE (   name)    BINDESC_NAME(name).len

#include <zephyr/bindesc.h>

Get the size of a binary descriptor.

Get the size of a binary descriptor. This is particularly useful for bytes binary descriptors where there's no null terminator.

Parameters
nameName of the descriptor

◆ BINDESC_GET_STR

#define BINDESC_GET_STR (   name)    BINDESC_NAME(name).data

#include <zephyr/bindesc.h>

Get the value of a string binary descriptor.

Get the value of a string binary descriptor, previously defined by BINDESC_STR_DEFINE.

Parameters
nameName of the descriptor

◆ BINDESC_GET_UINT

#define BINDESC_GET_UINT (   name)    *(uint32_t *)&(BINDESC_NAME(name).data)

#include <zephyr/bindesc.h>

Get the value of a uint binary descriptor.

Get the value of a uint binary descriptor, previously defined by BINDESC_UINT_DEFINE.

Parameters
nameName of the descriptor

◆ BINDESC_ID_APP_VERSION_MAJOR

#define BINDESC_ID_APP_VERSION_MAJOR   0x801

#include <zephyr/bindesc.h>

The app version major such as 1.

◆ BINDESC_ID_APP_VERSION_MINOR

#define BINDESC_ID_APP_VERSION_MINOR   0x802

#include <zephyr/bindesc.h>

The app version minor such as 2.

◆ BINDESC_ID_APP_VERSION_NUMBER

#define BINDESC_ID_APP_VERSION_NUMBER   0x804

#include <zephyr/bindesc.h>

The app version number such as 0x10203.

◆ BINDESC_ID_APP_VERSION_PATCHLEVEL

#define BINDESC_ID_APP_VERSION_PATCHLEVEL   0x803

#include <zephyr/bindesc.h>

The app version patchlevel such as 3.

◆ BINDESC_ID_APP_VERSION_STRING

#define BINDESC_ID_APP_VERSION_STRING   0x800

#include <zephyr/bindesc.h>

The app version string such as "1.2.3".

◆ BINDESC_ID_BUILD_DATE_STRING

#define BINDESC_ID_BUILD_DATE_STRING   0xa08

#include <zephyr/bindesc.h>

The date of compilation such as "2023/02/05".

◆ BINDESC_ID_BUILD_DATE_TIME_STRING

#define BINDESC_ID_BUILD_DATE_TIME_STRING   0xa07

#include <zephyr/bindesc.h>

The date and time of compilation such as "2023/02/05 00:07:04".

◆ BINDESC_ID_BUILD_TIME_DAY

#define BINDESC_ID_BUILD_TIME_DAY   0xa02

#include <zephyr/bindesc.h>

The day of the month the image was compiled in.

◆ BINDESC_ID_BUILD_TIME_HOUR

#define BINDESC_ID_BUILD_TIME_HOUR   0xa03

#include <zephyr/bindesc.h>

The hour of the day the image was compiled in.

◆ BINDESC_ID_BUILD_TIME_MINUTE

#define BINDESC_ID_BUILD_TIME_MINUTE   0xa04

#include <zephyr/bindesc.h>

The minute the image was compiled in.

◆ BINDESC_ID_BUILD_TIME_MONTH

#define BINDESC_ID_BUILD_TIME_MONTH   0xa01

#include <zephyr/bindesc.h>

The month of the year the image was compiled in.

◆ BINDESC_ID_BUILD_TIME_SECOND

#define BINDESC_ID_BUILD_TIME_SECOND   0xa05

#include <zephyr/bindesc.h>

The second the image was compiled in.

◆ BINDESC_ID_BUILD_TIME_STRING

#define BINDESC_ID_BUILD_TIME_STRING   0xa09

#include <zephyr/bindesc.h>

The time of compilation such as "00:07:04".

◆ BINDESC_ID_BUILD_TIME_UNIX

#define BINDESC_ID_BUILD_TIME_UNIX   0xa06

#include <zephyr/bindesc.h>

The UNIX time (seconds since midnight of 1970/01/01) the image was compiled in.

◆ BINDESC_ID_BUILD_TIME_YEAR

#define BINDESC_ID_BUILD_TIME_YEAR   0xa00

#include <zephyr/bindesc.h>

The year the image was compiled in.

◆ BINDESC_ID_C_COMPILER_NAME

#define BINDESC_ID_C_COMPILER_NAME   0xb01

#include <zephyr/bindesc.h>

The C compiler name.

◆ BINDESC_ID_C_COMPILER_VERSION

#define BINDESC_ID_C_COMPILER_VERSION   0xb02

#include <zephyr/bindesc.h>

The C compiler version.

◆ BINDESC_ID_CXX_COMPILER_NAME

#define BINDESC_ID_CXX_COMPILER_NAME   0xb03

#include <zephyr/bindesc.h>

The C++ compiler name.

◆ BINDESC_ID_CXX_COMPILER_VERSION

#define BINDESC_ID_CXX_COMPILER_VERSION   0xb04

#include <zephyr/bindesc.h>

The C++ compiler version.

◆ BINDESC_ID_HOST_NAME

#define BINDESC_ID_HOST_NAME   0xb00

#include <zephyr/bindesc.h>

The name of the host that compiled the image.

◆ BINDESC_ID_KERNEL_VERSION_MAJOR

#define BINDESC_ID_KERNEL_VERSION_MAJOR   0x901

#include <zephyr/bindesc.h>

The kernel version major such as 3.

◆ BINDESC_ID_KERNEL_VERSION_MINOR

#define BINDESC_ID_KERNEL_VERSION_MINOR   0x902

#include <zephyr/bindesc.h>

The kernel version minor such as 4.

◆ BINDESC_ID_KERNEL_VERSION_NUMBER

#define BINDESC_ID_KERNEL_VERSION_NUMBER   0x904

#include <zephyr/bindesc.h>

The kernel version number such as 0x30400.

◆ BINDESC_ID_KERNEL_VERSION_PATCHLEVEL

#define BINDESC_ID_KERNEL_VERSION_PATCHLEVEL   0x903

#include <zephyr/bindesc.h>

The kernel version patchlevel such as 0.

◆ BINDESC_ID_KERNEL_VERSION_STRING

#define BINDESC_ID_KERNEL_VERSION_STRING   0x900

#include <zephyr/bindesc.h>

The kernel version string such as "3.4.0".

◆ BINDESC_STR_DEFINE

#define BINDESC_STR_DEFINE (   name,
  id,
  value 
)

#include <zephyr/bindesc.h>

Value:
__BINDESC_ENTRY_DEFINE(name) = { \
.tag = BINDESC_TAG(STR, id), \
.len = (uint16_t)sizeof(value), \
.data = value, \
}
macro s mov &$suffix s endm macro off if else ld &$suffix endif endm macro STR
Definition: asm-macro-32-bit-mwdt.h:21

Define a binary descriptor of type string.

Define a string that is registered in the binary descriptor header. The defined string can be accessed using BINDESC_GET_STR

Note
The defined string is not static, so its name must not collide with any other symbol in the executable.
Parameters
nameName of the descriptor
idUnique ID of the descriptor
valueA string value for the descriptor

◆ BINDESC_TAG_DESCRIPTORS_END

#define BINDESC_TAG_DESCRIPTORS_END   BINDESC_TAG(DESCRIPTORS_END, 0x0fff)

#include <zephyr/bindesc.h>

◆ BINDESC_UINT_DEFINE

#define BINDESC_UINT_DEFINE (   name,
  id,
  value 
)

#include <zephyr/bindesc.h>

Value:
__BINDESC_ENTRY_DEFINE(name) = { \
.tag = BINDESC_TAG(UINT, id), \
.len = (uint16_t)sizeof(uint32_t), \
.data = sys_uint32_to_array(value), \
}
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
#define sys_uint32_to_array(val)
Convert 32-bit unsigned integer to byte array.
Definition: byteorder.h:294

Define a binary descriptor of type uint.

Define an integer that is registered in the binary descriptor header. The defined integer can be accessed using BINDESC_GET_UINT

Note
The defined integer is not static, so its name must not collide with any other symbol in the executable.
Parameters
nameName of the descriptor
idUnique ID of the descriptor
valueAn integer value for the descriptor