From 16ab2b21baae91d52b0b63378945403005ef470d Mon Sep 17 00:00:00 2001 From: James Peach Date: Fri, 21 Oct 2022 14:57:21 +0100 Subject: [PATCH] Remove incorrect override for LWIP_PLATFORM_ASSERT (#1064) * Remove incorrect override for LWIP_PLATFORM_ASSERT LWIP_PLATFORM_ASSERT macro is used by lwip driver implementations to specify the behavior of the assertions in lwip code. The previous override of this macro incorrectly assumed that the parameter to the function macro was the condition to check. However this is incorrect. The parameter is actually a message string defining what failed. This mistake caused all assertions to be ignored. ( and myself to loose many hours of debugging time ) By removing this, we restore the default behavior specified by lwip which is to use `printf` to log the message. * I think i prefer to use panic (which doesn't pull in fflush etc) Co-authored-by: Graham Sanderson --- src/rp2_common/pico_lwip/include/arch/cc.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rp2_common/pico_lwip/include/arch/cc.h b/src/rp2_common/pico_lwip/include/arch/cc.h index 447e4d2..8194dcb 100644 --- a/src/rp2_common/pico_lwip/include/arch/cc.h +++ b/src/rp2_common/pico_lwip/include/arch/cc.h @@ -69,7 +69,10 @@ typedef int sys_prot_t; #endif -#define LWIP_PLATFORM_ASSERT(x) do { if(!(x)) while(1); } while(0) +#ifndef LWIP_PLATFORM_ASSERT +void panic(const char *fmt, ...); +#define LWIP_PLATFORM_ASSERT(x) panic(x) +#endif unsigned int pico_lwip_rand(void); #ifndef LWIP_RAND