Skip to content

Commit ed64163

Browse files
committed
Fix issue due to min/max not being avaliable for older builds in CI
1 parent 7a5809b commit ed64163

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

zephyr/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ if(CONFIG_WOLFSSL)
186186

187187
target_compile_definitions(wolfSSL INTERFACE WOLFSSL_ZEPHYR)
188188
target_compile_definitions(wolfSSL INTERFACE WOLFSSL_USER_SETTINGS)
189+
190+
# Zephyr >= 4.1 provides min()/max() macros in sys/util.h that collide
191+
# with wolfSSL's static inline definitions in misc.c
192+
if(KERNEL_VERSION_MAJOR GREATER_EQUAL 5 OR
193+
(KERNEL_VERSION_MAJOR EQUAL 4 AND KERNEL_VERSION_MINOR GREATER_EQUAL 1))
194+
target_compile_definitions(wolfSSL INTERFACE WOLFSSL_HAVE_MIN_MAX)
195+
endif()
189196
if(CONFIG_WOLFSSL_DEBUG)
190197
target_compile_definitions(wolfSSL INTERFACE DEBUG_WOLFSSL)
191198
zephyr_library_compile_options(-g3 -O0)

zephyr/user_settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ extern "C" {
4040
/* ------------------------------------------------------------------------- */
4141
/* Platform */
4242
/* ------------------------------------------------------------------------- */
43+
#ifdef WOLFSSL_HAVE_MIN_MAX
4344
#define WOLFSSL_HAVE_MIN /* Zephyr provides min() in sys/util.h */
4445
#define WOLFSSL_HAVE_MAX /* Zephyr provides max() in sys/util.h */
46+
#endif
4547
#define WOLFSSL_GENERAL_ALIGNMENT 4 /* platform requires 32-bit alignment on uint32_t */
4648
#define SIZEOF_LONG_LONG 8 /* long long is 8 bytes / 64-bit */
4749
//#define WOLFSSL_NO_ASM /* optionally disable inline assembly support */

0 commit comments

Comments
 (0)