2019-08-23 21:28:35 +08:00
|
|
|
/****************************************************************************
|
2021-03-09 05:39:04 +08:00
|
|
|
* arch/arm/include/cxd56xx/crashdump.h
|
2019-08-23 21:28:35 +08:00
|
|
|
*
|
2021-04-01 00:53:35 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2019-08-23 21:28:35 +08:00
|
|
|
*
|
2021-04-01 00:53:35 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2019-08-23 21:28:35 +08:00
|
|
|
*
|
2021-04-01 00:53:35 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2019-08-23 21:28:35 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ARCH_ARM_INCLUDE_CXD56XX_CRASHDUMP_H
|
|
|
|
#define __ARCH_ARM_INCLUDE_CXD56XX_CRASHDUMP_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2023-02-02 20:31:22 +08:00
|
|
|
#include <sys/param.h>
|
|
|
|
|
2019-08-23 21:28:35 +08:00
|
|
|
#include <nuttx/irq.h>
|
|
|
|
|
|
|
|
/****************************************************************************
|
2021-03-21 18:37:01 +08:00
|
|
|
* Pre-processor Prototypes
|
2019-08-23 21:28:35 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Configuration ************************************************************/
|
|
|
|
|
|
|
|
/* The following guides in the amount of the user and interrupt stack
|
|
|
|
* data we can save. The amount of storage left will dictate the actual
|
|
|
|
* number of entries of the user stack data saved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define CRASHLOG_SIZE 1024
|
|
|
|
#if CONFIG_ARCH_INTERRUPTSTACK <= 3
|
|
|
|
# define NUMBER_STACKS 1
|
|
|
|
#else
|
|
|
|
# define NUMBER_STACKS 2
|
|
|
|
#endif
|
|
|
|
#define CRASHLOG_LEFTOVER (CRASHLOG_SIZE - sizeof(info_t))
|
|
|
|
#define CONFIG_ISTACK_SIZE (CRASHLOG_LEFTOVER / NUMBER_STACKS / \
|
|
|
|
sizeof(stack_word_t))
|
|
|
|
#define CONFIG_USTACK_SIZE (CRASHLOG_LEFTOVER / NUMBER_STACKS / \
|
|
|
|
sizeof(stack_word_t))
|
|
|
|
|
2020-04-14 18:50:12 +08:00
|
|
|
/* For Assert keep this much of the file name */
|
2019-08-23 21:28:35 +08:00
|
|
|
|
|
|
|
#define MAX_FILE_PATH_LENGTH 40
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
|
|
|
/* Used for stack frame storage */
|
|
|
|
|
|
|
|
typedef uint32_t stack_word_t;
|
|
|
|
|
|
|
|
/* Stack related data */
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint32_t sp;
|
|
|
|
uint32_t top;
|
|
|
|
uint32_t size;
|
|
|
|
} _stack_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
_stack_t user;
|
|
|
|
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
|
|
_stack_t interrupt;
|
|
|
|
#endif
|
2023-06-20 11:31:50 +08:00
|
|
|
} crash_stack_t;
|
2019-08-23 21:28:35 +08:00
|
|
|
|
|
|
|
/* Flags to identify what is in the dump */
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
REGS_PRESENT = 0x01,
|
|
|
|
USERSTACK_PRESENT = 0x02,
|
|
|
|
INTSTACK_PRESENT = 0x04,
|
|
|
|
INVALID_USERSTACK_PTR = 0x20,
|
|
|
|
INVALID_INTSTACK_PTR = 0x40,
|
|
|
|
} fault_flags_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2024-08-28 16:28:46 +08:00
|
|
|
struct timespec ts; /* timestamp */
|
|
|
|
fault_flags_t flags; /* What is in the dump */
|
|
|
|
uintptr_t current_regs; /* Used to validate the dump */
|
|
|
|
int lineno; /* __LINE__ to up_assert */
|
|
|
|
pid_t pid; /* Process ID */
|
|
|
|
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
|
|
|
|
crash_stack_t stacks; /* Stack info */
|
|
|
|
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
|
|
|
|
* terminator) */
|
|
|
|
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
|
|
|
|
* __FILE__ to up_assert */
|
2019-08-23 21:28:35 +08:00
|
|
|
} info_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
info_t info;
|
|
|
|
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
|
|
stack_word_t istack[CONFIG_ISTACK_SIZE];
|
|
|
|
#endif
|
|
|
|
stack_word_t ustack[CONFIG_USTACK_SIZE];
|
|
|
|
} fullcontext_t;
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
2020-02-01 02:07:39 +08:00
|
|
|
#endif /* __ARCH_ARM_INCLUDE_CXD56XX_CRASHDUMP_H */
|