kernel:liteos_m
MCU:stm32f407zgt6
XTS认证的基本介绍请看官方文档zh-cn/device-dev/subsystems/subsys-xts-guide.md · OpenHarmony/docs - Gitee.com
本文仅记录XTS移植的过程。
1. vendor/fx/TunnelControl/config.json
config.json中加入xts子系统。
{
"subsystem": "xts",
"components": [
{
"component": "xts_acts",
"features": []
},
{
"component": "xts_tools",
"features": []
}
]
}
根据test/xts/tools/lite/hctest/src/hctest.c
中函数InitTestSuiteMgr
将会被初始化。在hctest初始化时调用了函数ObtainSystemParams()
。如下所示:
void ObtainSystemParams(void)
{
printf("******To Obtain Product Params Start******\n");
const char* productType = GetDeviceType();
if (productType != NULL) {
printf("The Product Type is [%s]\n", productType);
}
const char* manuFacture = GetManufacture();
if (manuFacture != NULL) {
printf("The manuFacture is [%s]\n", manuFacture);
}
const char* brand = GetBrand();
if (brand != NULL) {
printf("The brand is [%s]\n", brand);
}
const char* marketName = GetMarketName();
if (marketName != NULL) {
printf("The marketName is [%s]\n", marketName);
}
const char* productSeries = GetProductSeries();
if (productSeries != NULL) {
printf("The productSeries is [%s]\n", productSeries);
}
const char* softwareModel = GetSoftwareModel();
if (softwareModel != NULL) {
printf("The softwareModel is [%s]\n", softwareModel);
}
const char* hardWareModel = GetHardwareModel();
if (hardWareModel != NULL) {
printf("The HardwareModel is [%s]\n", hardWareModel);
}
const char* hardWareProfile = GetHardwareProfile();
if (hardWareProfile != NULL) {
printf("The HardwareProfile is [%s]\n", hardWareProfile);
}
const char* serial = GetSerial();
if (serial != NULL) {
printf("The serial is [%s]\n", serial);
}
const char* osName = GetOSFullName();
if (osName != NULL) {
printf("The osName is [%s]\n", osName);
}
const char* displayVersion = GetDisplayVersion();
if (displayVersion != NULL) {
printf("The OS Version is [%s]\n", displayVersion);
}
ObtainProductParams();
printf("******To Obtain Product Params End ******\n");
return;
}
static void InitTestSuiteMgr(void)
{
g_testSuiteManager.test_suites = VECTOR_Make(NULL, NULL);
g_testSuiteManager.GetTestSuite = GetTestSuite;
g_testSuiteManager.RegisterTestSuite = RegisterTestSuite;
g_testSuiteManager.AddTestCase = AddTestCase;
g_testSuiteManager.RemoveTestSuite = RemoveTestSuite;
g_testSuiteManager.RunSpecialTestSuite = RunSpecialTestSuite;
g_testSuiteManager.RunTestSuite = RunTestSuite;
printf("[%10s] HCTest Framework inited.\n", "HCtest Service");
ObtainSystemParams();
}
CORE_INIT(InitTestSuiteMgr);
ObtainSystemParams()
中调用了GetDeviceType()
、GetManufacture()
、GetSoftwareModel()
等,这些函数在base/startup/syspara_lite/interfaces/innerkits/native/syspara/src/parameter.c
中定义。因此需要编译子系统startup下组件syspara_lite。
{
"subsystem": "startup",
"components": [
{
"component": "bootstrap_lite",
"features": []
},
{
"component": "syspara_lite",
"features": []
}
]
},
hb build -f -b debug --gn-args build_xts=true
编译代码,下载并运行。出现如下错误:
Start to run test suite:DfxFuncTestSuite
*************Exception Information**************
Type = 13
ThrdPid = 7
Phase = exc in task
FaultAddr = 0xabababab
Current task info:
Task name = SingleTS03
Task ID = 7
Task SP = 0x2000b2a4
Task ST = 0x2000ad30
Task SS = 0x640
Exception reg dump:
PC = 0x58
LR = 0x0
SP = 0x2000b370
R0 = 0x7
R1 = 0x2000b848
R2 = 0x0
R3 = 0x58
R4 = 0x2000b398
R5 = 0x58
R6 = 0x20000004
R7 = 0x8023fec
R8 = 0x1
R9 = 0x8020247
R10 = 0x801ea4f
R11 = 0x2000b30c
R12 = 0x0
PriMask = 0x0
xPSR = 0x59
----- backtrace start -----
backtrace 0 -- lr = 0x801e65a
backtrace 1 -- lr = 0x8016c6e
backtrace 2 -- lr = 0x801e682
backtrace 3 -- lr = 0x8016c5c
backtrace 4 -- lr = 0x8013d36
backtrace 5 -- lr = 0x8013eda
backtrace 6 -- lr = 0x8011388
backtrace 7 -- lr = 0x801da5c
backtrace 8 -- lr = 0x801cebc
backtrace 9 -- lr = 0x801d704
backtrace 10 -- lr = 0x8015800
backtrace 11 -- lr = 0x801589a
backtrace 12 -- lr = 0x80168fa
backtrace 13 -- lr = 0x8015800
backtrace 14 -- lr = 0x801e9a6
----- backtrace end -----
TID Priority Status StackSize WaterLine StackPoint TopOfStack EventMask SemID TaskEntry name
--- -------- -------- --------- --------- ---------- ---------- --------- ------ ---------- ----
0 0 Pend 0x2d0 0x164 0x20004ec4 0x20004d58 0 0xffff 0x8014bd1 Swt_Task
1 31 Ready 0x500 0xcc 0x2000546c 0x20005038 0 0xffff 0x80150a5 IdleCore000
2 9 Pend 0x800 0x738 0x20007ec4 0x20007878 0 0xffff 0x801d6e5 Bootstrap
3 2 Pend 0x800 0x738 0x200086cc 0x20008080 0 0xffff 0x801d6e5 Broadcast
4 10 Delay 0x1800 0x738 0x20009eb4 0x20008890 0 0xffff 0x801d6e5 HCTEST
5 25 Ready 0x640 0xcc 0x2000a60c 0x2000a098 0 0xffff 0x801d6e5 SingleTS01
6 18 Ready 0x640 0xcc 0x2000ac5c 0x2000a6e8 0 0xffff 0x801d6e5 SingleTS02
7 10 Running 0x640 0xe8 0x2000b2a4 0x2000ad30 0 0xffff 0x801d6e5 SingleTS03
[ERR][SingleTS03]CURRENT task SingleTS04 stack overflow!
8 2 Pend 0x6400xffffffff 0x2000b80c 0x2000b380 0 0xffff 0x801d6e5 SingleTS04
9 10 Ready 0x640 0xcc 0x2000bf3c 0x2000b9c8 0 0xffff 0x801d6e5 SpecifiedT01
10 10 Ready 0x800 0xcc 0x2000c74c 0x2000c018 0 0xffff 0x801d6e5 hiview
11 6 Delay 0x130 0xfc 0x2000c854 0x2000c820 0 0xffff 0x80168e9 led
OS exception NVIC dump:
interrupt enable register, base address: 0xe000e100, size: 0x20
0x0 0x400020 0x0 0x0 0x0 0x0 0x0 0x0
interrupt pending register, base address: 0xe000e200, size: 0x20
0x0 0x400000 0x0 0x0 0x0 0x0 0x0 0x0
interrupt active register, base address: 0xe000e300, size: 0x20
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
interrupt priority register, base address: 0xe000e400, size: 0xf0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
interrupt exception register, base address: 0xe000ed18, size: 0xc
0x0 0x0 0xf0f00000
interrupt shcsr register, base address: 0xe000ed24, size: 0x4
0x70008
interrupt control register, base address: 0xe000ed04, size: 0x4
0x4446806
memory pools check:
[ERR][SingleTS03][OsMemIntegrityCheckSub], 1697, memory check error!
node prev: 0x400 is out of legal mem range
broken node head: 0x400 0x2000b420 0x8020244 0x20000004, prev node head: 0x2000a6dc 0x8000064c
[ERR][SingleTS03]Memory integrity check error, cur node: 0x2001fdfc, pre node: 0x0
msp, start = 2001fd58, end = 20020000
taskName = SingleTS03
taskID = 7
----- traceback start -----
traceback 0 -- lr = 0x80161a2
traceback 1 -- lr = 0x8010b08
traceback 2 -- lr = 0x801e9a6
traceback 3 -- lr = 0x801eeb8
traceback 4 -- lr = 0x801e9a6
traceback 5 -- lr = 0x801ea4e
traceback 6 -- lr = 0x8016a74
----- traceback end -----
名为SingleTS03的任务,栈溢出了。找到test/xts/acts/distributed_schedule_lite/system_ability_manager_hal/src/taskpool_singletask_func_test.c
下函数GetTaskConfig
。做如下更改:
// test/xts/acts/distributed_schedule_lite/system_ability_manager_hal/src/taskpool_singletask_func_test.c
static TaskConfig GetTaskConfig(Service *service)
{
// stackSize: valid stackSize is [1600, 342000), the L0 RAM size is 342000, if stackSize <= 800, system will crash
// queueSize: [0, system upper limit), 0: will not create taskpool, the max value depends on RAM size
// priority: PRI_ABOVE_NORMAL PRI_NORMAL PRI_BELOW_NORMAL PRI_LOW
//TaskConfig config = { LEVEL_HIGH, PRI_NORMAL, 1600, 2, SINGLE_TASK };
TaskConfig config = { LEVEL_HIGH, PRI_NORMAL, 2048, 2, SINGLE_TASK };
if (service == (Service *)&g_service[INDEX0]) {
config.priority = PRI_LOW;
} else if (service == (Service *)&g_service[INDEX1]) {
config.priority = PRI_BELOW_NORMAL;
} else if (service == (Service *)&g_service[INDEX2]) {
config.priority = PRI_NORMAL;
} else {
config.priority = PRI_ABOVE_NORMAL;
}
return config;
}
hb build -f -b debug --gn-args build_xts=true
编译代码,下载并运行。出现如下错误:
*************Exception Information**************
Type = 17
ThrdPid = 8
Phase = exc in task
FaultAddr = 0x203a5293
Current task info:
Task name = SingleTS04
Task ID = 8
Task SP = 0x2000bf0c
Task ST = 0x2000b8c0
Task SS = 0x800
Exception reg dump:
PC = 0x8013dfc
LR = 0x8013d3b
SP = 0x2000bfd8
R0 = 0x203a526f
R1 = 0x59
R2 = 0x28
R3 = 0x24
R4 = 0x20003e54
R5 = 0x0
R6 = 0x0
R7 = 0x2000bfd8
R8 = 0x2000c078
R9 = 0x134
R10 = 0x2000c030
R11 = 0x0
R12 = 0x2
PriMask = 0x1
xPSR = 0x21000000
----- backtrace start -----
backtrace 0 -- lr = 0x801e9a6
backtrace 1 -- lr = 0x801eeb8
backtrace 2 -- lr = 0x801e9a6
backtrace 3 -- lr = 0x801ea4e
backtrace 4 -- lr = 0x801da5c
backtrace 5 -- lr = 0x801d704
backtrace 6 -- lr = 0x8015800
backtrace 7 -- lr = 0x801e65a
backtrace 8 -- lr = 0x8016c6e
backtrace 9 -- lr = 0x801e682
backtrace 10 -- lr = 0x8016c5c
backtrace 11 -- lr = 0x8013d36
backtrace 12 -- lr = 0x8013eda
backtrace 13 -- lr = 0x8011388
backtrace 14 -- lr = 0x801da5c
----- backtrace end -----
TID Priority Status StackSize WaterLine StackPoint TopOfStack EventMask SemID TaskEntry name
--- -------- -------- --------- --------- ---------- ---------- --------- ------ ---------- ----
0 0 Pend 0x2d0 0x164 0x20004ec4 0x20004d58 0 0xffff 0x8014bd1 Swt_Task
1 31 Ready 0x500 0xe4 0x20005454 0x20005038 0 0xffff 0x80150a5 IdleCore000
2 9 Pend 0x800 0x770 0x20007ec4 0x20007878 0 0xffff 0x801d6e5 Bootstrap
3 2 Pend 0x800 0x738 0x200086cc 0x20008080 0 0xffff 0x801d6e5 Broadcast
4 10 Ready 0x1800 0x828 0x20009dbc 0x20008890 0 0xffff 0x801d6e5 HCTEST
5 25 Pend 0x800 0x750 0x2000a6e4 0x2000a098 0 0xffff 0x801d6e5 SingleTS01
6 18 Pend 0x800 0x738 0x2000aef4 0x2000a8a8 0 0xffff 0x801d6e5 SingleTS02
7 10 Pend 0x800 0x738 0x2000b6fc 0x2000b0b0 0 0xffff 0x801d6e5 SingleTS03
8 2 Running 0x800 0x738 0x2000bf0c 0x2000b8c0 0 0xffff 0x801d6e5 SingleTS04
[ERR][SingleTS04]CURRENT task SpecifiedT01 stack overflow!
9 10 Pend 0x6400xffffffff 0x2000c554 0x2000c0c8 0 0xffff 0x801d6e5 SpecifiedT01
10 10 Pend 0x800 0x738 0x2000cd64 0x2000c718 0 0xffff 0x801d6e5 hiview
11 6 Delay 0x130 0xfc 0x2000cf54 0x2000cf20 0 0xffff 0x80168e9 led
12 6 Delay 0x130 0xfc 0x2000d204 0x2000d1d0 0 0xffff 0x80168e9 led
13 1 Pend 0x800 0x240 0x2000de2c 0x2000d7e0 0 0xffff 0x801d6e5 serviceName501
OS exception NVIC dump:
interrupt enable register, base address: 0xe000e100, size: 0x20
0x0 0x400020 0x0 0x0 0x0 0x0 0x0 0x0
interrupt pending register, base address: 0xe000e200, size: 0x20
0x0 0x400000 0x20000 0x0 0x0 0x0 0x0 0x0
interrupt active register, base address: 0xe000e300, size: 0x20
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
interrupt priority register, base address: 0xe000e400, size: 0xf0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
interrupt exception register, base address: 0xe000ed18, size: 0xc
0x0 0x0 0xf0f00000
interrupt shcsr register, base address: 0xe000ed24, size: 0x4
0x70000
interrupt control register, base address: 0xe000ed04, size: 0x4
0x4446803
memory pools check:
[ERR][SingleTS04][OsMemIntegrityCheckSub], 1697, memory check error!
node prev: 0x20000004 is out of legal mem range
broken node head: 0x20000004 0x5f 0x2000c168 0x8020244, prev node head: 0x2000b0a8 0xc000080c
[ERR][SingleTS04]Memory integrity check error, cur node: 0x2001fdfc, pre node: 0x0
msp, start = 2001fd58, end = 20020000
taskName = SingleTS04
taskID = 8
----- traceback start -----
traceback 0 -- lr = 0x80161a2
traceback 1 -- lr = 0x8010b08
traceback 2 -- lr = 0x8013d3a
traceback 3 -- lr = 0x8013d3a
traceback 4 -- lr = 0x8016a74
----- traceback end -----
名为SpecifiedT01的任务stack overflow!
test/xts/acts/distributed_schedule_lite/system_ability_manager_hal/src/taskpool_specifiedtask_func_test.c
中找到,并修改代码如下:
static TaskConfig GetTaskConfig(Service *service)
{
(void)service;
//TaskConfig config = {LEVEL_HIGH, PRI_NORMAL, 1600, 20, SPECIFIED_TASK};
TaskConfig config = {LEVEL_HIGH, PRI_NORMAL, 2048, 20, SPECIFIED_TASK};
return config;
}
hb build -f -b debug --gn-args build_xts=true
编译代码,下载并运行。
没有提示错误,All the test suites finished!
网友评论