Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
be4d8e74
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
大约 1 年 前同步成功
通知
452
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
be4d8e74
编写于
5月 06, 2021
作者:
O
openharmony_ci
提交者:
Gitee
5月 06, 2021
浏览文件
操作
浏览文件
下载
差异文件
!201 系统异常信息保存到存储介质中的功能从shell依赖中剥离
Merge pull request !201 from zhangfanfan2/master
上级
41f20751
d846035f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
79 addition
and
90 deletion
+79
-90
Kconfig
Kconfig
+7
-0
arch/arm/arm/src/los_exc.c
arch/arm/arm/src/los_exc.c
+30
-9
kernel/base/misc/mempt_shellcmd.c
kernel/base/misc/mempt_shellcmd.c
+6
-6
kernel/base/misc/task_shellcmd.c
kernel/base/misc/task_shellcmd.c
+1
-1
kernel/common/los_config.h
kernel/common/los_config.h
+1
-1
kernel/common/los_excinfo.c
kernel/common/los_excinfo.c
+31
-2
kernel/common/los_excinfo_pri.h
kernel/common/los_excinfo_pri.h
+1
-1
kernel/common/los_printf.c
kernel/common/los_printf.c
+2
-2
shell/Kconfig
shell/Kconfig
+0
-7
shell/full/src/cmds/excinfo_shell.c
shell/full/src/cmds/excinfo_shell.c
+0
-61
未找到文件。
Kconfig
浏览文件 @
be4d8e74
...
...
@@ -165,6 +165,7 @@ config THUMB
default n
help
Answer Y to build thumb version. This will make LiteOS smaller.
config PLATFORM_DVFS
bool "Enable Dvfs"
default n
...
...
@@ -173,6 +174,12 @@ config PLATFORM_DVFS
Answer Y to enable LiteOS support dynamic voltage and frequency scaling feature for
low power consumption.
config SAVE_EXCINFO
bool "Enable Saving Exception Information"
default n
help
Answer Y to enable LiteOS support saving exception information to storage medium.
config DEBUG_VERSION
bool "Enable a Debug Version"
default n
...
...
arch/arm/arm/src/los_exc.c
浏览文件 @
be4d8e74
...
...
@@ -34,7 +34,7 @@
#include "los_printf_pri.h"
#include "los_task_pri.h"
#include "los_hw_pri.h"
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
#include "los_excinfo_pri.h"
#endif
#ifdef LOSCFG_EXC_INTERACTION
...
...
@@ -576,7 +576,7 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
#endif
#endif
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
OsProcessExitCodeCoreDumpSet
(
runProcess
);
#endif
OsProcessExitCodeSignalSet
(
runProcess
,
SIGUSR2
);
...
...
@@ -1086,6 +1086,22 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
}
}
#ifdef LOSCFG_SAVE_EXCINFO
STATIC
VOID
OsSysStateSave
(
UINT32
*
intCount
,
UINT32
*
lockCount
)
{
*
intCount
=
g_intCount
[
ArchCurrCpuid
()];
*
lockCount
=
OsPercpuGet
()
->
taskLockCnt
;
g_intCount
[
ArchCurrCpuid
()]
=
0
;
OsPercpuGet
()
->
taskLockCnt
=
0
;
}
STATIC
VOID
OsSysStateRestore
(
UINT32
intCount
,
UINT32
lockCount
)
{
g_intCount
[
ArchCurrCpuid
()]
=
intCount
;
OsPercpuGet
()
->
taskLockCnt
=
lockCount
;
}
#endif
/*
* Description : EXC handler entry
* Input : excType --- exc type
...
...
@@ -1093,6 +1109,11 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
*/
LITE_OS_SEC_TEXT_INIT
VOID
OsExcHandleEntry
(
UINT32
excType
,
ExcContext
*
excBufAddr
,
UINT32
far
,
UINT32
fsr
)
{
#ifdef LOSCFG_SAVE_EXCINFO
UINT32
intCount
;
UINT32
lockCount
;
#endif
/* Task scheduling is not allowed during exception handling */
OsPercpuGet
()
->
taskLockCnt
++
;
...
...
@@ -1106,18 +1127,18 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
OsAllCpuStatusOutput
();
#endif
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
log_read_write_fn
func
=
GetExcInfoRW
();
#endif
if
(
g_excHook
!=
NULL
)
{
if
(
g_curNestCount
[
ArchCurrCpuid
()]
==
1
)
{
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
if
(
func
!=
NULL
)
{
SetExcInfoIndex
(
0
);
g_intCount
[
ArchCurrCpuid
()]
=
0
;
OsSysStateSave
(
&
intCount
,
&
lockCount
)
;
OsRecordExcInfoTime
();
g_intCount
[
ArchCurrCpuid
()]
=
1
;
OsSysStateRestore
(
intCount
,
lockCount
)
;
}
#endif
g_excHook
(
excType
,
excBufAddr
,
far
,
fsr
);
...
...
@@ -1125,12 +1146,12 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
OsCallStackInfo
();
}
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
if
(
func
!=
NULL
)
{
PrintExcInfo
(
"Be sure flash space bigger than GetExcInfoIndex():0x%x
\n
"
,
GetExcInfoIndex
());
g_intCount
[
ArchCurrCpuid
()]
=
0
;
OsSysStateSave
(
&
intCount
,
&
lockCount
)
;
func
(
GetRecordAddr
(),
GetRecordSpace
(),
0
,
GetExcInfoBuf
());
g_intCount
[
ArchCurrCpuid
()]
=
1
;
OsSysStateRestore
(
intCount
,
lockCount
)
;
}
#endif
}
...
...
kernel/base/misc/mempt_shellcmd.c
浏览文件 @
be4d8e74
...
...
@@ -31,7 +31,7 @@
#include "stdlib.h"
#include "los_memory_pri.h"
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
#include "los_excinfo_pri.h"
#endif
#ifdef LOSCFG_SHELL
...
...
@@ -64,7 +64,7 @@ VOID OsDumpMemByte(size_t length, UINTPTR addr)
while
(
dataLen
)
{
if
(
IS_ALIGNED
(
count
,
sizeof
(
CHAR
*
)))
{
PRINTK
(
"
\n
0x%lx :"
,
alignAddr
);
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
WriteExcInfoToBuf
(
"
\n
0x%lx :"
,
alignAddr
);
#endif
}
...
...
@@ -73,7 +73,7 @@ VOID OsDumpMemByte(size_t length, UINTPTR addr)
#else
PRINTK
(
"%0+8lx "
,
*
alignAddr
);
#endif
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
#ifdef __LP64__
WriteExcInfoToBuf
(
"0x%0+16x "
,
*
alignAddr
);
#else
...
...
@@ -85,7 +85,7 @@ VOID OsDumpMemByte(size_t length, UINTPTR addr)
count
++
;
}
PRINTK
(
"
\n
"
);
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
WriteExcInfoToBuf
(
"
\n
"
);
#endif
...
...
@@ -101,14 +101,14 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdMemCheck(INT32 argc, const CHAR *argv[])
if
(
LOS_MemIntegrityCheck
(
m_aucSysMem1
)
==
LOS_OK
)
{
PRINTK
(
"system memcheck over, all passed!
\n
"
);
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
WriteExcInfoToBuf
(
"system memcheck over, all passed!
\n
"
);
#endif
}
#ifdef LOSCFG_EXC_INTERACTION
if
(
LOS_MemIntegrityCheck
(
m_aucSysMem0
)
==
LOS_OK
)
{
PRINTK
(
"exc interaction memcheck over, all passed!
\n
"
);
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
WriteExcInfoToBuf
(
"exc interaction memcheck over, all passed!
\n
"
);
#endif
}
...
...
kernel/base/misc/task_shellcmd.c
浏览文件 @
be4d8e74
...
...
@@ -43,7 +43,7 @@
#ifdef LOSCFG_KERNEL_CPUP
#include "los_cpup_pri.h"
#endif
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
#include "los_excinfo_pri.h"
#endif
#include "los_process_pri.h"
...
...
kernel/common/los_config.h
浏览文件 @
be4d8e74
...
...
@@ -398,7 +398,7 @@ extern UINT32 __heap_end;
#endif
/****************************** exception information configuration ******************************/
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
/**
* @ingroup los_config
* the size of space for recording exception information
...
...
kernel/common/los_excinfo.c
浏览文件 @
be4d8e74
...
...
@@ -34,9 +34,11 @@
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#endif
#ifdef LOSCFG_SHELL
#include "shcmd.h"
#endif
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
STATIC
log_read_write_fn
g_excInfoRW
=
NULL
;
/* the hook of read-writing exception information */
STATIC
CHAR
*
g_excInfoBuf
=
NULL
;
/* pointer to the buffer for storing the exception information */
STATIC
UINT32
g_excInfoIndex
=
0xFFFFFFFF
;
/* the index of the buffer for storing the exception information */
...
...
@@ -164,5 +166,32 @@ VOID OsRecordExcInfoTime(VOID)
#endif
}
#ifdef LOSCFG_SHELL
INT32
OsShellCmdReadExcInfo
(
INT32
argc
,
CHAR
**
argv
)
{
UINT32
recordSpace
=
GetRecordSpace
();
(
VOID
)
argc
;
(
VOID
)
argv
;
CHAR
*
buf
=
(
CHAR
*
)
LOS_MemAlloc
((
void
*
)
OS_SYS_MEM_ADDR
,
recordSpace
+
1
);
if
(
buf
==
NULL
)
{
return
LOS_NOK
;
}
(
void
)
memset_s
(
buf
,
recordSpace
+
1
,
0
,
recordSpace
+
1
);
log_read_write_fn
hook
=
GetExcInfoRW
();
if
(
hook
!=
NULL
)
{
hook
(
GetRecordAddr
(),
recordSpace
,
1
,
buf
);
}
PRINTK
(
"%s
\n
"
,
buf
);
(
VOID
)
LOS_MemFree
((
void
*
)
OS_SYS_MEM_ADDR
,
buf
);
buf
=
NULL
;
return
LOS_OK
;
}
SHELLCMD_ENTRY
(
readExcInfo_shellcmd
,
CMD_TYPE_EX
,
"excInfo"
,
0
,
(
CmdCallBackFunc
)
OsShellCmdReadExcInfo
);
#endif
#endif
kernel/common/los_excinfo_pri.h
浏览文件 @
be4d8e74
...
...
@@ -40,7 +40,7 @@ extern "C" {
#endif
/* __cplusplus */
#endif
/* __cplusplus */
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
extern
VOID
SetExcInfoRW
(
log_read_write_fn
func
);
extern
log_read_write_fn
GetExcInfoRW
(
VOID
);
extern
VOID
SetExcInfoBuf
(
CHAR
*
buf
);
...
...
kernel/common/los_printf.c
浏览文件 @
be4d8e74
...
...
@@ -42,7 +42,7 @@
#ifdef LOSCFG_SHELL_DMESG
#include "dmesg_pri.h"
#endif
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
#include "los_excinfo_pri.h"
#endif
#include "los_exc_pri.h"
...
...
@@ -250,7 +250,7 @@ VOID PrintExcInfo(const CHAR *fmt, ...)
va_start
(
ap
,
fmt
);
/* uart output without print-spinlock */
OsVprintf
(
fmt
,
ap
,
EXC_OUTPUT
);
#ifdef LOSCFG_S
HELL
_EXCINFO
#ifdef LOSCFG_S
AVE
_EXCINFO
WriteExcBufVa
(
fmt
,
ap
);
#endif
va_end
(
ap
);
...
...
shell/Kconfig
浏览文件 @
be4d8e74
...
...
@@ -22,11 +22,4 @@ config SHELL_DMESG
help
Answer Y to enable LiteOS support shell dmesg.
config SHELL_EXCINFO
bool "Enable Shell excInfo"
default n
depends on DEBUG_VERSION && SHELL
help
Answer Y to enable LiteOS support shell excInfo.
endmenu
shell/full/src/cmds/excinfo_shell.c
已删除
100644 → 0
浏览文件 @
41f20751
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "shcmd.h"
#include "los_memory.h"
#ifdef LOSCFG_SHELL_EXCINFO
#include "los_excinfo_pri.h"
INT32
osShellCmdReadExcInfo
(
INT32
argc
,
CHAR
**
argv
)
{
UINT32
recordSpace
=
GetRecordSpace
();
(
VOID
)
argc
;
(
VOID
)
argv
;
CHAR
*
buf
=
(
CHAR
*
)
LOS_MemAlloc
((
void
*
)
OS_SYS_MEM_ADDR
,
recordSpace
+
1
);
if
(
buf
==
NULL
)
{
return
LOS_NOK
;
}
(
void
)
memset_s
(
buf
,
recordSpace
+
1
,
0
,
recordSpace
+
1
);
log_read_write_fn
hook
=
GetExcInfoRW
();
if
(
hook
!=
NULL
)
{
hook
(
GetRecordAddr
(),
recordSpace
,
1
,
buf
);
}
PRINTK
(
"%s
\n
"
,
buf
);
(
VOID
)
LOS_MemFree
((
void
*
)
OS_SYS_MEM_ADDR
,
buf
);
buf
=
NULL
;
return
LOS_OK
;
}
SHELLCMD_ENTRY
(
readExcInfo_shellcmd
,
CMD_TYPE_EX
,
"excInfo"
,
0
,
(
CmdCallBackFunc
)
osShellCmdReadExcInfo
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录