No.84262 作者:mihanily 邮件:mihanily@163.com ID:42640 登陆:2次 文章数:1篇 最后登陆IP:221.196.189.146 最后登陆:2006/9/26 22:53:05 注册:2005/9/28 10:38:37 财富:106 发帖时间:2005/9/28 11:02:50 发贴者IP:218.68.242.178 标题:mihanily:编译uC/OS_ii 摘要:No.84262编译uC/OS_ii 在实模式、大模式下编译uC/OS_ii 在Borland C++6 中的c语言项目中加入OS_CPU_A.ASM文件,编译后报错如下: [Linker Fatal Error] Fatal: Unsupported 16-bit segment(s) in module H:\SOFTWARE\uCOS\Ix86L\BC45\OS_CPU_A.ASM 估计是由于OS_CPU_A.ASM文件中的命令为16位的,无法和Borland C++6编译的32位的程序兼容造成的;但是如何才能解决这个问题呢??? Borland C/C++ V4.51(Borland Turbo C++ 4.5)是否为16位的,在哪里能得到??? 下面是OS_CPU_A.ASM文件,如何才能编译通过?请诸位大虾指教!! ;******************************************************************************************************** ; PUBLIC and EXTERNAL REFERENCES ;******************************************************************************************************** PUBLIC _OSTickISR PUBLIC _OSStartHighRdy PUBLIC _OSCtxSw PUBLIC _OSIntCtxSw EXTRN _OSIntExit:FAR EXTRN _OSTimeTick:FAR EXTRN _OSTaskSwHook:FAR EXTRN _OSIntNesting:BYTE EXTRN _OSTickDOSCtr:BYTE EXTRN _OSPrioHighRdy:BYTE EXTRN _OSPrioCur:BYTE EXTRN _OSRunning:BYTE EXTRN _OSTCBCur:DWORD EXTRN _OSTCBHighRdy:DWORD .MODEL LARGE .CODE .186 PAGE ; /*$PAGE*/ ;********************************************************************************************************* ; START MULTITASKING ; void OSStartHighRdy(void) ; ; The stack frame is assumed to look as follows: ; ; OSTCBHighRdy-> OSTCBStkPtr --> DS (Low memory) ; ES ; DI ; SI ; BP ; SP ; BX ; DX ; CX ; AX ; OFFSET of task code address ; SEGMENT of task code address ; Flags to load in PSW ; OFFSET of task code address ; SEGMENT of task code address ; OFFSET of 'pdata' ; SEGMENT of 'pdata' (High memory) ; ; Note : OSStartHighRdy() MUST: ; a) Call OSTaskSwHook() then, ; b) Set OSRunning to TRUE, ; c) Switch to the highest priority task. ;********************************************************************************************************* _OSStartHighRdy PROC FAR MOV AX, SEG _OSTCBHighRdy ; Reload DS MOV DS, AX ; ; CALL FAR PTR _OSTaskSwHook ; Call user defined task switch hook ; MOV AL, 1 ; OSRunning = TRUE; MOV BYTE PTR DS:_OSRunning, AL ; (Indicates that multitasking has started) ; LES BX, DWORD PTR DS:_OSTCBHighRdy ; SS:SP = OSTCBHighRdy-> OSTCBStkPtr MOV SS, ES:[BX+2] ; MOV SP, ES:[BX+0] ; ; POP DS ; Load task's context POP ES ; POPA ; ; IRET ; Run task _OSStartHighRdy ENDP PAGE ; /*$PAGE*/ ;********************************************************************************************************* ; PERFORM A CONTEXT SWITCH (From task level) ; void OSCtxSw(void) ; ; 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 -> OFFSET of task to suspend (Low memory) ; SEGMENT of task to suspend ; PSW of task to suspend (High memory) ; ; 3) The stack frame of the task to resume looks as follows: ; ; OSTCBHighRdy-> OSTCBStkPtr --> DS (Low memory) ; ES ; DI ; SI ; BP ; SP ; BX ; DX ; CX ; AX ; OFFSET of task code address ; SEGMENT of task code address ; Flags to load in PSW (High memory) ;********************************************************************************************************* _OSCtxSw PROC FAR ; PUSHA ; Save current task's context PUSH ES ; PUSH DS ; ; MOV AX, SEG _OSTCBCur ; Reload DS in case it was altered MOV DS, AX ; ; LES BX, DWORD PTR DS:_OSTCBCur ; OSTCBCur-> OSTCBStkPtr = SS:SP MOV ES:[BX+2], SS ; MOV ES:[BX+0], SP ; ; CALL FAR PTR _OSTaskSwHook ; Call user defined task switch hook ; MOV AX, WORD PTR DS:_OSTCBHighRdy+2 ; OSTCBCur = OSTCBHighRdy MOV DX, WORD PTR DS:_OSTCBHighRdy ; MOV WORD PTR DS:_OSTCBCur+2, AX ; MOV WORD PTR DS:_OSTCBCur, DX ; ; MOV AL, BYTE PTR DS:_OSPrioHighRdy ; OSPrioCur = OSPrioHighRdy MOV BYTE PTR DS:_OSPrioCur, AL ; ; LES BX, DWORD PTR DS:_OSTCBHighRdy ; SS:SP = OSTCBHighRdy-> OSTCBStkPtr MOV SS, ES:[BX+2] ; MOV SP, ES:[BX] ; ; POP DS ; Load new task's context POP ES ; POPA ; ; IRET ; Return to new task ; _OSCtxSw ENDP PAGE ; /*$PAGE*/ ;********************************************************************************************************* ; ......
>>返回讨论的主题
|