-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boot/zephyr: Support for loading images from arbitrary flash slots
Instead of normal MCUboot flow, that checks flash slots to find update images, this patch enables an MCUboot application to chose from which available slots to load an image. This allows an application, for instance, to check hardware configuration at runtime (by checking hardware straps, state of GPIOs, etc) and decide from where to load an image to boot. MCUboot will basically loop through provided image sources (flash slots) and boot the first one that succed signature/validation. To provide the image sources, the application need to provide strong implementation for functions flash_map_id_get_next() and flash_map_id_get_current(). The default, weak, implementations just keep current behaviour for single loader, i.e. just load from FLASH_AREA_IMAGE_PRIMARY(0). Note that in this case, MCUboot won't try to record if image succeeded boot, it will only boot the image provided. Signed-off-by: Ederson de Souza <[email protected]>
- Loading branch information
1 parent
3850abc
commit e997c81
Showing
4 changed files
with
130 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef __FLASH_RUNTIME_SOURCES_H__ | ||
#define __FLASH_RUNTIME_SOURCES_H__ | ||
|
||
#include <inttypes.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* | ||
* Get next flash map id. | ||
* | ||
* Implement this function to get the next flash map id. The function should | ||
* return true if the flash map id was successfully updated. If the reset | ||
* parameter is true, the function should reset the flash map id to the first | ||
* one. | ||
* | ||
* @param id Pointer to the flash map id. | ||
* @param reset If true, the function will reset the flash map id to the first | ||
* one. | ||
* @retval true If the flash map id was successfully updated. | ||
*/ | ||
bool flash_map_id_get_next(uint8_t *id, bool reset); | ||
|
||
/* | ||
* Get current flash map id. | ||
* | ||
* Implement this function to get the current flash map id. The function should | ||
* return true if the flash map id was successfully read. | ||
* | ||
* @param id Pointer to the flash map id. | ||
* @retval true If the flash map id was successfully read. | ||
*/ | ||
bool flash_map_id_get_current(uint8_t *id); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __FLASH_RUNTIME_SOURCES_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters