Skip to content

[nrf noup] boot/bootutil/loader: image discovery by ih_load_address #461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nvlsianpu
Copy link
Contributor

Jakis Opis musi byc

ref.: NCSIDB-1173

@nvlsianpu nvlsianpu marked this pull request as draft July 2, 2025 15:49
@nvlsianpu nvlsianpu force-pushed the img_disc_by_load_addr branch 2 times, most recently from dda8a3b to db3fe90 Compare July 3, 2025 14:17
@nvlsianpu nvlsianpu requested a review from Copilot July 4, 2025 15:35
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a configuration option to use the image header’s load address for slot discovery instead of the reset handler address.

  • Introduce MCUBOOT_USE_CHECK_LOAD_ADDR Kconfig option and adjust dependencies for MCUBOOT_VERIFY_IMG_ADDRESS
  • Refactor boot_validate_slot and boot_validated_swap_type to read ih_load_addr when enabled
  • Define new IS_IN_RANGE_* macros for address range checks

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
boot/zephyr/Kconfig Add new config MCUBOOT_USE_CHECK_LOAD_ADDR and update dependencies
boot/bootutil/src/loader.c Conditional read of ih_load_addr, macro definitions, and slot validation updates
Comments suppressed due to low confidence (3)

boot/bootutil/src/loader.c:1264

  • Mismatched #ifdef/#else guards—this #else does not match the preceding #ifdef CONFIG_MCUBOOT_USE_CHECK_LOAD_ADDR correctly and will break compilation.
#else /* BOOT_USE_CHECK_LOAD_ADDR */

boot/bootutil/src/loader.c:1522

  • Extra closing parenthesis in macro definition leads to a syntax error; remove the surplus ) at the end.
#define IS_IN_RANGE_CPUNET_APP_ADDR(_addr) ((_addr) >= PM_CPUNET_APP_ADDRESS && (_addr) < PM_CPUNET_APP_END_ADDRESS))

boot/bootutil/src/loader.c:1595

  • The IS_IN_RANGE_S_VARIANT_ADDR macro expects two parameters but is invoked with one; use IS_IN_RANGE_S_ALTERNATE_ADDR or IS_IN_RANGE_S_CURRENT_ADDR instead.
            if (IS_IN_RANGE_S_VARIANT_ADDR(internal_img_addr)) {

Comment on lines +1200 to +1203
If y, the bootloader will use the load address form image header
for checking to which slot image belongs instead of usage of reset
handler addres reading form the image.
Copy link
Preview

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

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

[nitpick] Typo in help text: replace “form image header” with “from image header” and correct “addres” to “address”.

Suggested change
If y, the bootloader will use the load address form image header
for checking to which slot image belongs instead of usage of reset
handler addres reading form the image.
If y, the bootloader will use the load address from image header
for checking to which slot image belongs instead of usage of reset
handler address reading from the image.

Copilot uses AI. Check for mistakes.

Jakis Opis musi byc

ref.: NCSIDB-1173

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
@nvlsianpu nvlsianpu force-pushed the img_disc_by_load_addr branch from db3fe90 to 2fb0029 Compare July 7, 2025 12:49
Copy link

sonarqubecloud bot commented Jul 7, 2025

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.

1 participant