Skip to content

feat: store wolfboot version in named section - #966

Open
vhdirk wants to merge 1 commit into
wolfSSL:masterfrom
vhdirk:named-version-section
Open

vhdirk wants to merge 1 commit into
wolfSSL:masterfrom
vhdirk:named-version-section

Conversation

@vhdirk

@vhdirk vhdirk commented Nov 2, 2026

Copy link
Copy Markdown

We've been using wolfboot for quite some time. From what I can tell, way before WOLFBOOT_SELF_HEADER was introduced.
To query the bootloader version, we keep the version in a named linker section.
At some point we would like to migrate to using the self header, but we'll always need to support older bootloaders that do not have a self header as well.

Together with #958, this commit enables us to provide the section name externally, limiting the number of patches we have to carry forward

Copilot AI balanced review requested due to automatic review settings November 2, 2026 15:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical issues prevent custom version-section settings from reaching the compiler correctly and leave the section attribute undefined in update_flash.c, breaking standalone RAM_CODE builds.

2 open issues
What changed in this PR

This PR introduces configurable linker-section placement for the wolfBoot version number, supporting version queries on bootloaders without a self header. It complements #958’s custom linker-script support.

Changes:

  • Adds a configurable section attribute to the version declarations.
  • Introduces shared stringification helpers.
  • Adds build-flag handling for the section-name setting.
File Description
src/​update_flash.c Applies the section macro to the version declaration.
src/​loader.c Defines the section attribute and applies it to the version declaration.
include/​wolfboot/​wolfboot.h Adds two-level stringification helpers.
arch.mk Adds compiler-flag handling for the version-section option.

Review effort: Balanced

Comment thread arch.mk Outdated
Comment on lines +3364 to +3366
ifeq ($(WOLFBOOT_VERSION_SECTION),)
CFLAGS+=-DWOLFBOOT_VERSION_SECTION=$(WOLFBOOT_VERSION_SECTION)
endif
Comment thread src/update_flash.c
#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;
@vhdirk
vhdirk force-pushed the named-version-section branch from 060ec96 to e608555 Compare November 2, 2026 15:13
@dgarske

dgarske commented Nov 2, 2026

Copy link
Copy Markdown
Member

Okay to test. Company contributor agreement on file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants