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

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

index 5509599e1b7f8abd3e1e18e50d77f5539c3b76bd..669561cb67a00df191fcc89435f453af106db71d 100644 (file)
@@ -98,8 +98,8 @@ void vPortSetupTimerInterrupt( void );
 portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
 {\r
 unsigned short usNibble;\r
-unsigned short *pus16BitPointer;\r
 unsigned long ulSP_PC_Combined;\r
+unsigned short *pusTopOfStack;\r
 \r
        /*\r
                Place a few bytes of known values on the bottom of the stack.\r
@@ -117,17 +117,11 @@ unsigned long ulSP_PC_Combined;
        executing an ISR.  We want the stack to look just as if this has happened\r
        so place a pointer to the start of the task on the stack first - followed\r
        by the flags we want the task to use when it starts up. */\r
-//     pus16BitPointer = ( unsigned short * ) pxTopOfStack;\r
-//     *pus16BitPointer = ( unsigned short ) pxCode;\r
-//     pus16BitPointer--;\r
        \r
        /* When placed on the stack, the top four bits of the status register\r
        contain bits 19:16 of the 20 bit return address (pxCode). */\r
+#ifdef GENERATE_ISR_STACK_FRAME\r
        usNibble = ( unsigned short ) ( ( ( unsigned long ) pxCode >> 15UL ) & 0x0fUL );\r
-//     *pus16BitPointer = ( usNibble | portFLAGS_INT_ENABLED );\r
-//     pus16BitPointer--;\r
-\r
-//     pxTopOfStack = ( portSTACK_TYPE * ) pus16BitPointer;\r
 \r
        ulSP_PC_Combined = ( unsigned long ) pxCode;\r
        ulSP_PC_Combined <<= 16;\r
@@ -135,7 +129,14 @@ unsigned long ulSP_PC_Combined;
        ulSP_PC_Combined |= portFLAGS_INT_ENABLED;\r
        *pxTopOfStack = ulSP_PC_Combined;\r
        pxTopOfStack--;\r
-\r
+#else\r
+       *pxTopOfStack = ( portSTACK_TYPE ) pxCode;\r
+       pusTopOfStack = ( unsigned short * ) pxTopOfStack;\r
+       pusTopOfStack--;\r
+       *pusTopOfStack = portFLAGS_INT_ENABLED;\r
+       pusTopOfStack -= 2;\r
+       pxTopOfStack = ( portSTACK_TYPE * ) pusTopOfStack;\r
+#endif\r
        /* Next the general purpose registers. */\r
        *pxTopOfStack = ( portSTACK_TYPE ) 0xffffff;\r
        pxTopOfStack--;\r
@@ -193,5 +194,12 @@ void vPortSetupTimerInterrupt( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+#pragma vector=configTICK_INTERRUPT_VECTOR\r
+__interrupt void vISR( void )\r
+{\r
+extern void vTickISR( void );\r
+\r
+       vTickISR();\r
+}\r
 \r
        \r
index 9f7c9ca65d5d7d3cd4f5f3e9f8d21e1190bed0cc..465f88681929a655b2e220701df6539d47eb34f4 100644 (file)
@@ -79,9 +79,10 @@ portRESTORE_CONTEXT macro
                /* The last thing on the stack will be the status register.\r
         Ensure the power down bits are clear ready for the next\r
         time this power down register is popped from the stack. */\r
-               bic.w   #0xf0, 0( SP )\r
-\r
-               reti\r
+               bic.w   #0xf0, 0( sp )\r
+                       \r
+               pop.w   sr\r
+               reta\r
                endm\r
 /*-----------------------------------------------------------*/\r
 \r
index 253da157498ccebd3f42bce9073ea026211b8d8e..ee2daeb74085e6d661789bb3ccac605173272cc9 100644 (file)
@@ -61,8 +61,7 @@
        EXPORT vTickISR\r
        EXPORT vPortYield\r
        EXPORT xPortStartScheduler\r
-       \r
-       RSEG CODE\r
+\r
 \r
 /*\r
  * The RTOS tick ISR.\r
@@ -72,7 +71,9 @@
  *\r
  * If the preemptive scheduler is in use a context switch can also occur.\r
  */\r
+       RSEG ISR_CODE\r
 vTickISR:\r
+       push.w sr\r
        portSAVE_CONTEXT\r
                                \r
        calla   #vTaskIncrementTick\r
@@ -84,6 +85,7 @@ vTickISR:
        portRESTORE_CONTEXT\r
 /*-----------------------------------------------------------*/\r
 \r
+       RSEG CODE\r
 \r
 /*\r
  * Manual context switch called by the portYIELD() macro.\r
@@ -92,13 +94,13 @@ vPortYield:
 \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
+//     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
+       push.w  sr\r
        /* Now the SR is stacked we can disable interrupts. */\r
        dint    \r
        nop\r
@@ -129,11 +131,13 @@ xPortStartScheduler:
 /*-----------------------------------------------------------*/\r
                \r
 \r
-       /* Install vTickISR as the timer A0 interrupt. */\r
-       ASEG\r
-       ORG 0xFFE0 + configTICK_INTERRUPT_VECTOR\r
+       /* Install vTickISR as the interrupt on the vector specified by the\r
+       application code. */\r
+       /*COMMON INTVEC *./\r
+       /*ORG 0xFF80 + configTICK_INTERRUPT_VECTOR\r
+       ORG 0xFFEC\r
        \r
-       _vTickISR_: DC16 vTickISR\r
+       __vTickISR__: DC16 0xabcd*/\r
        \r
 \r
        END\r