Skip to content

Conversation

@tomchy
Copy link
Collaborator

@tomchy tomchy commented Oct 20, 2025

Reduce the size of loader.c as well as bootutil_misc.c files by extracting common functions into a separate files.

@tomchy tomchy force-pushed the feature/bootutil/NCSDK-NONE_Rework_common_modules branch 12 times, most recently from 0f0d586 to b1509d1 Compare October 20, 2025 17:32
@tomchy tomchy marked this pull request as ready for review October 21, 2025 06:11
@tomchy tomchy marked this pull request as draft October 21, 2025 08:01
@tomchy tomchy force-pushed the feature/bootutil/NCSDK-NONE_Rework_common_modules branch from b1509d1 to 57054e9 Compare October 21, 2025 10:00
@tomchy tomchy force-pushed the feature/bootutil/NCSDK-NONE_Rework_common_modules branch from 57054e9 to 46b5f9d Compare October 21, 2025 12:07
@tomchy tomchy marked this pull request as ready for review October 21, 2025 12:16
@tomchy tomchy requested a review from de-nordic October 21, 2025 12:16
Rename boot_version_cmp(..) to boot_compare_version(..).
Reason: most of the boot APIs use verb as the second part of the
function name.

Signed-off-by: Tomasz Chyrowicz <[email protected]>
The boot_check_header_erased(..) function may use a common function to
check for a buffer value (bootutil_buffer_is_erased).
Checking function should return bool intead of int.

Signed-off-by: Tomasz Chyrowicz <[email protected]>
Rename boot_is_header_valid(..) to boot_check_header_valid(..).
The fap and hdr arguments are misleading - they should always point to
the same slot. Change the function signature to use slot number instead.

Signed-off-by: Tomasz Chyrowicz <[email protected]>
Rename boot_image_check(..) to boot_check_image(..). Most of boot APIs
use verb as the second part of the function name.
The fap and hdr arguments are misleading - they should always point to
the same slot. Change the function signature to use slot number instead.

Signed-off-by: Tomasz Chyrowicz <[email protected]>
Add missing API docs for the following functions:
 - boot_get_loader_state()
 - boot_get_image_max_sizes()
 - image_max_size *boot_get_max_app_size()
Restrict visibility of the app_size* APIs, based on the configuration.

Signed-off-by: Tomasz Chyrowicz <[email protected]>
Move functions, that operate on the flash area and does not require the
bootloader state or bootloader status into a separate, dedicated file.

Signed-off-by: Tomasz Chyrowicz <[email protected]>
Move the boot_get_max_app_size(..) API into bootutil_misc.c as this file
has the remaining functions, that operate on the size array
(i.e. boot_fetch_slot_state_sizes(..)) and is independent from the
update type, thus moving it will reduce the code duplication in the
future.

Signed-off-by: Tomasz Chyrowicz <[email protected]>
Move functions from loader.c that are independent from the update type
into a dedicated file. That way it will be easier to provide alternative
loader type without massive code duplication.
This file is intended to be used by loader-like files instead and should
not be included in the bootutil/_priv.h headers.

Signed-off-by: Tomasz Chyrowicz <[email protected]>
@tomchy tomchy force-pushed the feature/bootutil/NCSDK-NONE_Rework_common_modules branch from 46b5f9d to 1b4be75 Compare October 23, 2025 12:07
@de-nordic de-nordic merged commit 56538cf into mcu-tools:main Oct 23, 2025
65 checks passed
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