From c8570ffa6d9177cb3c94cbf3b99d62bf531f4e25 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 26 Jun 2019 11:02:15 +1000 Subject: [PATCH] bootloader_support: Add C++ header guards As reported on forum https://esp32.com/viewtopic.php?f=13&t=11173&p=45470 --- .../bootloader_support/include/bootloader_clock.h | 8 ++++++++ .../bootloader_support/include/bootloader_common.h | 8 ++++++++ .../bootloader_support/include/bootloader_random.h | 8 ++++++++ .../bootloader_support/include/bootloader_util.h | 8 ++++++++ .../bootloader_support/include/esp_flash_encrypt.h | 12 ++++++++---- .../bootloader_support/include/esp_image_format.h | 8 ++++++++ .../bootloader_support/include/esp_secure_boot.h | 1 - 7 files changed, 48 insertions(+), 5 deletions(-) diff --git a/components/bootloader_support/include/bootloader_clock.h b/components/bootloader_support/include/bootloader_clock.h index 9eaba46a8..b07d7c982 100644 --- a/components/bootloader_support/include/bootloader_clock.h +++ b/components/bootloader_support/include/bootloader_clock.h @@ -14,8 +14,16 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + /** @brief Configure clocks for early boot * * Called by bootloader, or by the app if the bootloader version is old (pre v2.1). */ void bootloader_clock_configure(void); + +#ifdef __cplusplus +} +#endif diff --git a/components/bootloader_support/include/bootloader_common.h b/components/bootloader_support/include/bootloader_common.h index eb5864125..2475d842a 100644 --- a/components/bootloader_support/include/bootloader_common.h +++ b/components/bootloader_support/include/bootloader_common.h @@ -16,6 +16,10 @@ #include "esp_flash_partitions.h" #include "esp_image_format.h" +#ifdef __cplusplus +extern "C" { +#endif + /// Type of hold a GPIO in low state typedef enum { GPIO_LONG_HOLD = 1, /*!< The long hold GPIO */ @@ -141,3 +145,7 @@ esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t * @brief Configure VDDSDIO, call this API to rise VDDSDIO to 1.9V when VDDSDIO regulator is enabled as 1.8V mode. */ void bootloader_common_vddsdio_configure(); + +#ifdef __cplusplus +} +#endif diff --git a/components/bootloader_support/include/bootloader_random.h b/components/bootloader_support/include/bootloader_random.h index bb3b2a81d..98a7712f3 100644 --- a/components/bootloader_support/include/bootloader_random.h +++ b/components/bootloader_support/include/bootloader_random.h @@ -16,6 +16,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Enable early entropy source for RNG * @@ -47,3 +51,7 @@ void bootloader_random_disable(void); * @param length This many bytes of random data will be copied to buffer */ void bootloader_fill_random(void *buffer, size_t length); + +#ifdef __cplusplus +} +#endif diff --git a/components/bootloader_support/include/bootloader_util.h b/components/bootloader_support/include/bootloader_util.h index 500498d39..a1b8d89c9 100644 --- a/components/bootloader_support/include/bootloader_util.h +++ b/components/bootloader_support/include/bootloader_util.h @@ -16,6 +16,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Check if half-open intervals overlap * @@ -33,3 +37,7 @@ static inline bool bootloader_util_regions_overlap( assert(end2>start2); return (end1 > start2 && end2 > start1); } + +#ifdef __cplusplus +} +#endif diff --git a/components/bootloader_support/include/esp_flash_encrypt.h b/components/bootloader_support/include/esp_flash_encrypt.h index 448f54a4c..c0de5ca17 100644 --- a/components/bootloader_support/include/esp_flash_encrypt.h +++ b/components/bootloader_support/include/esp_flash_encrypt.h @@ -11,8 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef __ESP32_FLASH_ENCRYPT_H -#define __ESP32_FLASH_ENCRYPT_H +#pragma once #include #include "esp_attr.h" @@ -22,13 +21,17 @@ #endif #include "soc/efuse_periph.h" +#ifdef __cplusplus +extern "C" { +#endif + /* @brief Flash encryption mode based on efuse values */ typedef enum { ESP_FLASH_ENC_MODE_DISABLED, // flash encryption is not enabled (flash crypt cnt=0) ESP_FLASH_ENC_MODE_DEVELOPMENT, // flash encryption is enabled but for Development (reflash over UART allowed) ESP_FLASH_ENC_MODE_RELEASE // flash encryption is enabled for Release (reflash over UART disabled) -}esp_flash_enc_mode_t; +} esp_flash_enc_mode_t; /** * @file esp_partition.h @@ -118,7 +121,6 @@ esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length); * is enabled but secure boot is not used. This should protect against * serial re-flashing of an unauthorised code in absence of secure boot. * - * @return */ void esp_flash_write_protect_crypt_cnt(); @@ -131,4 +133,6 @@ void esp_flash_write_protect_crypt_cnt(); */ esp_flash_enc_mode_t esp_get_flash_encryption_mode(); +#ifdef __cplusplus +} #endif diff --git a/components/bootloader_support/include/esp_image_format.h b/components/bootloader_support/include/esp_image_format.h index b66b66f5f..d0a9469d6 100644 --- a/components/bootloader_support/include/esp_image_format.h +++ b/components/bootloader_support/include/esp_image_format.h @@ -18,6 +18,10 @@ #include "esp_flash_partitions.h" #include "esp_app_format.h" +#ifdef __cplusplus +extern "C" { +#endif + #define ESP_ERR_IMAGE_BASE 0x2000 #define ESP_ERR_IMAGE_FLASH_FAIL (ESP_ERR_IMAGE_BASE + 1) #define ESP_ERR_IMAGE_INVALID (ESP_ERR_IMAGE_BASE + 2) @@ -158,3 +162,7 @@ typedef struct { uint32_t irom_load_addr; uint32_t irom_size; } esp_image_flash_mapping_t; + +#ifdef __cplusplus +} +#endif diff --git a/components/bootloader_support/include/esp_secure_boot.h b/components/bootloader_support/include/esp_secure_boot.h index 299c4959d..2a7c22750 100644 --- a/components/bootloader_support/include/esp_secure_boot.h +++ b/components/bootloader_support/include/esp_secure_boot.h @@ -131,7 +131,6 @@ typedef struct { uint8_t digest[64]; } esp_secure_boot_iv_digest_t; - #ifdef __cplusplus } #endif