请教大家关于uC/OS-II在DP256B上移植方面的问题:
- UID
- 128566
- 性别
- 男
|
请教大家关于uC/OS-II在DP256B上移植方面的问题:
我在程序中把任务延时函数OSTimeDly()注释掉了,只是保留了信号量模块(等待和发送),想问一下这样会影响任务调度吗?我先用BDM头向目标板下载了监控程序,所以能够在超级终端上看到程序的执行情况。我一共建立了三个任务,分别是TaskStart、Task1、Task2,但是每次只有一个任务在运行,也就是说我可以让它们中任何一个任务运行,但是就觉得内核并没有真正对这些任务进行调度,因为在超级终端上只连续的打印了一个任务的执行次数,这也正是我每个任务的内容。还有我总觉得自己延时函数用不好,请多多帮助,谢谢! |
|
|
|
|
|
- UID
- 128566
- 性别
- 男
|
main.c
#include "includes.h"
#define EXT
#include "main.h"
void TaskStart();
void Task1();
void Task2();
void main(void)
{
HardwareInit();
OSInit();
Semprintp=OSSemCreate(1);
TaskStartData.PPAGE = 0x30;
Task1Data.PPAGE = 0x31;
Task2Data.PPAGE = 0x34;
OSTaskCreate((void *)0x8000, (void*)&TaskStartData, (void*)&TaskStartStk[TASK_STK_SIZE-1], 5);
OSTaskCreate((void *)0x8000, (void*)&Task1Data, (void*)&Task1Stk[TASK_STK_SIZE-1], 10);
OSTaskCreate((void *)0x8000, (void*)&Task2Data, (void*)&Task2Stk[TASK_STK_SIZE-1], 9);
OSStart();
}
|
|
|
|
|
|
- UID
- 128566
- 性别
- 男
|
TaskStart.c
#include "includes.h"
#define EXT extern
#include "main.h"
#pragma CODE_SEG TASKCODESEG //save the TaskStart code in banked flash
#pragma STRING_SEG TASKSTRINGSEG //save the TaskStart string in banked flash
void TaskStart(TASKDATA* pdata);
void TaskStart(TASKDATA* pdata)
{
int j=0;
int i=0;
RTICTL = 0x64;
CRGINT |=0x80;
for(;;)
{
if (j == 0)
{
PORTB &= 0xe7;
j = 1;
}
else
{
PORTB |= 0x18;
j = 0;
}
OSSemPend(Semprintp,0,&err);
printp(uart_putchar,"\n the numbers of TaskStart is : %5x",i);
OSSemPost(Semprintp);
i++;
//delay 2 second
//OSTimeDly(200);
}
}
pragma CODE_SEG DEFAULT
#pragma STRING_SEG DEFAULT |
|
|
|
|
|
- UID
- 128566
- 性别
- 男
|
Task1.c
#include "includes.h"
#define EXT extern
#include "main.h"
#pragma CODE_SEG TASKCODESEG //save Task1 code in banked flash
#pragma STRING_SEG TASKSTRINGSEG //save Task1 string in banked flash
void Task1(TASKDATA* pdata);
void Task1(TASKDATA* pdata)
{
int i=-100;
int j=0;
for(;;)
{
if (j == 0)
{
PORTB &= 0x7f;
j = 1;
}
else
{
PORTB |= 0x80;
j = 0;
}
OSSemPend(Semprintp,0,&err);
printp(uart_putchar,"\n the numbers of Task1 is : %9x",i);
OSSemPost(Semprintp);
i++;
/* Delay 0.4 second */
//OSTimeDly(40);
}
}
#pragma CODE_SEG DEFAULT
#pragma STRING_SEG DEFAULT
|
|
|
|
|
|
- UID
- 128566
- 性别
- 男
|
Task2.c
#include "includes.h"
#define EXT extern
#include "main.h"
#pragma CODE_SEG TASKCODESEG //save the Task2 code in banked flash
#pragma STRING_SEG TASKSTRINGSEG //save the Task2 string in banked flash
void Task2(TASKDATA* pdata);
void Task2(TASKDATA* pdata)
{
int i=0;
int j=0;
for(;;)
{
if(j == 0)
{
PORTB &= 0xfe;
j = 1;
}
else
{
PORTB |= 0x01;
j = 0;
}
OSSemPend(Semprintp,0,&err);
printp(uart_putchar,"\n the numbers of Task2 is : %9x",i);
OSSemPost(Semprintp);
i++;
/* Delay 1 second */
//OSTimeDly(100);
}
}
#pragma CODE_SEG DEFAULT
#pragma STRING_SEG DEFAULT |
|
|
|
|
|
- UID
- 128566
- 性别
- 男
|
P&E_ICD_Linker.prm:
NAMES END
SEGMENTS
RAM = READ_WRITE 0x1000 TO 0x3FFF;
/* unbanked FLASH ROM */
ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;
ROM_C000 = READ_ONLY 0xC000 TO 0xEEFF;
/* banked FLASH ROM */
TASK_ROM = READ_ONLY 0x8000 TO 0xBFFF;
END
PLACEMENT
TASKCODESEG,
TASKSTRINGSEG INTO TASK_ROM;
DEFAULT_ROM INTO ROM_C000,ROM_4000;
DEFAULT_RAM INTO RAM;
END
STACKSIZE 0x100
ENTRIES
TaskStart
Task1
Task2
END
VECTOR ADDRESS 0xEFFE _Startup
VECTOR ADDRESS 0xEFF0 OSTickISR
VECTOR ADDRESS 0xEFF6 OSCtxSw
|
|
|
|
|
|
- UID
- 128566
- 性别
- 男
|
大家好,这个问题我后来总算是解决了,就是在选择memory model时,选择small就可以了,现在我想试试在banked时到底行不行,可是现在还没有成功过,请问一下有没有人知道为什么这样就不行呢? |
|
|
|
|
|
- UID
- 134097
- 性别
- 男
|
求教,我的用9s12a64 移植了ucos。 现在无法进入空闲程序 创建新任务时的任务地址都是0xcfd200之类的,这是怎么回事啊?
还想问一个,cpu12单片机能不能建任务时不用指定具体的地址和page。
我直接用任务名代替,然后pdata返回null,这样行吗?
[此贴子已经被作者于2006-3-15 23:18:36编辑过] |
|
|
|
|
|
- UID
- 117299
- 性别
- 男
|
楼主可以详细说一下你是如何将程序写到单片机的过程? |
|
|
|
|
|
- UID
- 130217
- 性别
- 男
|
谁有更多的9s12系列单片机资料阿,共享把,给我一份, 我的信箱wjj_emcu@163.com谢谢 |
|
|
|
|
|