Skip to content

Commit d7f6582

Browse files
authored
Declare platform.h functions with C linkage (earlephilhower#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.
1 parent 6c06f90 commit d7f6582

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/rp2040/pico_platform/include/pico/platform.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@
7777

7878
#ifndef __ASSEMBLER__
7979

80+
#ifdef __cplusplus
81+
extern "C" {
82+
#endif
83+
8084
/*! \brief No-op function for the body of tight loops
8185
* \ingroup pico_platform
8286
*
@@ -210,6 +214,10 @@ return a;
210214
(__builtin_popcount(b) >= 2 ? __mul_instruction(a,b) : (a)*(b)), \
211215
(a)*(b))
212216

217+
#ifdef __cplusplus
218+
}
219+
#endif
220+
213221
#endif // __ASSEMBLER__
214222

215223
#endif

src/rp2350/pico_platform/include/pico/platform.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070

7171
#ifndef __ASSEMBLER__
7272

73+
#ifdef __cplusplus
74+
extern "C" {
75+
#endif
76+
7377
/*! \brief No-op function for the body of tight loops
7478
* \ingroup pico_platform
7579
*
@@ -281,6 +285,10 @@ __force_inline static int32_t __mul_instruction(int32_t a, int32_t b) {
281285
(__builtin_popcount(b) >= 2 ? __mul_instruction(a,b) : (a)*(b)), \
282286
(a)*(b))
283287

288+
#ifdef __cplusplus
289+
}
290+
#endif
291+
284292
#endif // __ASSEMBLER__
285293

286294
#endif

0 commit comments

Comments
 (0)