1
mirror of https://github.com/flipperdevices/flipperzero-firmware.git synced 2025-12-12 04:41:26 +04:00

Furi, USB, BLE, Debug: various bug fixes and improvements (#4114)

* Furi, USB, BLE: extra stack space for some threads, small code cleanup.

* Furi: thread watermark check on exit, explicitly crash if built with LIB_DEBUG=1

* Debug: color logging in apps/furi gdb helper, check and show crash message in gdb console.
This commit is contained in:
あく
2025-02-18 03:16:14 +09:00
committed by GitHub
parent 4895ae5d0d
commit 3a42bf812d
5 changed files with 87 additions and 23 deletions

View File

@@ -23,6 +23,8 @@
#define THREAD_MAX_STACK_SIZE (UINT16_MAX * sizeof(StackType_t))
#define THREAD_STACK_WATERMARK_MIN (256u)
typedef struct {
FuriThreadStdoutWriteCallback write_callback;
FuriString* buffer;
@@ -115,6 +117,18 @@ static void furi_thread_body(void* context) {
furi_check(!thread->is_service, "Service threads MUST NOT return");
size_t stack_watermark = furi_thread_get_stack_space(thread);
if(stack_watermark < THREAD_STACK_WATERMARK_MIN) {
#ifdef FURI_DEBUG
furi_crash("Stack watermark is dangerously low");
#endif
FURI_LOG_E( //-V779
thread->name ? thread->name : "Thread",
"Stack watermark is too low %zu < " STRINGIFY(
THREAD_STACK_WATERMARK_MIN) ". Increase stack size.",
stack_watermark);
}
if(thread->heap_trace_enabled == true) {
furi_delay_ms(33);
thread->heap_size = memmgr_heap_get_thread_memory((FuriThreadId)thread);