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
11extern"C" {
12#endif
13
14// PICO_CONFIG: PICO_PANIC_FUNCTION, Name of a function to use in place of the stock panic function or empty string to simply breakpoint on panic, group=pico_runtime
15
16// PICO_CONFIG: PICO_PANIC_FUNCTION_WITH_CALL_STACK, Ensure the call stack is available when using a custom panic function via PICO_PANIC_FUNCTION. When set to 1 it conflicts with PICO_PANIC_FUNCTION_WITH_ALL_VAARGS as a stack frame must be pushed onto the stack corrupting later vaargs. Note this defaults to 1 as most custom panic functions don't actually use the arguments and the call stack seems more useful in general, default=1, group=pico_runtime
17#ifndef PICO_PANIC_FUNCTION_WITH_CALL_STACK
18#define PICO_PANIC_FUNCTION_WITH_CALL_STACK 1
19#endif
20
21// PICO_CONFIG: PICO_PANIC_FUNCTION_WITH_ALL_VAARGS, Ensures that all vaargs are faithfully passed to the custom panic function via PICO_PANIC_FUNCTION. When set to 1 it conflicts with PICO_PANIC_FUNCTION_WITH_CALL_STACK because both the later vaargs and the stack frame would be expected at the top of the stack. Note this defaults to 0 as most custom panic functions don't actually use the arguments and the call stack seems more useful in general, default=0, group=pico_runtime
22#ifndef PICO_PANIC_FUNCTION_WITH_ALL_VAARGS
23#define PICO_PANIC_FUNCTION_WITH_ALL_VAARGS 0
24#endif
25
26// PICO_CONFIG: PICO_PANIC_FUNCTION_DOES_NOT_RETURN, Indicate that the user supplied PICO_PANIC_FUNCTION does not return so the caller does not need to inject a breakpoint. When this is 1 the full call stack is available and all vaargs are correctly passed to the user function, default=0, group=pico_runtime