From d7f658245961bc9af7d9913b4d7fea437dab253a Mon Sep 17 00:00:00 2001 From: Richard Hulme Date: Sun, 2 Feb 2025 18:44:17 +0100 Subject: [PATCH] Declare platform.h functions with C linkage (#2218) The platform.h headers for both RP2040 and RP2350 need 'extern "C"' declarations when included from C++ code or 'rp2040_chip_version' and 'rp2350_chip_version' won't be found by the linker. --- src/rp2040/pico_platform/include/pico/platform.h | 8 ++++++++ src/rp2350/pico_platform/include/pico/platform.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/rp2040/pico_platform/include/pico/platform.h b/src/rp2040/pico_platform/include/pico/platform.h index 47aa119a7..5c157f532 100644 --- a/src/rp2040/pico_platform/include/pico/platform.h +++ b/src/rp2040/pico_platform/include/pico/platform.h @@ -77,6 +77,10 @@ #ifndef __ASSEMBLER__ +#ifdef __cplusplus +extern "C" { +#endif + /*! \brief No-op function for the body of tight loops * \ingroup pico_platform * @@ -210,6 +214,10 @@ return a; (__builtin_popcount(b) >= 2 ? __mul_instruction(a,b) : (a)*(b)), \ (a)*(b)) +#ifdef __cplusplus +} +#endif + #endif // __ASSEMBLER__ #endif diff --git a/src/rp2350/pico_platform/include/pico/platform.h b/src/rp2350/pico_platform/include/pico/platform.h index 24fec75bb..35a6a0bd6 100644 --- a/src/rp2350/pico_platform/include/pico/platform.h +++ b/src/rp2350/pico_platform/include/pico/platform.h @@ -70,6 +70,10 @@ #ifndef __ASSEMBLER__ +#ifdef __cplusplus +extern "C" { +#endif + /*! \brief No-op function for the body of tight loops * \ingroup pico_platform * @@ -281,6 +285,10 @@ __force_inline static int32_t __mul_instruction(int32_t a, int32_t b) { (__builtin_popcount(b) >= 2 ? __mul_instruction(a,b) : (a)*(b)), \ (a)*(b)) +#ifdef __cplusplus +} +#endif + #endif // __ASSEMBLER__ #endif