Merge branch 'feature/bootloader_add_extern_c' into 'master'

fix(bootloader_support): Add missing c linkage to some headers

Closes IDFGH-12930

See merge request espressif/esp-idf!31300
This commit is contained in:
Konstantin Kondrashov
2024-06-05 13:54:35 +08:00
8 changed files with 65 additions and 8 deletions

View File

@@ -11,6 +11,10 @@
// TODO: IDF-9197 // TODO: IDF-9197
#include "sdkconfig.h" #include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief ESP chip ID * @brief ESP chip ID
* *
@@ -120,3 +124,7 @@ typedef struct {
} esp_image_segment_header_t; } esp_image_segment_header_t;
#define ESP_IMAGE_MAX_SEGMENTS 16 /*!< Max count of segments in the image. */ #define ESP_IMAGE_MAX_SEGMENTS 16 /*!< Max count of segments in the image. */
#ifdef __cplusplus
}
#endif

View File

@@ -1,11 +1,15 @@
/* /*
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#pragma once #pragma once
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief Initialize console output (UART or USB) * @brief Initialize console output (UART or USB)
*/ */
@@ -21,3 +25,7 @@ void bootloader_console_deinit(void);
* Only defined if USB CDC is used for console output. * Only defined if USB CDC is used for console output.
*/ */
void bootloader_console_write_char_usb(char c); void bootloader_console_write_char_usb(char c);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -8,6 +8,10 @@
#include "esp_err.h" #include "esp_err.h"
#include "esp_image_format.h" #include "esp_image_format.h"
#ifdef __cplusplus
extern "C" {
#endif
/**@{*/ /**@{*/
/** /**
* @brief labels from bootloader linker script: bootloader.ld * @brief labels from bootloader linker script: bootloader.ld
@@ -49,3 +53,7 @@ void bootloader_print_banner(void);
* ESP_FAIL - If the setting is not successful. * ESP_FAIL - If the setting is not successful.
*/ */
esp_err_t bootloader_init(void); esp_err_t bootloader_init(void);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -16,6 +16,10 @@
#include <stdlib.h> #include <stdlib.h>
#include "esp_err.h" #include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void *bootloader_sha256_handle_t; typedef void *bootloader_sha256_handle_t;
bootloader_sha256_handle_t bootloader_sha256_start(void); bootloader_sha256_handle_t bootloader_sha256_start(void);
@@ -23,3 +27,7 @@ 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);
void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest); void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -29,6 +29,10 @@
#include "esp32c5/rom/secure_boot.h" #include "esp32c5/rom/secure_boot.h"
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
#if !CONFIG_IDF_TARGET_ESP32 || CONFIG_ESP32_REV_MIN_FULL >= 300 #if !CONFIG_IDF_TARGET_ESP32 || CONFIG_ESP32_REV_MIN_FULL >= 300
#if CONFIG_SECURE_BOOT_V2_ENABLED || CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT #if CONFIG_SECURE_BOOT_V2_ENABLED || CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT
@@ -47,3 +51,7 @@ esp_err_t esp_secure_boot_verify_rsa_signature_block(const ets_secure_boot_signa
#endif /* CONFIG_SECURE_BOOT_V2_ENABLED || CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT */ #endif /* CONFIG_SECURE_BOOT_V2_ENABLED || CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT */
#endif #endif
#ifdef __cplusplus
}
#endif

View File

@@ -1,10 +1,15 @@
/* /*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#pragma once #pragma once
#ifdef __cplusplus
extern "C"
{
#endif
/** /**
* @brief Configure analog super WDT reset * @brief Configure analog super WDT reset
* *
@@ -25,3 +30,7 @@ void bootloader_ana_bod_reset_config(bool enable);
* @param enable Boolean to enable or disable clock glitch reset * @param enable Boolean to enable or disable clock glitch reset
*/ */
void bootloader_ana_clock_glitch_reset_config(bool enable); void bootloader_ana_clock_glitch_reset_config(bool enable);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -9,6 +9,11 @@
#include "esp_image_format.h" #include "esp_image_format.h"
#include "bootloader_config.h" #include "bootloader_config.h"
#ifdef __cplusplus
extern "C"
{
#endif
/** /**
* @brief Load partition table. * @brief Load partition table.
* *
@@ -16,7 +21,7 @@
* OTA data partition, factory app partition, and test app partition. * OTA data partition, factory app partition, and test app partition.
* *
* @param[out] bs Bootloader state structure used to save read data. * @param[out] bs Bootloader state structure used to save read data.
* @return Return true if the partition table was succesfully loaded and MD5 checksum is valid. * @return Return true if the partition table was successfully loaded and MD5 checksum is valid.
*/ */
bool bootloader_utility_load_partition_table(bootloader_state_t* bs); bool bootloader_utility_load_partition_table(bootloader_state_t* bs);
@@ -120,3 +125,7 @@ void bootloader_debug_buffer(const void *buffer, size_t length, const char *labe
* @return ESP_OK if secure boot digest is generated successfully. * @return ESP_OK if secure boot digest is generated successfully.
*/ */
esp_err_t bootloader_sha256_flash_contents(uint32_t flash_offset, uint32_t len, uint8_t *digest); esp_err_t bootloader_sha256_flash_contents(uint32_t flash_offset, uint32_t len, uint8_t *digest);
#ifdef __cplusplus
}
#endif

View File

@@ -36,7 +36,6 @@ components/spi_flash/include/memspi_host_driver.h
components/spi_flash/include/spi_flash_chip_driver.h components/spi_flash/include/spi_flash_chip_driver.h
components/spi_flash/include/spi_flash_chip_generic.h components/spi_flash/include/spi_flash_chip_generic.h
components/bootloader_support/include/esp_app_format.h
components/wpa_supplicant/include/ components/wpa_supplicant/include/
components/wpa_supplicant/port/ components/wpa_supplicant/port/