From: richardbarry Date: Tue, 28 Dec 2010 18:40:12 +0000 (+0000) Subject: Continue development of MSP430X port. X-Git-Tag: V6.1.1~69 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=03e1f298c44ef11e000cfd24d1c45bf5361cbfe3;p=freertos Continue development of MSP430X port. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1188 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/portable/IAR/MSP430X/port.c b/Source/portable/IAR/MSP430X/port.c index a008016ff..5509599e1 100644 --- a/Source/portable/IAR/MSP430X/port.c +++ b/Source/portable/IAR/MSP430X/port.c @@ -143,7 +143,7 @@ unsigned long ulSP_PC_Combined; pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) 0xdddddd; pxTopOfStack--; - *pxTopOfStack = ( portSTACK_TYPE ) 0xcccccc; + *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbbbb; pxTopOfStack--; diff --git a/Source/portable/IAR/MSP430X/portasm.h b/Source/portable/IAR/MSP430X/portasm.h index 95b0d5140..9f7c9ca65 100644 --- a/Source/portable/IAR/MSP430X/portasm.h +++ b/Source/portable/IAR/MSP430X/portasm.h @@ -54,34 +54,24 @@ #ifndef PORTASM_H #define PORTASM_H -portSAVE_CONTEXT macro - IMPORT pxCurrentTCB IMPORT usCriticalNesting +portSAVE_CONTEXT macro + /* Save the remaining registers. */ - push r4 - push r5 - push r6 - push r7 - push r8 - push r9 - push r10 - push r11 - push r12 - push r13 - push r14 - push r15 - mov.w &usCriticalNesting, r14 - push r14 - mov.w &pxCurrentTCB, r12 - mov.w r1, 0(r12) + pushm.a #12, r15 + movx.w &usCriticalNesting, r14 + pushx.a r14 + movx.a &pxCurrentTCB, r12 + movx.a sp, 0( r12 ) endm /*-----------------------------------------------------------*/ portRESTORE_CONTEXT macro + movx.a &pxCurrentTCB, r12 - movx.a @r12, r1 + movx.a @r12, sp popx.a r15 movx.w r15, &usCriticalNesting popm.a #12, r15 diff --git a/Source/portable/IAR/MSP430X/portext.s43 b/Source/portable/IAR/MSP430X/portext.s43 index a96a81baa..253da1574 100644 --- a/Source/portable/IAR/MSP430X/portext.s43 +++ b/Source/portable/IAR/MSP430X/portext.s43 @@ -90,16 +90,23 @@ vTickISR: */ vPortYield: - /* Mimic an interrupt by pushing the SR. */ - push SR + /* Mimic an interrupt by combining the SR and the PC, the latter having + already been pushed onto the stack. R14 is a scratch registers. */ + popx.a r14 /* r14 will hold the 20 bit PC. */ + push.w r14 /* Push just 16 bits of the 20bit PC back onto the stack. */ + rram.a #4, r14 /* Move the top 4 bits of the PC down ready to be combined with the SP. */ + and.w #0xf000, r14/* Ensure other bits are clear. */ + add.w sr, r14 /* Combine the top 4 bits of the PC with the SR. */ + push.w r14 /* Push the generated combined value onto the stack. */ /* Now the SR is stacked we can disable interrupts. */ - dint + dint + nop /* Save the context of the current task. */ portSAVE_CONTEXT - /* Switch to the highest priority task that is ready to run. */ + /* Select the next task to run. */ calla #vTaskSwitchContext /* Restore the context of the new task. */