feat: store wolfboot version in named section

pull/966/head
Dirk Van Haerenborgh 2026-11-02 15:54:26 +01:00
parent 80a186f5c5
commit e608555ff9
No known key found for this signature in database
GPG Key ID: 6FB213CA3E44EEC6
4 changed files with 17 additions and 2 deletions

View File

@ -3361,5 +3361,9 @@ ifeq ($(BIG_ENDIAN),1)
CFLAGS+=-D"BIG_ENDIAN_ORDER"
endif
ifneq ($(WOLFBOOT_VERSION_SECTION),)
CFLAGS+=-DVERSION_SECTION=$(WOLFBOOT_VERSION_SECTION)
endif
CFLAGS+=-DWOLFBOOT_ARCH_$(ARCH)
CFLAGS+=-DTARGET_$(TARGET)

View File

@ -113,6 +113,16 @@ extern "C" {
# endif
#endif
#ifndef WB_STRINGIFY
#define _WB_STRINGIFY_L2(str) #str
#define WB_STRINGIFY(str) _WB_STRINGIFY_L2(str)
#endif
#if defined(VERSION_SECTION)
#define WOLFBOOT_VERSION_SECTION __attribute__((section(WB_STRINGIFY(VERSION_SECTION))))
#else
#define WOLFBOOT_VERSION_SECTION
#endif
/* Helpers for memory alignment */
#ifndef XALIGNED

View File

@ -51,7 +51,7 @@ extern unsigned int _start_text;
/**
* @brief wolfBoot version number (used in RAM code).
*/
static volatile const uint32_t __attribute__((used)) wolfboot_version = WOLFBOOT_VERSION;
static volatile const uint32_t __attribute__((used)) WOLFBOOT_VERSION_SECTION wolfboot_version = WOLFBOOT_VERSION;
/**
* @brief RAM Interrupt Vector table.
*/

View File

@ -126,7 +126,8 @@ extern unsigned int _start_text;
extern unsigned int __logical_binary_start;
unsigned int _start_text = (unsigned int)&__logical_binary_start;
#endif
static volatile const uint32_t __attribute__((used)) wolfboot_version = WOLFBOOT_VERSION;
static volatile const uint32_t __attribute__((used)) WOLFBOOT_VERSION_SECTION wolfboot_version = WOLFBOOT_VERSION;
#ifdef EXT_FLASH
# ifndef BUFFER_DECLARED