| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /*
- * Copyright (c) 2025, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2025-08-16 Rbb666 first version
- */
-
- #ifndef __MCD_ARCH_INTERFACE_H__
- #define __MCD_ARCH_INTERFACE_H__
-
- #include <stdint.h>
-
- /**
- * @brief Architecture-specific hard fault exception handler
- *
- * This function should be implemented by each supported architecture
- * to handle the architecture-specific stack frame processing.
- *
- * @param context Pointer to exception context (architecture-specific format)
- * @return int Always returns -1 to indicate fault condition
- */
- #ifdef PKG_USING_MCOREDUMP_ARCH_ARMV7M
- int armv7m_hard_fault_exception_hook(void *context);
-
- /**
- * @brief Architecture-specific register collection function
- *
- * This function extracts register values from the architecture-specific
- * stack frame format and stores them in the standard register sets.
- *
- * @param stack_top Pointer to the stack frame
- * @param core_regset Pointer to store ARM core registers
- * @param fp_regset Pointer to store FPU registers
- */
- void collect_registers_armv7m(uint32_t *stack_top, core_regset_type *core_regset, fp_regset_type *fp_regset);
-
- // 打印寄存器
- void print_registers_armv7m(core_regset_type *reg, fp_regset_type *fp_reg, char *thread);
- // 打印一段内存
- void print_mem_armv7m(uint32_t addr, uint32_t len);
-
- /* Generic interface macro for architecture-agnostic code */
- #define collect_registers collect_registers_armv7m
- #define print_registers print_registers_armv7m
- #define print_mem print_mem_armv7m
- #define arch_hard_fault_exception_hook armv7m_hard_fault_exception_hook
-
- #elif defined(PKG_USING_MCOREDUMP_ARCH_ARMV8M)
- int armv8m_hard_fault_exception_hook(void *context);
-
- /**
- * @brief Architecture-specific register collection function
- *
- * This function extracts register values from the architecture-specific
- * stack frame format and stores them in the standard register sets.
- *
- * @param stack_top Pointer to the stack frame
- * @param core_regset Pointer to store ARM core registers
- * @param fp_regset Pointer to store FPU registers
- */
- void collect_registers_armv8m(uint32_t *stack_top, core_regset_type *core_regset, fp_regset_type *fp_regset);
-
- /* Generic interface macro for architecture-agnostic code */
- #define collect_registers collect_registers_armv8m
- #define print_registers
- #define print_mem
- #define arch_hard_fault_exception_hook armv8m_hard_fault_exception_hook
- #else
- #error "MCoredump does not support this architecture"
- #endif
-
- #endif /* __MCD_ARCH_INTERFACE_H__ */
|