Merge branch 'bugfix/bootloader_header_cxx_guards' into 'master'

bootloader_support: Add C++ header guards

See merge request idf/esp-idf!5349
This commit is contained in:
Ivan Grokhotkov 2019-06-27 19:31:56 +08:00
commit 1352ada4e0
7 changed files with 48 additions and 5 deletions

View file

@ -14,8 +14,16 @@
#pragma once #pragma once
#ifdef __cplusplus
extern "C" {
#endif
/** @brief Configure clocks for early boot /** @brief Configure clocks for early boot
* *
* Called by bootloader, or by the app if the bootloader version is old (pre v2.1). * Called by bootloader, or by the app if the bootloader version is old (pre v2.1).
*/ */
void bootloader_clock_configure(void); void bootloader_clock_configure(void);
#ifdef __cplusplus
}
#endif

View file

@ -16,6 +16,10 @@
#include "esp_flash_partitions.h" #include "esp_flash_partitions.h"
#include "esp_image_format.h" #include "esp_image_format.h"
#ifdef __cplusplus
extern "C" {
#endif
/// Type of hold a GPIO in low state /// Type of hold a GPIO in low state
typedef enum { typedef enum {
GPIO_LONG_HOLD = 1, /*!< The long hold GPIO */ 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. * @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(); void bootloader_common_vddsdio_configure();
#ifdef __cplusplus
}
#endif

View file

@ -16,6 +16,10 @@
#include <stddef.h> #include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief Enable early entropy source for RNG * @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 * @param length This many bytes of random data will be copied to buffer
*/ */
void bootloader_fill_random(void *buffer, size_t length); void bootloader_fill_random(void *buffer, size_t length);
#ifdef __cplusplus
}
#endif

View file

@ -16,6 +16,10 @@
#include <stddef.h> #include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief Check if half-open intervals overlap * @brief Check if half-open intervals overlap
* *
@ -33,3 +37,7 @@ static inline bool bootloader_util_regions_overlap(
assert(end2>start2); assert(end2>start2);
return (end1 > start2 && end2 > start1); return (end1 > start2 && end2 > start1);
} }
#ifdef __cplusplus
}
#endif

View file

@ -11,8 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#ifndef __ESP32_FLASH_ENCRYPT_H #pragma once
#define __ESP32_FLASH_ENCRYPT_H
#include <stdbool.h> #include <stdbool.h>
#include "esp_attr.h" #include "esp_attr.h"
@ -22,13 +21,17 @@
#endif #endif
#include "soc/efuse_periph.h" #include "soc/efuse_periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/* @brief Flash encryption mode based on efuse values /* @brief Flash encryption mode based on efuse values
*/ */
typedef enum { typedef enum {
ESP_FLASH_ENC_MODE_DISABLED, // flash encryption is not enabled (flash crypt cnt=0) 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_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_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 * @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 * is enabled but secure boot is not used. This should protect against
* serial re-flashing of an unauthorised code in absence of secure boot. * serial re-flashing of an unauthorised code in absence of secure boot.
* *
* @return
*/ */
void esp_flash_write_protect_crypt_cnt(); 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(); esp_flash_enc_mode_t esp_get_flash_encryption_mode();
#ifdef __cplusplus
}
#endif #endif

View file

@ -18,6 +18,10 @@
#include "esp_flash_partitions.h" #include "esp_flash_partitions.h"
#include "esp_app_format.h" #include "esp_app_format.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ESP_ERR_IMAGE_BASE 0x2000 #define ESP_ERR_IMAGE_BASE 0x2000
#define ESP_ERR_IMAGE_FLASH_FAIL (ESP_ERR_IMAGE_BASE + 1) #define ESP_ERR_IMAGE_FLASH_FAIL (ESP_ERR_IMAGE_BASE + 1)
#define ESP_ERR_IMAGE_INVALID (ESP_ERR_IMAGE_BASE + 2) #define ESP_ERR_IMAGE_INVALID (ESP_ERR_IMAGE_BASE + 2)
@ -158,3 +162,7 @@ typedef struct {
uint32_t irom_load_addr; uint32_t irom_load_addr;
uint32_t irom_size; uint32_t irom_size;
} esp_image_flash_mapping_t; } esp_image_flash_mapping_t;
#ifdef __cplusplus
}
#endif

View file

@ -131,7 +131,6 @@ typedef struct {
uint8_t digest[64]; uint8_t digest[64];
} esp_secure_boot_iv_digest_t; } esp_secure_boot_iv_digest_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif