mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 10:30:58 +02:00
fix(newlib): added kconfig option for configurable buffer length for assert msgs
Closes https://github.com/espressif/esp-idf/issues/17454
This commit is contained in:
@@ -160,6 +160,22 @@ menu "LibC"
|
|||||||
- str[n]cpy
|
- str[n]cpy
|
||||||
- str[n]cmp
|
- str[n]cmp
|
||||||
|
|
||||||
|
config LIBC_ASSERT_BUFFER_SIZE
|
||||||
|
int "Assert message buffer size"
|
||||||
|
range 100 2048
|
||||||
|
default 200
|
||||||
|
help
|
||||||
|
Size of the buffer used to format assert failure messages.
|
||||||
|
|
||||||
|
When assertions fail, the system formats a message containing the function name,
|
||||||
|
file name, line number, and the failed expression. This option controls the
|
||||||
|
maximum length of this message.
|
||||||
|
|
||||||
|
If you encounter truncated assert messages (especially with C++ templates or
|
||||||
|
long function names), increase this value. The default value of 200 bytes
|
||||||
|
should be sufficient for most cases, but complex template expressions may
|
||||||
|
require larger buffers.
|
||||||
|
|
||||||
endmenu # LibC
|
endmenu # LibC
|
||||||
|
|
||||||
config STDATOMIC_S32C1I_SPIRAM_WORKAROUND
|
config STDATOMIC_S32C1I_SPIRAM_WORKAROUND
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#include "soc/soc_memory_layout.h"
|
#include "soc/soc_memory_layout.h"
|
||||||
#include "esp_private/cache_utils.h"
|
#include "esp_private/cache_utils.h"
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#define ASSERT_STR "assert failed: "
|
#define ASSERT_STR "assert failed: "
|
||||||
#define CACHE_DISABLED_STR "<cached disabled>"
|
#define CACHE_DISABLED_STR "<cached disabled>"
|
||||||
@@ -39,7 +40,7 @@ void __attribute__((noreturn)) __assert_func(const char *file, int line, const c
|
|||||||
esp_system_abort(buff);
|
esp_system_abort(buff);
|
||||||
#else
|
#else
|
||||||
char addr[11] = { 0 };
|
char addr[11] = { 0 };
|
||||||
char buff[200];
|
char buff[CONFIG_LIBC_ASSERT_BUFFER_SIZE];
|
||||||
char lbuf[5];
|
char lbuf[5];
|
||||||
uint32_t rem_len = sizeof(buff) - 1;
|
uint32_t rem_len = sizeof(buff) - 1;
|
||||||
uint32_t off = 0;
|
uint32_t off = 0;
|
||||||
|
Reference in New Issue
Block a user