Files
templates/c/firmware-info/include/firmware_info_static.h

23 lines
1.1 KiB
C

/* Small, immutable firmware identity for targets with little code space.
* The build tool supplies scalar constants; the C core owns register packing.
* No startup parser, RAM copy, heap, HAL or runtime SHA implementation is needed.
* Include firmware_identity.h (generated BEFORE compilation) before this file.
*/
#ifndef FIRMWARE_INFO_STATIC_H
#define FIRMWARE_INFO_STATIC_H
#include <stdint.h>
#define FIRMWARE_INFO_STATIC_COUNT 12U
/* Cast BEFORE shifting: an int is only 16 bits on both C28x targets. */
#define FI_PAIR(high, low) ((uint16_t)(((uint16_t)(high) << 8U) | (uint16_t)(low)))
#define FIRMWARE_INFO_STATIC_INITIALIZER { \
1U, FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCH, \
FI_YEAR, FI_PAIR(FI_MONTH, FI_DAY), FI_PAIR(FI_HOUR, FI_MINUTE), FI_SECOND, \
FI_PAIR(FI_ID_0, FI_ID_1), FI_PAIR(FI_ID_2, FI_ID_3), \
FI_PAIR(FI_ID_4, FI_ID_5), FI_PAIR(FI_ID_6, FI_ID_7) }
/* Return zero outside the contract. The transport must reject invalid ranges
* before calling this function; zero is NOT an invented firmware version. */
uint16_t firmware_info_static_read(unsigned index);
#endif