]> granicus.if.org Git - esp-idf/commitdiff
lwip: Remove port-specific sys_arch_assert(), use libc __assert_func() instead
authorAngus Gratton <angus@espressif.com>
Tue, 27 Jun 2017 07:29:13 +0000 (17:29 +1000)
committerAngus Gratton <gus@projectgus.com>
Tue, 27 Jun 2017 07:32:17 +0000 (17:32 +1000)
components/lwip/include/lwip/port/arch/cc.h
components/lwip/include/lwip/port/arch/sys_arch.h
components/lwip/port/freertos/sys_arch.c

index 3213c66671174b923a82df3a54b518a5a932fe85..2b182d641091493f89e6d92faf1a3701048dc114 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <stdint.h>
 #include <errno.h>
+#include <assert.h>
 
 #include "arch/sys_arch.h"
 
@@ -67,7 +68,8 @@ typedef int sys_prot_t;
 #include <stdio.h>
 
 #define LWIP_PLATFORM_DIAG(x)   do {printf x;} while(0)
-#define LWIP_PLATFORM_ASSERT(x) do {printf(x); sys_arch_assert(__FILE__, __LINE__);} while(0)
+// __assert_func is the assertion failure handler from newlib, defined in assert.h
+#define LWIP_PLATFORM_ASSERT(message) __assert_func(__FILE__, __LINE__, __ASSERT_FUNC, message)
 
 #ifdef NDEBUG
 #define LWIP_NOASSERT
index a86334825696022cb3ffb8894fbdada1a3394743..8d30ef171dc450cf02a2d8cc620a521badc0ac0a 100644 (file)
@@ -67,7 +67,6 @@ typedef struct sys_mbox_s {
 #define sys_sem_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )\r
 #define sys_sem_set_invalid( x ) ( ( *x ) = NULL )\r
 \r
-void sys_arch_assert(const char *file, int line);\r
 uint32_t system_get_time(void);
 void sys_delay_ms(uint32_t ms);
 sys_sem_t* sys_thread_sem_init(void);
index b03fd6df5d14d52800dc8dc1dc3c9b3730892be7..63d0ccece4b1f19e6b04badb9c4b6c234270b868 100755 (executable)
@@ -482,19 +482,6 @@ sys_arch_unprotect(sys_prot_t pval)
   sys_mutex_unlock(&g_lwip_protect_mutex);
 }
 
-/*-----------------------------------------------------------------------------------*/
-/*
- * Prints an assertion messages and aborts execution.
- */
-void
-sys_arch_assert(const char *file, int line)
-{
-  ESP_LOGE(TAG, "\nAssertion: %d in %s\n", line, file);
-
-//  vTaskEnterCritical();
-  while(1);
-}
-
 #define SYS_TLS_INDEX CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX
 /* 
  * get per thread semphore