1 Star 0 Fork 4.9K

丛林 / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
kernel-small-debug-trace-other-lastwords.md 6.84 KB
一键复制 编辑 原始数据 按行查看 历史
Annie_wang 提交于 2022-05-19 22:02 . update docs

Dying Gasp

When to Use

For a device without a serial port, the dying gasp saves the exception information to a non-volatile storage medium to facilitate fault location during system running.

Available APIs

The system provides a mechanism to save printed exception information to a non-volatile storage medium. You can register the hook function of the information printed when the read and write operations are abnormal. In this way, fault information can be saved on different storage media, facilitating fault locating for devices without serial ports. The API is LOS_ExcInfoRegHook. This function is declared in los_config.h. The function prototype is as follows:

typedef VOID (*log_read_write_fn)(UINT32 startAddr, UINT32 space, UINT32 rwFlag, CHAR *buf);
...
VOID LOS_ExcInfoRegHook(UINT32 startAddr, UINT32 space, CHAR *buf, log_read_write_fn hook);

Parameters

Table 1 LOS_ExcInfoRegHook parameter description

Parameter

Description

startAddr

Start address of the physical medium to be got or set

space

Size of the space

buf

Memory buffer used to get or set the exception information

log_read_write_fn

Function used to get or set the exception information

Table 2 log_read_write_fn parameter description

Parameter

Description

startAddr

Start address of the physical medium to be got or set

space

Size of the space

rwFlag

Read/Write flag. The value 0 indicates write, and the value 1 indicates read.

buf

Memory buffer used to get or set the exception information

How to Develop

The dying gasp function depends on the macro LOSCFG_SAVE_EXCINFO. Before using this function, choose Debug-> Enable Saving Exception Information in the configuration items to enable this macro. If this macro is disabled, this function cannot be used. Then, call LOS_ExcInfoRegHook in SystemInit to register the position, size, memory buffer, and access function for accessing the exception information. When an exception occurs in the system, the system saves the exception information in the memory buffer passed in the registration, and then calls the registered access function to write the exception information to the physical storage medium.

NOTE:

  • The location registered to store the exception information cannot overlap with other storage locations.
  • The registered memory buffer should be greater than or equal to 16 KiB. Otherwise, the exception information stored may be incomplete.
  • The exception information can be accessed successfully only when the driver of the storage medium corresponding to the registered read/write function is normal.
1
https://gitee.com/jungle8023/docs.git
git@gitee.com:jungle8023/docs.git
jungle8023
docs
docs
master

搜索帮助