ucosii移植的问题
<p>我学习ucosii,试图把ucosii移植到51单片机上。</p><pre>
<code>#if OS_TASK_CREATE_EN > 0u
INT8UOSTaskCreate (void (*task)(void *p_arg),
voididata*p_arg,
OS_STK idata *ptos,
INT8U prio)reentrant
{
OS_STKidata*psp;
INT8U err;
//#if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */
// OS_CPU_SRcpu_sr = 0u;
//#endif
#if OS_ARG_CHK_EN > 0u
if (prio > OS_LOWEST_PRIO) { /* Make sure priority is within allowable range */
return (OS_PRIO_INVALID);
}
#endif
OS_ENTER_CRITICAL();
if (OSIntNesting > 0u) { /* Make sure we don't create the task from within an ISR*/
OS_EXIT_CRITICAL();
//return (OS_TASK_CREATE_ISR);
return (OS_TASK_DEL_ERR);
}
if (OSTCBPrioTbl == (OS_TCB idata *)0) { /* Make sure task doesn't already exist at this priority*/
OSTCBPrioTbl = OS_TCB_RESERVED;/* Reserve the priority to prevent others from doing ...*/
/* ... the same thing until task is created. */
OS_EXIT_CRITICAL();
psp = OSTaskStkInit(task, p_arg, ptos, 0u); /* Initialize the task's stack */
err = OS_TCBInit(prio, psp, (OS_STK *)0, 0u, 0u, (void *)0, 0u);
if (err == OS_ERR_NONE) {
if (OSRunning == OS_TRUE) { /* Find highest priority task if multitasking has started */
OS_Sched();
}
} else {
OS_ENTER_CRITICAL();
OSTCBPrioTbl = (OS_TCB *)0;/* Make this priority available to others */
OS_EXIT_CRITICAL();
}
return (err);
}
OS_EXIT_CRITICAL();
return (OS_ERR_PRIO_EXIST);
}
#endif</code></pre>
<pre>
<code>#if OS_TASK_CREATE_EN > 0u
INT8U OSTaskCreate (void (*task)(void *p_arg),
void idata *p_arg,
OS_STK idata *ptos,
INT8U prio)reentrant;
#endif</code></pre>
<pre>
<code>#define task1prio 2
#define task2prio 4
sbit P10 =P1^0;
sbit P11 =P1^1;
INT8U data task1stk;
INT8U idata task2stk;
void max(void)reentrant ;
void task1(void);
void task2(void);
void main(void)
{
Time_Init ();
OSInit();
OSTaskCreate(task1,(void* )0,task1stk,task1prio);
//OSTaskCreate(task1,(void * )0,&task1stk,2);
OSTaskCreate(task2,(void * )0,task2stk,task2prio);
OSStart();
}
void task1(void)
{
while(1)
{
P10 = !P10;
//max();
OSTimeDlyHMSM(0,0,1,0);
}
}
void task2(void)
{
while(1)
{
P11 = !P11;
OSTimeDlyHMSM(0,0,2,0);
}
}
void max(void)reentrant
{
INT32U i;
i++;
}</code></pre>
<p>可是编译有两个不对劲的警告</p>
<div style="text-align: center;"></div>
<div style="text-align: center;">产生警告的语句如下:</div>
<div style="text-align: center;">
<pre>
<code>OSTaskCreate(task1,(void* )0,task1stk,task1prio);
//OSTaskCreate(task1,(void * )0,&task1stk,2);
OSTaskCreate(task2,(void * )0,task2stk,task2prio);</code></pre>
<p> </p>
<p>请问高手,哪里出了问题?如何解决?谢谢!</p>
</div>
<p> </p>
<p>支持楼主,不过咱也不知道是什么原因,期待大佬能提供答案</p>
<p>没玩过。。。。但看楼主截图上,不是说main.c的37行、39行问题吗</p>
<p>pointer to differenct objects</p>
<p>指向不同对象的指针,意思是,你的指针指向的类型不一致?</p>
<p>没有盲移植过,都是别人移植成功了,才自己拿着别人的代码移植,里面有一段代码非常重要,牵涉到内核 入栈出栈,内存保护的,还有一个定时器也非常重要。</p>
页:
[1]