-
你的问题解决了吗?我也急啊
-
12楼你的问题解决了吗?
-
有心就好!谢谢~
-
从官方文档上找到问题所在了!
You should note that these prototypes are prefixed with the special keyword __arm. This is an IAR keyword that indicates that these functions will run in ARM mode and thus, when called, the compiler will generate the appropriate instructions
所以我干脆就把__arm 都删掉了!
这部分的编译已经没有问题了
期待下一个问题的出现!
【另外说明一下:我是从Micrium官网上下的源代码,它是用IAR编译器编译的,所以在Keil上编译有些关键字keil不认识,所以才导致了这一问题】
[ 本帖最后由 ChinaLingBo 于 2011-12-22 14:39 编辑 ]
-
谢谢,这里的__main是不是和__arm一个意思呢?如何解决这个问题呢?求更详细的解答!
-
肿么没有人回答啊?这里急用,谢谢了!
-
求Pdf文档
-
好东西,楼主好人,分享了!!!
-
拿走了,问一个初级问题啊,AVR是不是ATmel的?
-
太高深了,时基是个什么东东?初学者见笑了!
-
谢谢,大概明白了一点,能说的再详细一些吗?:loveliness:
-
/*********************************************************************************************************** TASK #5** Description: This task displays messages sent by Task #4. When the message is displayed, Task #5* acknowledges Task #4.**********************************************************************************************************/
void Task5 (void *data){ char *rxmsg; INT8U err;
data = data; for (;;) { rxmsg = (char *)OSMboxPend(TxMbox, 0, &err); /* Wait for message from Task #4 */ PC_DispChar(70, 18, *rxmsg, DISP_FGND_YELLOW + DISP_BGND_RED); OSTimeDlyHMSM(0, 0, 1, 0); /* Wait 1 second */ OSMboxPost(AckMbox, (void *)1); /* Acknowledge reception of msg */ }}/*$PAGE*//*********************************************************************************************************** CLOCK TASK**********************************************************************************************************/
void TaskClk (void *data){ char s[40];
data = data; for (;;) { PC_GetDateTime(s); PC_DispStr(0, 24, s, DISP_FGND_BLUE + DISP_BGND_CYAN); OSTimeDly(OS_TICKS_PER_SEC); }}
-
/*********************************************************************************************************** CREATE TASKS**********************************************************************************************************/
static void TaskStartCreateTasks (void){ OSTaskCreateExt(TaskClk, (void *)0, &TaskClkStk[TASK_STK_SIZE - 1], TASK_CLK_PRIO, TASK_CLK_ID, &TaskClkStk[0], TASK_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);
OSTaskCreateExt(Task1, (void *)0, &Task1Stk[TASK_STK_SIZE - 1], TASK_1_PRIO, TASK_1_ID, &Task1Stk[0], TASK_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);
OSTaskCreateExt(Task2, (void *)0, &Task2Stk[TASK_STK_SIZE - 1], TASK_2_PRIO, TASK_2_ID, &Task2Stk[0], TASK_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);
OSTaskCreateExt(Task3, (void *)0, &Task3Stk[TASK_STK_SIZE - 1], TASK_3_PRIO, TASK_3_ID, &Task3Stk[0], TASK_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);
OSTaskCreateExt(Task4, (void *)0, &Task4Stk[TASK_STK_SIZE-1], TASK_4_PRIO, TASK_4_ID, &Task4Stk[0], TASK_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);
OSTaskCreateExt(Task5, (void *)0, &Task5Stk[TASK_STK_SIZE-1], TASK_5_PRIO, TASK_5_ID, &Task5Stk[0], TASK_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);}
/*$PAGE*//*********************************************************************************************************** TASK #1** Description: This task executes every 100 mS and measures the time it task to perform stack checking* for each of the 5 application tasks. Also, this task displays the statistics related to* each task's stack usage.**********************************************************************************************************/
void Task1 (void *pdata){ INT8U err; OS_STK_DATA data; /* Storage for task stack data */ INT16U time; /* Execution time (in uS) */ INT8U i; char s[80];
pdata = pdata; for (;;) { for (i = 0; i < 7; i++) { PC_ElapsedStart(); err = OSTaskStkChk(TASK_START_PRIO+i, &data); time = PC_ElapsedStop(); if (err == OS_NO_ERR) { sprintf(s, "%4ld %4ld %4ld %6d", data.OSFree + data.OSUsed, data.OSFree, data.OSUsed, time); PC_DispStr(19, 12+i, s, DISP_FGND_YELLOW); } } OSTimeDlyHMSM(0, 0, 0, 100); /* Delay for 100 mS */ }}/*$PAGE*//*********************************************************************************************************** TASK #2** Description: This task displays a clockwise rotating wheel on the screen.**********************************************************************************************************/
void Task2 (void *data){ data = data; for (;;) { PC_DispChar(70, 15, '|', DISP_FGND_WHITE + DISP_BGND_RED); OSTimeDly(10); PC_DispChar(70, 15, '/', DISP_FGND_WHITE + DISP_BGND_RED); OSTimeDly(10); PC_DispChar(70, 15, '-', DISP_FGND_WHITE + DISP_BGND_RED); OSTimeDly(10); PC_DispChar(70, 15, '\\', DISP_FGND_WHITE + DISP_BGND_RED); OSTimeDly(10); }}/*$PAGE*//*********************************************************************************************************** TASK #3** Description: This task displays a counter-clockwise rotating wheel on the screen.** Note(s) : I allocated 100 bytes of storage on the stack to artificially 'eat' up stack space.**********************************************************************************************************/
void Task3 (void *data){ char dummy[500]; INT16U i;
data = data; for (i = 0; i < 499; i++) { /* Use up the stack with 'junk' */ dummy = '?'; } for (;;) { PC_DispChar(70, 16, '|', DISP_FGND_WHITE + DISP_BGND_BLUE); OSTimeDly(20); PC_DispChar(70, 16, '\\', DISP_FGND_WHITE + DISP_BGND_BLUE); OSTimeDly(20); PC_DispChar(70, 16, '-', DISP_FGND_WHITE + DISP_BGND_BLUE); OSTimeDly(20); PC_DispChar(70, 16, '/', DISP_FGND_WHITE + DISP_BGND_BLUE); OSTimeDly(20); }}/*$PAGE*//*********************************************************************************************************** TASK #4** Description: This task sends a message to Task #5. The message consist of a character that needs to* be displayed by Task #5. This task then waits for an acknowledgement from Task #5* indicating that the message has been displayed.**********************************************************************************************************/
void Task4 (void *data){ char txmsg; /*这儿为什么用char来定义数据类型呢?*/ INT8U err;
data = data; txmsg = 'A'; for (;;) { while (txmsg <= 'Z') { OSMboxPost(TxMbox, (void *)&txmsg); /* Send message to Task #5 */ OSMboxPend(AckMbox, 0, &err); /* Wait for acknowledgement from Task #5 */ txmsg++; /* Next message to send */ } txmsg = 'A'; /* Start new series of messages */ }}/*$PAGE*/
-
/*
*********************************************************************************************************
* STARTUP TASK
*********************************************************************************************************
*/
void TaskStart (void *data)
{
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr;
#endif
char s[80];
INT16S key;
data = data; /* Prevent compiler warning */
PC_DispStr(26, 0, "uC/OS-II, The Real-Time Kernel", DISP_FGND_WHITE + DISP_BGND_RED + DISP_BLINK);
PC_DispStr(33, 1, "Jean J. Labrosse", DISP_FGND_WHITE);
PC_DispStr(36, 3, "EXAMPLE #2", DISP_FGND_WHITE);
PC_DispStr( 0, 9, "Task Total Stack Free Stack Used Stack ExecTime (uS)", DISP_FGND_WHITE);
PC_DispStr( 0, 10, "------------- ----------- ---------- ---------- -------------", DISP_FGND_WHITE);
PC_DispStr( 0, 12, "TaskStart():", DISP_FGND_WHITE);
PC_DispStr( 0, 13, "TaskClk() :", DISP_FGND_WHITE);
PC_DispStr( 0, 14, "Task1() :", DISP_FGND_WHITE);
PC_DispStr( 0, 15, "Task2() :", DISP_FGND_WHITE);
PC_DispStr( 0, 16, "Task3() :", DISP_FGND_WHITE);
PC_DispStr( 0, 17, "Task4() :", DISP_FGND_WHITE);
PC_DispStr( 0, 18, "Task5() :", DISP_FGND_WHITE);
PC_DispStr(28, 24, "", DISP_FGND_WHITE + DISP_BLINK);
OS_ENTER_CRITICAL(); /* Install uC/OS-II's clock tick ISR */
PC_VectSet(0x08, OSTickISR);
PC_SetTickRate(OS_TICKS_PER_SEC); /* Reprogram tick rate */
OS_EXIT_CRITICAL();
PC_DispStr(0, 22, "Determining CPU's capacity ...", DISP_FGND_WHITE);
OSStatInit(); /* Initialize uC/OS-II's statistics */
PC_DispClrRow(22, DISP_FGND_WHITE + DISP_BGND_BLACK);
AckMbox = OSMboxCreate((void *)0); /* Create 2 message mailboxes */
TxMbox = OSMboxCreate((void *)0);
TaskStartCreateTasks(); /* Create all other tasks */
PC_DispStr( 0, 22, "#Tasks : xxxxx CPU Usage: xxx %", DISP_FGND_WHITE);
PC_DispStr( 0, 23, "#Task switch/sec: xxxxx", DISP_FGND_WHITE);
for (;;) {
sprintf(s, "%5d", OSTaskCtr); /* Display #tasks running */
PC_DispStr(18, 22, s, DISP_FGND_BLUE + DISP_BGND_CYAN);
sprintf(s, "%3d", OSCPUUsage); /* Display CPU usage in % */
PC_DispStr(36, 22, s, DISP_FGND_BLUE + DISP_BGND_CYAN);
sprintf(s, "%5d", OSCtxSwCtr); /* Display #context switches per second */
PC_DispStr(18, 23, s, DISP_FGND_BLUE + DISP_BGND_CYAN);
OSCtxSwCtr = 0; /* Clear context switch counter */
sprintf(s, "V%3.2f", OSVersion() * 0.01);
PC_DispStr(75, 24, s, DISP_FGND_YELLOW + DISP_BGND_BLUE);
switch (TaskFPUFlag) {
case 0:
PC_DispStr(71, 22, " NO FPU ", DISP_FGND_BLUE + DISP_BGND_CYAN);
break;
case 1:
PC_DispStr(71, 22, " 8087 FPU", DISP_FGND_BLUE + DISP_BGND_CYAN);
break;
case 2:
PC_DispStr(71, 22, "80287 FPU", DISP_FGND_BLUE + DISP_BGND_CYAN);
break;
case 3:
PC_DispStr(71, 22, "80387 FPU", DISP_FGND_BLUE + DISP_BGND_CYAN);
break;
}
if (PC_GetKey(&key)) { /* See if key has been pressed */
if (key == 0x1B) { /* Yes, see if it's the ESCAPE key */
PC_DOSReturn(); /* Yes, return to DOS */
}
}
OSTimeDly(OS_TICKS_PER_SEC); /* Wait one second */
}
}
/*$PAGE*/