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

Fix various crashes if debug libraries used (#3144)

* FuriHal: enable HSI in stop mode only if we use STOP0, proper SMPS selected clock assert

* Furi: fix double crash caused by bkpt use outside of debug session

* Libs: update ERC and MGG contrast

* Fix various crashes with LIB_DEBUG=1

* BadUsb: size_t where it should be and proper printf types

* Various fixes and make PVS happy

* FuriHal: proper CCID status and make PVS happy

* boot: update mode: graceful handling of corrupted stage file

---------

Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
あく
2023-10-13 01:34:30 +09:00
committed by GitHub
parent 38792f2c93
commit f45a5dff43
17 changed files with 47 additions and 42 deletions

View File

@@ -153,18 +153,18 @@ FURI_NORETURN void __furi_crash() {
__furi_print_heap_info();
__furi_print_bt_stack_info();
#ifndef FURI_DEBUG
// Check if debug enabled by DAP
// https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/Debug-register-support-in-the-SCS/Debug-Halting-Control-and-Status-Register--DHCSR?lang=en
bool debug = CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk;
#ifdef FURI_NDEBUG
if(debug) {
#endif
furi_hal_console_puts("\r\nSystem halted. Connect debugger for more info\r\n");
furi_hal_console_puts("\033[0m\r\n");
furi_hal_debug_enable();
RESTORE_REGISTERS_AND_HALT_MCU(true);
#ifndef FURI_DEBUG
RESTORE_REGISTERS_AND_HALT_MCU(debug);
#ifdef FURI_NDEBUG
} else {
uint32_t ptr = (uint32_t)__furi_check_message;
if(ptr < FLASH_BASE || ptr > (FLASH_BASE + FLASH_SIZE)) {

View File

@@ -115,8 +115,9 @@ static size_t xBlockAllocatedBit = 0;
#include <m-dict.h>
/* Allocation tracking types */
DICT_DEF2(MemmgrHeapAllocDict, uint32_t, uint32_t)
DICT_DEF2(
DICT_DEF2(MemmgrHeapAllocDict, uint32_t, uint32_t) //-V1048
DICT_DEF2( //-V1048
MemmgrHeapThreadDict,
uint32_t,
M_DEFAULT_OPLIST,