Quote: |
yes,i put the license at the end of license which is build while setuo cw . |
thank for your reply,i compile and pass it.but i have nothing to do with it,maybe my pc have ever some problems.
Posted: Thu Aug 18, 2005 8:54 am
i download a rutine from www.ucosii.com.in this routine i learned that "Tasks do not have to be in NON-PAGED memory.That is why I added an extra byte in every task's stack to save the PPAGE register that locate the memory page where the task is located. If a context switch occurs, the proper page will be saved/restored by uC/OS-II. This done automatically by the hardware provided that we add the option -CpPPAGE=0x30 as a compiler argument."
i can't understand why this done automatically by the hardware provided that we add the option -CpPPAGE=0x30 as a compiler argument.i believe that if the option -CpPPAGE=0x30 as a compiler argument,the page switch do not switch automaticlly but page always at 0x30.
if add the option -CpPPAGE=RUNTIME as a compiler argument,the page switch automatically.
what is right?can you explain it for me in detail?
thank you very much1!
Posted: Thu Aug 18, 2005 9:30 am
This compiler switch tells the compiler the address location of the PPAGE register and has nothing to do with the contents of the register. In other words this does not define a particular page to use.
The S12 has an opcode (CALL) that automatically loads the correct page for the subroutine and the matching RTC opcode switches back to the source page - read the description of these opcodes and this will help you understand how the part works. In fact for code usage the location of the PPAGE register is irrelevant because its value is included in the CALL opcode anyway.
Posted: Fri Aug 19, 2005 10:46 am
1)what's difference between -CpPPAGE=RUNTIME and -CpPPAGE=0x30.
2)a project downloaded from ucosii website is a port of MicroC/OS-II targeted to the Motorola microcontroller MC9S12DP256 using Metrowerks Codewarrior. how do task level comtext switch in this project?any code about page switch can't find.
i have learned much from here!
thanks.
Code:
/******************************************************************************************************** ;******************************************************************************************************** ; TASK LEVEL CONTEXT SWITCH ; ; Description : This function is called when a task makes a higher priority task ready-to-run. ; ; Arguments : none ; ; Note(s) : 1) Upon entry, ; OSTCBCur points to the OS_TCB of the task to suspend ; OSTCBHighRdy points to the OS_TCB of the task to resume ; ; 2) The stack frame of the task to suspend looks as follows: ; ; SP + 0 --> PPAGE ; + 1 CCR ; + 2 B ; + 3 A ; + 4 X (H) ; + 5 X (L) ; + 6 Y (H) ; + 7 Y (L) ; + 8 PC(H) ; + 9 PC(L) ; ; 3) The stack frame of the task to resume looks as follows: ; ; OSTCBHighRdy->OSTCBStkPtr + 0 --> PPAGE ; + 1 CCR ; + 2 B ; + 3 A ; + 4 X (H) ; + 5 X (L) ; + 6 Y (H) ; + 7 Y (L) ; + 8 PC(H) ; + 9 PC(L) ;******************************************************************************************************** ;*********************************************************************************************************/ #pragma TRAP_PROC void OSCtxSw(void) { __asm{ ldx OSTCBCur ; 3~, OSTCBCur->OSTCBStkPtr = Stack Pointer sts 0,x ; 3~ } #if OS_CPU_HOOKS_EN > 0 OSTaskSwHook(); /* 4~, Invoke user defined context switch hook */ #endif __asm{ ldx OSTCBHighRdy ; 3~, OSTCBCur = OSTCBHighRdy stx OSTCBCur ; 3~ ldab OSPrioHighRdy ; 3~, OSPrioCur = OSPrioHighRdy stab OSPrioCur ; 3~ lds 0,x ; 3~, Load SP into 68HC12 } }
Does -CpPPAGE=RUNTIME work? You didn't quite say if it does. The reason to give the address of PPAGE is because some target might have PPAGE register at address 0x1030 or something like that. If RUNTIME works, then it must be assuming that the address is 0x30 for the register.