mirror of
https://github.com/flipperdevices/flipperzero-firmware.git
synced 2025-12-12 04:41:26 +04:00
* Add doxygen and doxygen-awesome css, cleanup docs files * Ignore more libraries and remove leftover local variables * Create an actual intro page * .md files linting * Add doxygen action * Fix Doxygen path * Fix doxyfile path * Try to upload * Change docs branch * Add submudules checkout * Disable doxygen on PR * Mention the firmware docs in the readme * More dev docs mentions in the readme * Fix runner group, add tags * Test dev in PR * Disable running on PR * Fix a typo in the doxyfile * Try upload to S3 * Fix local path * Fix S3 ACL * Add delete flag, unifying dev and tags * Update ignored directories * More ignored directories * Even more ignored directories * Fix submodule * Change S3 uploader * Change S3 uploader version * Fix aws sync flags * Fix ACL * Disable ACL * Improve ignores, add WiFi devboard docs * TEMP: generate dev docs * TEMP: generate 0.89.0 docs * Disabling PR trigger * Enable submodules and test build * Enable test build * Disable test build * Change docs directory structure * Fix accidentally committed submodule * Fix submodules * Update links to the developer documentation * Markdown linting * Update workflow, enable test build * Fix doxygen dir path * Update Doxyfile-awesome.cfg * Change paths * Fix upload docs path * Disable pull_request debug trigger * Disable tags building * Remove autolinks and namespaces * Establish basic documentation structure * Add missing changes * Improve stylesheet, move some files * Improve examples * Improve the main page * Improve application dev docs * Improve system programming docs * Improve development tools docs * Improve other docs * Improve application examples * Fix formatting * Fix PVS-studio warnings * Improve visuals * Fix doxygen syntax warnings * Fix broken links * Update doxygen action Co-authored-by: DrunkBatya <drunkbatya.js@gmail.com> Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com> Co-authored-by: Georgii Surkov <37121527+gsurkov@users.noreply.github.com>
107 lines
3.3 KiB
C
107 lines
3.3 KiB
C
/**
|
|
* @file check.h
|
|
*
|
|
* Furi crash and assert functions.
|
|
*
|
|
* The main problem with crashing is that you can't do anything without disturbing registers,
|
|
* and if you disturb registers, you won't be able to see the correct register values in the debugger.
|
|
*
|
|
* Current solution works around it by passing the message through r12 and doing some magic with registers in crash function.
|
|
* r0-r10 are stored in the ram2 on crash routine start and restored at the end.
|
|
* The only register that is going to be lost is r11.
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#include <m-core.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#define FURI_NORETURN [[noreturn]]
|
|
#else
|
|
#include <stdnoreturn.h>
|
|
#define FURI_NORETURN noreturn
|
|
#endif
|
|
|
|
// Flags instead of pointers will save ~4 bytes on furi_assert and furi_check calls.
|
|
#define __FURI_ASSERT_MESSAGE_FLAG (0x01)
|
|
#define __FURI_CHECK_MESSAGE_FLAG (0x02)
|
|
|
|
/** Crash system */
|
|
FURI_NORETURN void __furi_crash_implementation();
|
|
|
|
/** Halt system */
|
|
FURI_NORETURN void __furi_halt_implementation();
|
|
|
|
/** Crash system with message. Show message after reboot. */
|
|
#define __furi_crash(message) \
|
|
do { \
|
|
register const void* r12 asm("r12") = (void*)message; \
|
|
asm volatile("sukima%=:" : : "r"(r12)); \
|
|
__furi_crash_implementation(); \
|
|
} while(0)
|
|
|
|
/** Crash system
|
|
*
|
|
* @param ... optional message (const char*)
|
|
*/
|
|
#define furi_crash(...) M_APPLY(__furi_crash, M_IF_EMPTY(__VA_ARGS__)((NULL), (__VA_ARGS__)))
|
|
|
|
/** Halt system with message. */
|
|
#define __furi_halt(message) \
|
|
do { \
|
|
register const void* r12 asm("r12") = (void*)message; \
|
|
asm volatile("sukima%=:" : : "r"(r12)); \
|
|
__furi_halt_implementation(); \
|
|
} while(0)
|
|
|
|
/** Halt system
|
|
*
|
|
* @param ... optional message (const char*)
|
|
*/
|
|
#define furi_halt(...) M_APPLY(__furi_halt, M_IF_EMPTY(__VA_ARGS__)((NULL), (__VA_ARGS__)))
|
|
|
|
/** Check condition and crash if check failed */
|
|
#define __furi_check(__e, __m) \
|
|
do { \
|
|
if(!(__e)) { \
|
|
__furi_crash(__m); \
|
|
} \
|
|
} while(0)
|
|
|
|
/** Check condition and crash if failed
|
|
*
|
|
* @param ... condition to check and optional message (const char*)
|
|
*/
|
|
#define furi_check(...) \
|
|
M_APPLY(__furi_check, M_DEFAULT_ARGS(2, (__FURI_CHECK_MESSAGE_FLAG), __VA_ARGS__))
|
|
|
|
/** Only in debug build: Assert condition and crash if assert failed */
|
|
#ifdef FURI_DEBUG
|
|
#define __furi_assert(__e, __m) \
|
|
do { \
|
|
if(!(__e)) { \
|
|
__furi_crash(__m); \
|
|
} \
|
|
} while(0)
|
|
#else
|
|
#define __furi_assert(__e, __m) \
|
|
do { \
|
|
((void)(__e)); \
|
|
((void)(__m)); \
|
|
} while(0)
|
|
#endif
|
|
|
|
/** Assert condition and crash if failed
|
|
*
|
|
* @warning only will do check if firmware compiled in debug mode
|
|
*
|
|
* @param ... condition to check and optional message (const char*)
|
|
*/
|
|
#define furi_assert(...) \
|
|
M_APPLY(__furi_assert, M_DEFAULT_ARGS(2, (__FURI_ASSERT_MESSAGE_FLAG), __VA_ARGS__))
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|