oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
ove_arm_backtrace.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 Kamil Lulko <kamil.lulko@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 *
6 * This file is part of oveRTOS.
7 */
8
9#ifndef OVE_ARM_BACKTRACE_H
10#define OVE_ARM_BACKTRACE_H
11
12#include <stdint.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/*
19 * Cortex-M basic exception frame layout (word indices from PSP at
20 * exception entry). Declared here so profiler backends can read the
21 * stacked PC/LR directly without redefining the enum.
22 */
23enum {
24 OVE_ARM_EXC_R0 = 0,
25 OVE_ARM_EXC_R1 = 1,
26 OVE_ARM_EXC_R2 = 2,
27 OVE_ARM_EXC_R3 = 3,
28 OVE_ARM_EXC_R12 = 4,
29 OVE_ARM_EXC_LR = 5,
30 OVE_ARM_EXC_PC = 6,
31 OVE_ARM_EXC_XPSR = 7,
32};
33
52int ove_arm_backtrace_lr_is_post_bl(uintptr_t lr_clean, uintptr_t text_lo, uintptr_t text_hi);
53
103int ove_arm_backtrace_walk(uintptr_t psp, uintptr_t text_lo, uintptr_t text_hi, uintptr_t sram_lo,
104 uintptr_t sram_hi, uint32_t fill, uintptr_t *out, int max);
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif /* OVE_ARM_BACKTRACE_H */
int ove_arm_backtrace_walk(uintptr_t psp, uintptr_t text_lo, uintptr_t text_hi, uintptr_t sram_lo, uintptr_t sram_hi, uint32_t fill, uintptr_t *out, int max)
Multi-frame stack-scan unwinder for Cortex-M / Thumb-2 tasks.