ayb_ice 发表于 2014-5-29 10:38 
公用的寄存器
比如51
R0~R7,A,B,DPTR,PSW
OS_STK *OSTaskStkInit(void (*task)(void *pd),void *pdata,OS_STK *ptos,INT16U opt)
{
OS_STK *stk;
opt = opt;
stk = ptos;
*stk = (OS_STK)task; // PC
*stk = (OS_STK)task; // LR
*--stk = ptos; // SP
*--stk = 0x12121212; // R12
*--stk = 0x11111111; // R11
*--stk = 0x10101010; // R10
*--stk = 0x09090909; // R9
*--stk = 0x08080808; // R8
*--stk = 0x07070707; // R7
*--stk = 0x06060606; // R6
*--stk = 0x05050505; // R5
*--stk = 0x04040404; // R4
*--stk = 0x03030303; // R3
*--stk = 0x02020202; // R2
*--stk = 0x01010101; // R1
*--stk = 0x00000000; // R0
return (stk)
}
我这样写的对吗??硬件平台为CORTEX-MO+,完全不明白,这个堆栈初始化的过程,当任务运行时,UCOS怎么知道我是以怎样的方式入栈的呢?它有没规定排列方式,怎样去获取有用的信息咧!!!!!
求教!!!
|