xtensa: dc233c: enable backtrace support
Adds the necessary bits to enable backtrace support for Xtensa DC233C core. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
1194a35aa2
commit
ba6c9c2136
4 changed files with 41 additions and 1 deletions
|
@ -46,7 +46,7 @@ config XTENSA_USE_CORE_CRT1
|
||||||
config XTENSA_ENABLE_BACKTRACE
|
config XTENSA_ENABLE_BACKTRACE
|
||||||
bool "Backtrace on panic exception"
|
bool "Backtrace on panic exception"
|
||||||
default y
|
default y
|
||||||
depends on SOC_SERIES_ESP32 || SOC_FAMILY_INTEL_ADSP
|
depends on SOC_SERIES_ESP32 || SOC_FAMILY_INTEL_ADSP || SOC_XTENSA_DC233C
|
||||||
help
|
help
|
||||||
Enable this config option to print backtrace on panic exception
|
Enable this config option to print backtrace on panic exception
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include "soc/soc_memory_layout.h"
|
#include "soc/soc_memory_layout.h"
|
||||||
#elif defined(CONFIG_SOC_FAMILY_INTEL_ADSP)
|
#elif defined(CONFIG_SOC_FAMILY_INTEL_ADSP)
|
||||||
#include "debug_helpers.h"
|
#include "debug_helpers.h"
|
||||||
|
#elif defined(CONFIG_SOC_XTENSA_DC233C)
|
||||||
|
#include "backtrace_helpers.h"
|
||||||
#endif
|
#endif
|
||||||
static int mask, cause;
|
static int mask, cause;
|
||||||
|
|
||||||
|
@ -38,6 +40,8 @@ static inline bool z_xtensa_stack_ptr_is_sane(uint32_t sp)
|
||||||
return esp_stack_ptr_is_sane(sp);
|
return esp_stack_ptr_is_sane(sp);
|
||||||
#elif defined(CONFIG_SOC_FAMILY_INTEL_ADSP)
|
#elif defined(CONFIG_SOC_FAMILY_INTEL_ADSP)
|
||||||
return intel_adsp_ptr_is_sane(sp);
|
return intel_adsp_ptr_is_sane(sp);
|
||||||
|
#elif defined(CONFIG_SOC_XTENSA_DC233C)
|
||||||
|
return xtensa_dc233c_stack_ptr_is_sane(sp);
|
||||||
#else
|
#else
|
||||||
#warning "z_xtensa_stack_ptr_is_sane is not defined for this platform"
|
#warning "z_xtensa_stack_ptr_is_sane is not defined for this platform"
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,6 +53,8 @@ static inline bool z_xtensa_ptr_executable(const void *p)
|
||||||
return esp_ptr_executable(p);
|
return esp_ptr_executable(p);
|
||||||
#elif defined(CONFIG_SOC_FAMILY_INTEL_ADSP)
|
#elif defined(CONFIG_SOC_FAMILY_INTEL_ADSP)
|
||||||
return intel_adsp_ptr_executable(p);
|
return intel_adsp_ptr_executable(p);
|
||||||
|
#elif defined(CONFIG_SOC_XTENSA_DC233C)
|
||||||
|
return xtensa_dc233c_ptr_executable(p);
|
||||||
#else
|
#else
|
||||||
#warning "z_xtensa_ptr_executable is not defined for this platform"
|
#warning "z_xtensa_ptr_executable is not defined for this platform"
|
||||||
#endif
|
#endif
|
||||||
|
|
28
soc/xtensa/dc233c/include/backtrace_helpers.h
Normal file
28
soc/xtensa/dc233c/include/backtrace_helpers.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/* Copyright (c) 2022, 2023 Intel Corporation
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_SOC_XTENSA_DC233C_BACKTRACE_HELPERS_H_
|
||||||
|
#define ZEPHYR_SOC_XTENSA_DC233C_BACKTRACE_HELPERS_H_
|
||||||
|
|
||||||
|
#include <zephyr/linker/linker-defs.h>
|
||||||
|
|
||||||
|
#include <xtensa/config/core-isa.h>
|
||||||
|
|
||||||
|
static inline bool xtensa_dc233c_ptr_executable(const void *p)
|
||||||
|
{
|
||||||
|
bool in_text = ((p >= (void *)__text_region_start) &&
|
||||||
|
(p <= (void *)__text_region_end));
|
||||||
|
bool in_vecbase = ((p >= (void *)XCHAL_VECBASE_RESET_VADDR) &&
|
||||||
|
(p < (void *)CONFIG_SRAM_OFFSET));
|
||||||
|
|
||||||
|
return (in_text || in_vecbase);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool xtensa_dc233c_stack_ptr_is_sane(uint32_t sp)
|
||||||
|
{
|
||||||
|
return ((char *)sp >= __text_region_start);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_SOC_XTENSA_DC233C_BACKTRACE_HELPERS_H_ */
|
|
@ -322,6 +322,12 @@ SECTIONS
|
||||||
|
|
||||||
*(.text.arch_is_in_isr)
|
*(.text.arch_is_in_isr)
|
||||||
|
|
||||||
|
/* To support backtracing */
|
||||||
|
*libarch__xtensa__core.a:xtensa_backtrace.c.obj(.literal.*)
|
||||||
|
*libarch__xtensa__core.a:xtensa_backtrace.c.obj(.text.*)
|
||||||
|
*libarch__xtensa__core.a:debug_helpers_asm.S.obj(.iram1.literal)
|
||||||
|
*libarch__xtensa__core.a:debug_helpers_asm.S.obj(.iram1)
|
||||||
|
|
||||||
*libkernel.a:fatal.c.obj(.literal.*)
|
*libkernel.a:fatal.c.obj(.literal.*)
|
||||||
*libkernel.a:fatal.c.obj(.text.*)
|
*libkernel.a:fatal.c.obj(.text.*)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue