将LiteOs-m操作系统迁移到RISCV架构的芯片上(HX280049),完成软件中断和定时器中断配置后,同时创建两个任务:LiteOs_1,LiteOs_2,开始调度后,会进入ASSERT;

 

LiteOs_1优先级为2,90个tick执行一次;LiteOs_2优先级为1,100个tick执行一次;

    (VOID)memset((void *)(&task_init_param1), 0, sizeof(TSK_INIT_PARAM_S));
    task_init_param1.usTaskPrio = 2; /* 任务优先级,数值越小,优先级越高*/
    task_init_param1.pcName = "LiteOs_2";/* 任务名称 */
    task_init_param1.pfnTaskEntry = (TSK_ENTRY_FUNC)liteOsTask2;
    task_init_param1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;   /* 任务栈大小 */

    uwRet = LOS_TaskCreate(&Test2_Task_Handle, &task_init_param1);
    if(uwRet != LOS_OK){
    	printf("Create Task LiteOS 2 Failed!\r\n");
    }

    TSK_INIT_PARAM_S task_init_param2; /*定义一个局部变量 */
    (VOID)memset((void *)(&task_init_param2), 0, sizeof(TSK_INIT_PARAM_S));
    task_init_param2.usTaskPrio = 1; /* 任务优先级,数值越小,优先级越高*/
    task_init_param2.pcName = "LiteOs_1";/* 任务名称 */
    task_init_param2.pfnTaskEntry = (TSK_ENTRY_FUNC)liteOsTask1;
    task_init_param2.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;   /* 任务栈大小 */

    uwRet = LOS_TaskCreate(&Test1_Task_Handle, &task_init_param2);
	if(uwRet != LOS_OK){
		printf("Create Task LiteOS 1 Failed!\r\n");
	}

由于HX280049的定时器是32位,而LiteOs-m默认64位,就将LiteOs的UINT64全部改为32;

typedef unsigned long     UINT64;
typedef signed long       INT64;
//typedef unsigned long long     UINT64;
//typedef signed long long       INT64;

首先进入Swt_Task,之后进入LiteOs_1,之后LiteOs_2,之后IdleCore000,最后LiteOs_1任务,然后直接进入ASSERT;

Hello World! This is LiteOS!
entering kernel init...
Entering scheduler
OsTaskEntry taskCB taskName: Swt_Task
This is Swtmr Task! 
OsTaskEntry taskCB taskName: LiteOs_1
This is liteOsTask 1!

OsTaskEntry taskCB taskName: LiteOs_2
Hello World! This is liteOsTask 2!
OsTaskEntry taskCB taskName: IdleCore000
This is OSIdle Task! 
[ERR][IdleCore000]ASSERT ERROR! ../liteOs_m/kernel/src/los_sched.c, 79, OsTimeSliceUpdate

 

Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐