Skip to content

Commit

Permalink
Declare platform.h functions with C linkage (#2218)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rhulme authored Feb 2, 2025
1 parent 6c06f90 commit d7f6582
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/rp2040/pico_platform/include/pico/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@

#ifndef __ASSEMBLER__

#ifdef __cplusplus
extern "C" {
#endif

/*! \brief No-op function for the body of tight loops
* \ingroup pico_platform
*
Expand Down Expand Up @@ -210,6 +214,10 @@ return a;
(__builtin_popcount(b) >= 2 ? __mul_instruction(a,b) : (a)*(b)), \
(a)*(b))

#ifdef __cplusplus
}
#endif

#endif // __ASSEMBLER__

#endif
8 changes: 8 additions & 0 deletions src/rp2350/pico_platform/include/pico/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@

#ifndef __ASSEMBLER__

#ifdef __cplusplus
extern "C" {
#endif

/*! \brief No-op function for the body of tight loops
* \ingroup pico_platform
*
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d7f6582

Please sign in to comment.