mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
Merge branch 'bugfix/silent_asserts_v4.3' into 'release/v4.3'
freertos/lw ip: Support silent assertions (v4.3) See merge request espressif/esp-idf!13011
This commit is contained in:
@@ -28,10 +28,11 @@ set(COMPONENTS
|
|||||||
micro-ecc
|
micro-ecc
|
||||||
main
|
main
|
||||||
efuse
|
efuse
|
||||||
esp_system)
|
esp_system
|
||||||
|
newlib)
|
||||||
set(BOOTLOADER_BUILD 1)
|
set(BOOTLOADER_BUILD 1)
|
||||||
include("${IDF_PATH}/tools/cmake/project.cmake")
|
include("${IDF_PATH}/tools/cmake/project.cmake")
|
||||||
set(common_req log esp_rom esp_common esp_hw_support hal)
|
set(common_req log esp_rom esp_common esp_hw_support hal newlib)
|
||||||
if(LEGACY_INCLUDE_COMMON_HEADERS)
|
if(LEGACY_INCLUDE_COMMON_HEADERS)
|
||||||
list(APPEND common_req soc hal)
|
list(APPEND common_req soc hal)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -141,18 +141,25 @@ menu "FreeRTOS"
|
|||||||
|
|
||||||
choice FREERTOS_ASSERT
|
choice FREERTOS_ASSERT
|
||||||
prompt "FreeRTOS assertions"
|
prompt "FreeRTOS assertions"
|
||||||
default FREERTOS_ASSERT_FAIL_ABORT
|
default FREERTOS_ASSERT_FAIL_ABORT if !COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
|
||||||
|
default FREERTOS_ASSERT_DISABLE if COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
|
||||||
help
|
help
|
||||||
Failed FreeRTOS configASSERT() assertions can be configured to
|
Failed FreeRTOS configASSERT() assertions can be configured to
|
||||||
behave in different ways.
|
behave in different ways.
|
||||||
|
|
||||||
|
By default these behave the same as the global project assert settings.
|
||||||
|
|
||||||
config FREERTOS_ASSERT_FAIL_ABORT
|
config FREERTOS_ASSERT_FAIL_ABORT
|
||||||
bool "abort() on failed assertions"
|
bool "abort() on failed assertions"
|
||||||
|
depends on !COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
|
||||||
help
|
help
|
||||||
If a FreeRTOS configASSERT() fails, FreeRTOS will abort() and
|
If a FreeRTOS configASSERT() fails, FreeRTOS will abort() and
|
||||||
halt execution. The panic handler can be configured to handle
|
halt execution. The panic handler can be configured to handle
|
||||||
the outcome of an abort() in different ways.
|
the outcome of an abort() in different ways.
|
||||||
|
|
||||||
|
If assertions are disabled for the entire project, they are also
|
||||||
|
disabled in FreeRTOS and this option is unavailable.
|
||||||
|
|
||||||
config FREERTOS_ASSERT_FAIL_PRINT_CONTINUE
|
config FREERTOS_ASSERT_FAIL_PRINT_CONTINUE
|
||||||
bool "Print and continue failed assertions"
|
bool "Print and continue failed assertions"
|
||||||
help
|
help
|
||||||
|
@@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
/* configASSERT behaviour */
|
/* configASSERT behaviour */
|
||||||
#ifndef __ASSEMBLER__
|
#ifndef __ASSEMBLER__
|
||||||
#include <stdlib.h> /* for abort() */
|
#include <assert.h>
|
||||||
#include "esp32c3/rom/ets_sys.h"
|
#include "esp32c3/rom/ets_sys.h"
|
||||||
|
|
||||||
#if defined(CONFIG_FREERTOS_ASSERT_DISABLE)
|
#if defined(CONFIG_FREERTOS_ASSERT_DISABLE)
|
||||||
@@ -98,12 +98,8 @@
|
|||||||
esp_rom_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
|
esp_rom_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
|
||||||
__FUNCTION__); \
|
__FUNCTION__); \
|
||||||
}
|
}
|
||||||
#else /* CONFIG_FREERTOS_ASSERT_FAIL_ABORT */
|
#elif defined(CONFIG_FREERTOS_ASSERT_FAIL_ABORT)
|
||||||
#define configASSERT(a) if (unlikely(!(a))) { \
|
#define configASSERT(a) assert(a)
|
||||||
esp_rom_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
|
|
||||||
__FUNCTION__); \
|
|
||||||
abort(); \
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
|
#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
|
||||||
|
@@ -119,7 +119,7 @@ int xt_clock_freq(void) __attribute__((deprecated));
|
|||||||
|
|
||||||
/* configASSERT behaviour */
|
/* configASSERT behaviour */
|
||||||
#ifndef __ASSEMBLER__
|
#ifndef __ASSEMBLER__
|
||||||
#include <stdlib.h> /* for abort() */
|
#include <assert.h>
|
||||||
#include "esp_rom_sys.h"
|
#include "esp_rom_sys.h"
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
#include "esp32/rom/ets_sys.h" // will be removed in idf v5.0
|
#include "esp32/rom/ets_sys.h" // will be removed in idf v5.0
|
||||||
@@ -138,12 +138,8 @@ int xt_clock_freq(void) __attribute__((deprecated));
|
|||||||
esp_rom_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
|
esp_rom_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
|
||||||
__FUNCTION__); \
|
__FUNCTION__); \
|
||||||
}
|
}
|
||||||
#else /* CONFIG_FREERTOS_ASSERT_FAIL_ABORT */
|
#elif defined(CONFIG_FREERTOS_ASSERT_FAIL_ABORT)
|
||||||
#define configASSERT(a) if (unlikely(!(a))) { \
|
#define configASSERT(a) assert(a)
|
||||||
esp_rom_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
|
|
||||||
__FUNCTION__); \
|
|
||||||
abort(); \
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
|
#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
|
||||||
|
@@ -771,9 +771,13 @@ menu "LWIP"
|
|||||||
config LWIP_ESP_LWIP_ASSERT
|
config LWIP_ESP_LWIP_ASSERT
|
||||||
bool "Enable LWIP ASSERT checks"
|
bool "Enable LWIP ASSERT checks"
|
||||||
default y
|
default y
|
||||||
|
depends on !COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
|
||||||
help
|
help
|
||||||
Enable this option allows lwip to check assert.
|
Enable this option keeps LWIP assertion checks enabled.
|
||||||
It is recommended to keep it open, do not close it.
|
It is recommended to keep this option enabled.
|
||||||
|
|
||||||
|
If asserts are disabled for the entire project, they are also disabled
|
||||||
|
for LWIP and this option is ignored.
|
||||||
|
|
||||||
menu "Hooks"
|
menu "Hooks"
|
||||||
|
|
||||||
|
@@ -75,13 +75,20 @@ typedef int sys_prot_t;
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
|
#define LWIP_PLATFORM_DIAG(x) do {printf x;} 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
|
#ifdef NDEBUG
|
||||||
#define LWIP_NOASSERT
|
|
||||||
|
#define LWIP_NOASSERT 1
|
||||||
|
|
||||||
#else // Assertions enabled
|
#else // Assertions enabled
|
||||||
|
|
||||||
|
#if CONFIG_OPTIMIZATION_ASSERTIONS_SILENT
|
||||||
|
#define LWIP_PLATFORM_ASSERT(message) abort()
|
||||||
|
#else
|
||||||
|
// __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)
|
||||||
|
#endif
|
||||||
|
|
||||||
// If assertions are on, the default LWIP_ERROR handler behaviour is to
|
// If assertions are on, the default LWIP_ERROR handler behaviour is to
|
||||||
// abort w/ an assertion failure. Don't do this, instead just print the error (if LWIP_DEBUG is set)
|
// abort w/ an assertion failure. Don't do this, instead just print the error (if LWIP_DEBUG is set)
|
||||||
// and run the handler (same as the LWIP_ERROR behaviour if LWIP_NOASSERT is set).
|
// and run the handler (same as the LWIP_ERROR behaviour if LWIP_NOASSERT is set).
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
if(BOOTLOADER_BUILD)
|
||||||
|
# Bootloader builds need the platform_include directory (for assert.h), but nothing else
|
||||||
|
idf_component_register(INCLUDE_DIRS platform_include)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(srcs
|
set(srcs
|
||||||
"abort.c"
|
"abort.c"
|
||||||
"heap.c"
|
"heap.c"
|
||||||
|
Reference in New Issue
Block a user