From 416e8ce8e6415e99fc5522a61a0b35b2482ed7fa Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Thu, 16 Jan 2020 13:03:49 +0100 Subject: [PATCH] cpu/esp32: fix C linkage compilatio error With the new toolchain version required to fix issue #13133, the compilation of `examples/posix_socket` fails due to a C linkage error in `atomic_base.h`. The reason is that including `drivers/include/mtd.h` in `boards/esp32/board_common.h` inside the `extern C` block finally leads to including `atomic_base.h` inside the `extern C` block which in turn to the C linkage error for the template definitions in this file. --- boards/common/esp32/include/board_common.h | 7 +++++-- cpu/esp32/include/sdk_conf.h | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/boards/common/esp32/include/board_common.h b/boards/common/esp32/include/board_common.h index 3b5143eb5961..a81ffd7c2f03 100644 --- a/boards/common/esp32/include/board_common.h +++ b/boards/common/esp32/include/board_common.h @@ -35,8 +35,12 @@ #include "periph/gpio.h" #include "sdk_conf.h" +#if MODULE_MTD +#include "mtd.h" +#endif + #ifdef __cplusplus - extern "C" { +extern "C" { #endif /** @@ -103,7 +107,6 @@ * Built-in SPI flash memory is used as MTD system drive. * @{ */ -#include "mtd.h" /** * @brief MTD drive start address in SPI flash memory diff --git a/cpu/esp32/include/sdk_conf.h b/cpu/esp32/include/sdk_conf.h index 2e5fecbb3e19..5f417be778cc 100644 --- a/cpu/esp32/include/sdk_conf.h +++ b/cpu/esp32/include/sdk_conf.h @@ -24,12 +24,12 @@ #ifndef DOXYGEN +#include "board.h" + #ifdef __cplusplus extern "C" { #endif -#include "board.h" - /** * @brief Defines the CPU frequency [values = 2, 40, 80, 160 and 240] */