mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
Merge branch 'feat/optimize_bootloader_size_v5.5' into 'release/v5.5'
change(bootloader): optimize bootloader size (v5.5) See merge request espressif/esp-idf!51598
This commit is contained in:
@@ -58,7 +58,7 @@ esp_err_t bootloader_check_bootloader_validity(void)
|
|||||||
unsigned int efuse_revision = efuse_hal_blk_version();
|
unsigned int efuse_revision = efuse_hal_blk_version();
|
||||||
unsigned int efuse_major_rev = efuse_revision / 100;
|
unsigned int efuse_major_rev = efuse_revision / 100;
|
||||||
unsigned int efuse_minor_rev = efuse_revision % 100;
|
unsigned int efuse_minor_rev = efuse_revision % 100;
|
||||||
ESP_EARLY_LOGI(TAG, "efuse block revision: v%d.%d", efuse_major_rev, efuse_minor_rev);
|
ESP_EARLY_LOGD(TAG, "efuse block revision: v%d.%d", efuse_major_rev, efuse_minor_rev);
|
||||||
#endif // !CONFIG_IDF_TARGET_ESP32
|
#endif // !CONFIG_IDF_TARGET_ESP32
|
||||||
/* compare with the one set in bootloader image header */
|
/* compare with the one set in bootloader image header */
|
||||||
if (bootloader_common_check_chip_validity(&bootloader_image_hdr, ESP_IMAGE_BOOTLOADER) != ESP_OK) {
|
if (bootloader_common_check_chip_validity(&bootloader_image_hdr, ESP_IMAGE_BOOTLOADER) != ESP_OK) {
|
||||||
@@ -101,7 +101,7 @@ void bootloader_config_wdt(void)
|
|||||||
|
|
||||||
void bootloader_enable_random(void)
|
void bootloader_enable_random(void)
|
||||||
{
|
{
|
||||||
ESP_EARLY_LOGI(TAG, "Enabling RNG early entropy source...");
|
ESP_EARLY_LOGD(TAG, "Enabling RNG early entropy source...");
|
||||||
bootloader_random_enable();
|
bootloader_random_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +120,6 @@ void bootloader_print_banner(void)
|
|||||||
ESP_EARLY_LOGW(TAG, "Unicore bootloader");
|
ESP_EARLY_LOGW(TAG, "Unicore bootloader");
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
ESP_EARLY_LOGI(TAG, "Multicore bootloader");
|
ESP_EARLY_LOGD(TAG, "Multicore bootloader");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -28,14 +28,11 @@ bootloader_sha256_handle_t bootloader_sha256_start()
|
|||||||
|
|
||||||
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len)
|
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len)
|
||||||
{
|
{
|
||||||
assert(handle != NULL);
|
|
||||||
ets_sha_update(&ctx, data, data_len, false);
|
ets_sha_update(&ctx, data, data_len, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest)
|
void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest)
|
||||||
{
|
{
|
||||||
assert(handle != NULL);
|
|
||||||
|
|
||||||
if (digest == NULL) {
|
if (digest == NULL) {
|
||||||
bzero(&ctx, sizeof(ctx));
|
bzero(&ctx, sizeof(ctx));
|
||||||
return;
|
return;
|
||||||
@@ -54,14 +51,11 @@ bootloader_sha_handle_t bootloader_sha512_start(bool is384)
|
|||||||
|
|
||||||
void bootloader_sha512_data(bootloader_sha_handle_t handle, const void *data, size_t data_len)
|
void bootloader_sha512_data(bootloader_sha_handle_t handle, const void *data, size_t data_len)
|
||||||
{
|
{
|
||||||
assert(handle != NULL);
|
|
||||||
ets_sha_update(&ctx, data, data_len, false);
|
ets_sha_update(&ctx, data, data_len, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bootloader_sha512_finish(bootloader_sha_handle_t handle, uint8_t *digest)
|
void bootloader_sha512_finish(bootloader_sha_handle_t handle, uint8_t *digest)
|
||||||
{
|
{
|
||||||
assert(handle != NULL);
|
|
||||||
|
|
||||||
if (digest == NULL) {
|
if (digest == NULL) {
|
||||||
bzero(&ctx, sizeof(ctx));
|
bzero(&ctx, sizeof(ctx));
|
||||||
return;
|
return;
|
||||||
@@ -91,7 +85,6 @@ bootloader_sha256_handle_t bootloader_sha256_start(void)
|
|||||||
|
|
||||||
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len)
|
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len)
|
||||||
{
|
{
|
||||||
assert(handle != NULL);
|
|
||||||
assert(data_len % 4 == 0);
|
assert(data_len % 4 == 0);
|
||||||
|
|
||||||
const uint32_t *w = (const uint32_t *)data;
|
const uint32_t *w = (const uint32_t *)data;
|
||||||
|
|||||||
@@ -268,7 +268,6 @@ bool bootloader_utility_load_partition_table(bootloader_state_t *bs)
|
|||||||
|
|
||||||
bootloader_munmap(partitions);
|
bootloader_munmap(partitions);
|
||||||
|
|
||||||
ESP_LOGI(TAG, "End of partition table");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,7 +787,7 @@ static void load_image(const esp_image_metadata_t *image_data)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Disabling RNG early entropy source...");
|
ESP_LOGD(TAG, "Disabling RNG early entropy source...");
|
||||||
bootloader_random_disable();
|
bootloader_random_disable();
|
||||||
|
|
||||||
/* Disable glitch reset after all the security checks are completed.
|
/* Disable glitch reset after all the security checks are completed.
|
||||||
|
|||||||
@@ -131,15 +131,15 @@ uint32_t esp_image_bootloader_offset_get(void)
|
|||||||
void esp_image_bootloader_offset_set(const uint32_t offset)
|
void esp_image_bootloader_offset_set(const uint32_t offset)
|
||||||
{
|
{
|
||||||
s_bootloader_partition_offset = offset;
|
s_bootloader_partition_offset = offset;
|
||||||
ESP_LOGI(TAG, "Bootloader offsets for PRIMARY: 0x%x, Secondary: 0x%" PRIx32, ESP_PRIMARY_BOOTLOADER_OFFSET, s_bootloader_partition_offset);
|
ESP_LOGD(TAG, "Bootloader offsets for PRIMARY: 0x%x, Secondary: 0x%" PRIx32, ESP_PRIMARY_BOOTLOADER_OFFSET, s_bootloader_partition_offset);
|
||||||
#if SOC_RECOVERY_BOOTLOADER_SUPPORTED
|
#if SOC_RECOVERY_BOOTLOADER_SUPPORTED
|
||||||
uint32_t recovery_offset = efuse_hal_get_recovery_bootloader_address();
|
uint32_t recovery_offset = efuse_hal_get_recovery_bootloader_address();
|
||||||
if (efuse_hal_recovery_bootloader_enabled()) {
|
if (efuse_hal_recovery_bootloader_enabled()) {
|
||||||
ESP_LOGI(TAG, "Bootloader offset for RECOVERY: 0x%" PRIx32, recovery_offset);
|
ESP_LOGD(TAG, "Bootloader offset for RECOVERY: 0x%" PRIx32, recovery_offset);
|
||||||
} else if (recovery_offset == 0) {
|
} else if (recovery_offset == 0) {
|
||||||
ESP_LOGI(TAG, "Bootloader offset for RECOVERY: has not been set yet");
|
ESP_LOGD(TAG, "Bootloader offset for RECOVERY: has not been set yet");
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGI(TAG, "Bootloader offset for RECOVERY: is disabled");
|
ESP_LOGD(TAG, "Bootloader offset for RECOVERY: is disabled");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||||
CONFIG_PARTITION_TABLE_OFFSET=0x9000
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG=y
|
||||||
|
CONFIG_PARTITION_TABLE_OFFSET=0x10000
|
||||||
Reference in New Issue
Block a user