-
Notifications
You must be signed in to change notification settings - Fork 236
Zephyr: introduce bootloader requests #477
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
*/ | ||
|
||
#ifndef __BOOT_REQUEST_H__ | ||
#define __BOOT_REQUEST_H__ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
/** Special value, indicating that there is no preferred slot. */ | ||
#define BOOT_REQUEST_NO_PREFERRED_SLOT UINT32_MAX | ||
|
||
/** | ||
* @brief Request a bootloader to confirm the specified slot of an image. | ||
* | ||
* @param[in] image Image number. | ||
* @param[in] slot Slot number. | ||
* | ||
* @return 0 if requested, negative error code otherwise. | ||
*/ | ||
int boot_request_confirm_slot(uint8_t image, uint32_t slot); | ||
|
||
/** | ||
* @brief Request a bootloader to boot the specified slot of an image. | ||
* | ||
* @param[in] image Image number. | ||
* @param[in] slot Slot number. | ||
* | ||
* @return 0 if requested, negative error code otherwise. | ||
*/ | ||
int boot_request_set_preferred_slot(uint8_t image, uint32_t slot); | ||
|
||
/** | ||
* @brief Request a bootloader to boot recovery image. | ||
* | ||
* @return 0 if requested, negative error code otherwise. | ||
*/ | ||
int boot_request_enter_recovery(void); | ||
|
||
/** | ||
* @brief Request a bootloader to boot firmware loader image. | ||
* | ||
* @return 0 if requested, negative error code otherwise. | ||
*/ | ||
int boot_request_enter_firmware_loader(void); | ||
|
||
/** | ||
* @brief Check if there is a request to confirm the specified slot of an image. | ||
* | ||
* @param[in] image Image number. | ||
* @param[in] slot Slot number. | ||
* | ||
* @return true if requested, false otherwise. | ||
*/ | ||
bool boot_request_check_confirmed_slot(uint8_t image, uint32_t slot); | ||
|
||
/** | ||
* @brief Find if there is a request to boot certain slot of the specified image. | ||
* | ||
* @param[in] image Image number. | ||
* | ||
* @return slot number if requested, BOOT_REQUEST_NO_PREFERRED_SLOT otherwise. | ||
*/ | ||
uint32_t boot_request_get_preferred_slot(uint8_t image); | ||
|
||
/** | ||
* @brief Check if there is a request to boot recovery image. | ||
* | ||
* @return true if requested, false otherwise. | ||
*/ | ||
bool boot_request_detect_recovery(void); | ||
|
||
/** | ||
* @brief Check if there is a request to boot firmware loader image. | ||
* | ||
* @return true if requested, false otherwise. | ||
*/ | ||
bool boot_request_detect_firmware_loader(void); | ||
Comment on lines
+73
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as above |
||
|
||
/** | ||
* @brief Initialize boot requests module. | ||
* | ||
* @return 0 if successful, negative error code otherwise. | ||
*/ | ||
int boot_request_init(void); | ||
|
||
/** | ||
* @brief Clear/drop all requests. | ||
* | ||
* @return 0 if successful, negative error code otherwise. | ||
*/ | ||
int boot_request_clear(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __BOOT_REQUEST_H__ */ |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just wonder whether flash_area_to_image() -> flash_area_to_image() can more associated with a upstream patch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yet I do not have an argument, why this change is needed there... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can both be combined into
boot_request_enter_recovery
there is either serial recovery or firmware loader, not bothThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not really like to enter firmware loader by calling
boot_request_enter_recovery
API.