1 /* 2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _PICO_PLATFORM_PANIC_H 8 #define _PICO_PLATFORM_PANIC_H 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #ifndef __ASSEMBLER__ 15 16 /*! \brief Panics with the message "Unsupported" 17 * \ingroup pico_platform 18 * \see panic 19 */ 20 void __attribute__((noreturn)) panic_unsupported(void); 21 22 /*! \brief Displays a panic message and halts execution 23 * \ingroup pico_platform 24 * 25 * An attempt is made to output the message to all registered STDOUT drivers 26 * after which this method executes a BKPT instruction. 27 * 28 * @param fmt format string (printf-like) 29 * @param ... printf-like arguments 30 */ 31 void __attribute__((noreturn)) panic(const char *fmt, ...); 32 33 #ifdef NDEBUG 34 #define panic_compact(...) panic(__VA_ARGS__) 35 #else 36 #define panic_compact(...) panic("") 37 #endif 38 #endif 39 40 #ifdef __cplusplus 41 } 42 #endif 43 44 #endif