同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Add the sample program file main.c to the device directory of the project and compile the file. After LOS_KernelInit is complete, this sample program will create two tasks that loop the LOS_TaskDelay function and print the log information cyclically. In this way, you can check whether system scheduling and the clock work properly.
VOID TaskSampleEntry2(VOID) // Entry function of task 2
{
while(1) {
LOS_TaskDelay(10000);
printf("taskSampleEntry2 running...\n");
}
}
VOID TaskSampleEntry1(VOID) // Entry function of task 1
{
while(1) {
LOS_TaskDelay(2000);
printf("taskSampleEntry1 running...\n");
}
}
UINT32 TaskSample(VOID)
{
UINT32 uwRet;
UINT32 taskID1,taskID2;
TSK_INIT_PARAM_S stTask1={0};
stTask1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry1;
stTask1.uwStackSize = 0X1000;
stTask1.pcName = "taskSampleEntry1";
stTask1.usTaskPrio = 6; // Set the priority of stTask1, which is different from that of stTask2.
uwRet = LOS_TaskCreate(&taskID1, &stTask1);
stTask1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry2;
stTask1.uwStackSize = 0X1000;
stTask1.pcName = "taskSampleEntry2";
stTask1.usTaskPrio = 7;
uwRet = LOS_TaskCreate(&taskID2, &stTask1);
return LOS_OK;
}
LITE_OS_SEC_TEXT_INIT int main(void)
{
UINT32 ret;
UartInit(); // Configure the hardware serial port and output the debug log over this serial port. The actual function name varies with the board.
printf("\n\rhello world!!\n\r");
ret = LOS_KernelInit();
TaskSample();
if (ret == LOS_OK) {
LOS_Start(); // Start system scheduling, execute stTask1/stTask2 cyclically, and output task logs over the serial port.
}
while (1) {
__asm volatile("wfi");
}
}
If the first task is executed properly, the core process of the minimum system is valid. Due to the XTS framework's dependency on the link scripts of Utils and Bootstrap as well as the building framework, testing the kernel by executing the XTS is not supported. You can test whether the minimum system is completely ported in XTS.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。