-
Notifications
You must be signed in to change notification settings - Fork 648
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
Replace flash partitioning terminology #440
Conversation
#define BOOT_STATUS_SOURCE_PRIMARY_SLOT 2 | ||
|
||
#define BOOT_FLAG_IMAGE_OK 0 | ||
#define BOOT_FLAG_COPY_DONE 1 | ||
|
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.
To pass Mynewt CI, please add the following at this line:
#if defined(MCUBOOT_MYNEWT)
#define FLASH_AREA_IMAGE_PRIMARY FLASH_AREA_IMAGE_0
#define FLASH_AREA_IMAGE_SECONDARY FLASH_AREA_IMAGE_1
#endif
newt
auto-generates the FLASH_AREA_IMAGE_[0|1]
symbols from bsp.yml
and this adds a compatibility definition.
@@ -305,7 +305,7 @@ boot_enc_load(const struct image_header *hdr, const struct flash_area *fap, | |||
int | |||
boot_enc_valid(const struct flash_area *fap) | |||
{ | |||
return enc_state[fap->fa_id - FLASH_AREA_IMAGE_0].valid; |
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.
This PR makes me aware of that this mathematics might be not compatible with zephyr flash_area numeration.
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.
I think it would be much better to pass the slot number instead of the flash area.
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.
If the values are not sequential for Zephyr, maybe it would be better to change it to something like:
int
boot_enc_valid(const struct flash_area *fap)
{
switch (fap->fa_id) {
case FLASH_AREA_IMAGE_0:
return enc_state[0].valid;
case FLASH_AREA_IMAGE_1:
return enc_state[1].valid;
default:
assert(0);
return 0;
}
}
But on another PR please!
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.
Also checking that other enc_state
accesses do not use the same math.
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.
will prepare the patch
boot/bootutil/src/loader.c
Outdated
} | ||
|
||
#ifdef MCUBOOT_VALIDATE_SLOT0 | ||
rc = boot_validate_slot(0, NULL); | ||
#ifdef mcuboot_validate_primary_slot |
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.
MCUBOOT_VALIDATE_PRIMARY_SLOT
@d3zd3z Fix the two issues I mentioned above and it should be OK, tested here, looks good. |
@@ -72,37 +72,37 @@ config MBEDTLS_CFG_FILE | |||
default "mcuboot-mbedtls-cfg.h" | |||
|
|||
config BOOT_VALIDATE_SLOT0 |
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.
I would change this keyword as well. It produces #define CONFIG_BOOT_VALIDATE_SLOT0 1
currently.
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.
mcuboot_config.h
is checking for this define as is here to avoid breaking compatibility with previous custom configurations, so I don't think it needs to be changed for now.
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.
"Previous custom configuration" - do you mena proj.conf file in this repository or end-user configuration?
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.
If someone made CONFIG_BOOT_VALIDATE_SLOT0=n
in a custom config
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.
ok - can live with this
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.
Or maybe we can keep backward compatibility:
config BOOT_VALIDATE_SLOT0 | |
config BOOT_VALIDATE_SLOT0 | |
# Hidden selector for backward compatibility | |
# deprecated | |
bool | |
select BOOT_VALIDATE_PRIMARY_SLOT | |
config BOOT_VALIDATE_PRIMARY_SLOT |
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.
Are we happy with it as it is now?
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.
I am
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.
But it's a nice suggestion from @nvlsianpu...
This change replaces the slot 0/1 terminology with primary/secondary slot and replaces FLASH_AREA_IMAGE_0/1 with FLASH_AREA_IMAGE_PRIMARY/SECONDARY. This naming convention may be more understandable, fits better to MCUs with multiple images and it is an architecture agnostic alternative as well. Change-Id: I655a585f6ae023852c671ee6635399efe25209c9 Signed-off-by: David Vincze <david.vincze@arm.com> Signed-off-by: David Brown <david.brown@linaro.org>
Changed image terminology to the same which is used by mcuboot after mcu-tools/mcuboot#440 Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Changed image terminology to the same which is used by mcuboot after mcu-tools/mcuboot#440 Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Changed image terminology to the same which is used by mcuboot after mcu-tools/mcuboot#440 Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Changed image terminology to the same which is used by mcuboot after mcu-tools/mcuboot#440 Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This change replaces the slot 0/1 terminology with primary/secondary
slot and replaces FLASH_AREA_IMAGE_0/1 with
FLASH_AREA_IMAGE_PRIMARY/SECONDARY. This naming convention may be more
understandable, fits better to MCUs with multiple images and it is an
architecture agnostic alternative as well.
Change-Id: I655a585f6ae023852c671ee6635399efe25209c9
Signed-off-by: David Vincze david.vincze@arm.com
Signed-off-by: David Brown david.brown@linaro.org