]> git.sur5r.net Git - freertos/commitdiff
Continue development of MSP430X port.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 28 Dec 2010 18:40:12 +0000 (18:40 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 28 Dec 2010 18:40:12 +0000 (18:40 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1188 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/IAR/MSP430X/port.c
Source/portable/IAR/MSP430X/portasm.h
Source/portable/IAR/MSP430X/portext.s43

index a008016ffdc7688bcedfde96c448a7d839a4f2ae..5509599e1b7f8abd3e1e18e50d77f5539c3b76bd 100644 (file)
@@ -143,7 +143,7 @@ unsigned long ulSP_PC_Combined;
        pxTopOfStack--;\r
        *pxTopOfStack = ( portSTACK_TYPE ) 0xdddddd;\r
        pxTopOfStack--;\r
-       *pxTopOfStack = ( portSTACK_TYPE ) 0xcccccc;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;\r
        pxTopOfStack--;\r
        *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbbbb;\r
        pxTopOfStack--;\r
index 95b0d5140bd42d086830a4a7425c90d842cc84d2..9f7c9ca65d5d7d3cd4f5f3e9f8d21e1190bed0cc 100644 (file)
 #ifndef PORTASM_H\r
 #define PORTASM_H\r
 \r
-portSAVE_CONTEXT macro\r
-\r
                IMPORT pxCurrentTCB\r
                IMPORT usCriticalNesting\r
 \r
+portSAVE_CONTEXT macro\r
+\r
                /* Save the remaining registers. */\r
-               push    r4\r
-               push    r5\r
-               push    r6\r
-               push    r7\r
-               push    r8\r
-               push    r9\r
-               push    r10\r
-               push    r11\r
-               push    r12\r
-               push    r13\r
-               push    r14\r
-               push    r15\r
-               mov.w   &usCriticalNesting, r14\r
-               push    r14\r
-               mov.w   &pxCurrentTCB, r12\r
-               mov.w   r1, 0(r12)\r
+               pushm.a #12, r15\r
+               movx.w  &usCriticalNesting, r14\r
+               pushx.a r14\r
+               movx.a  &pxCurrentTCB, r12\r
+               movx.a  sp, 0( r12 )\r
                endm\r
 /*-----------------------------------------------------------*/\r
                \r
 portRESTORE_CONTEXT macro\r
+\r
                movx.a  &pxCurrentTCB, r12\r
-               movx.a  @r12, r1\r
+               movx.a  @r12, sp\r
                popx.a  r15\r
                movx.w  r15, &usCriticalNesting\r
                popm.a  #12, r15\r
index a96a81baa0f7387d3e8cef1ddd14857239c2fa5a..253da157498ccebd3f42bce9073ea026211b8d8e 100644 (file)
@@ -90,16 +90,23 @@ vTickISR:
  */\r
 vPortYield:\r
 \r
-       /* Mimic an interrupt by pushing the SR. */\r
-       push    SR                      \r
+       /* Mimic an interrupt by combining the SR and the PC, the latter having\r
+       already been pushed onto the stack.  R14 is a scratch registers. */\r
+       popx.a  r14             /* r14 will hold the 20 bit PC. */\r
+       push.w  r14             /* Push just 16 bits of the 20bit PC back onto the stack. */\r
+       rram.a  #4, r14         /* Move the top 4 bits of the PC down ready to be combined with the SP. */\r
+       and.w   #0xf000, r14/* Ensure other bits are clear. */\r
+       add.w   sr, r14         /* Combine the top 4 bits of the PC with the SR. */\r
+       push.w  r14                     /* Push the generated combined value onto the stack. */\r
 \r
        /* Now the SR is stacked we can disable interrupts. */\r
-       dint                    \r
+       dint    \r
+       nop\r
                                \r
        /* Save the context of the current task. */\r
        portSAVE_CONTEXT                        \r
 \r
-       /* Switch to the highest priority task that is ready to run. */\r
+       /* Select the next task to run. */\r
        calla   #vTaskSwitchContext             \r
 \r
        /* Restore the context of the new task. */\r