]> git.sur5r.net Git - freertos/commitdiff
Added batch file to create LPC11xx demo. Tidied up the M0 port layer files.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 21 Jan 2012 18:38:21 +0000 (18:38 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 21 Jan 2012 18:38:21 +0000 (18:38 +0000)
This is a baseline taken before moving the M0 port files to their proper location.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1671 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/CreateProjectDirectoryStructure.bat [new file with mode: 0644]
Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0/port.c
Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOS_Source/portable/GCC/ARM_CM0/portmacro.h
Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main.c

diff --git a/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/CreateProjectDirectoryStructure.bat b/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/CreateProjectDirectoryStructure.bat
new file mode 100644 (file)
index 0000000..2d7bbd3
--- /dev/null
@@ -0,0 +1,51 @@
+REM This file should be executed from the command line prior to the first\r
+REM build.  It will be necessary to refresh the Eclipse project once the\r
+REM .bat file has been executed (normally just press F5 to refresh).\r
+\r
+REM Copies all the required files from their location within the standard\r
+REM FreeRTOS directory structure to under the Eclipse project directory.\r
+REM This permits the Eclipse project to be used in 'managed' mode and without\r
+REM having to setup any linked resources.\r
+\r
+REM Have the files already been copied?\r
+IF EXIST Source\FreeRTOS_Source Goto END\r
+\r
+       REM Create the required directory structure.\r
+       MD Source\FreeRTOS_Source\r
+       MD Source\FreeRTOS_Source\include\r
+       MD Source\FreeRTOS_Source\portable\r
+       MD Source\FreeRTOS_Source\portable\GCC\r
+       MD Source\FreeRTOS_Source\portable\GCC\ARM_CM0\r
+       MD Source\FreeRTOS_Source\portable\MemMang\r
+       MD Source\Common_Demo_Tasks\r
+       MD Source\Common_Demo_Tasks\include\r
+       \r
+       REM Copy the core kernel files.\r
+       copy ..\..\..\Source\tasks.c Source\FreeRTOS_Source\r
+       copy ..\..\..\Source\queue.c Source\FreeRTOS_Source\r
+       copy ..\..\..\Source\list.c Source\FreeRTOS_Source\r
+       copy ..\..\..\Source\timers.c Source\FreeRTOS_Source\r
+       \r
+       REM Copy the common header files\r
+\r
+       copy ..\..\..\Source\include\*.* Source\FreeRTOS_Source\include\r
+       \r
+       REM Copy the portable layer files\r
+       copy ..\..\..\Source\portable\GCC\ARM_CM3\*.* Source\FreeRTOS_Source\portable\GCC\ARM_CM0\r
+       \r
+       REM Copy the basic memory allocation files\r
+       copy ..\..\..\Source\portable\MemMang\heap_1.c Source\FreeRTOS_Source\portable\MemMang\r
+\r
+       REM Copy the files that define the common demo tasks.\r
+       copy ..\..\Common\minimal\blocktim.c Source\Common_Demo_Tasks\r
+       copy ..\..\Common\minimal\recmutex.c Source\Common_Demo_Tasks\r
+       copy ..\..\Common\minimal\countsem.c Source\Common_Demo_Tasks\r
+       copy ..\..\Common\minimal\IntQueue.c Source\Common_Demo_Tasks\r
+       \r
+       REM Copy the common demo file headers.\r
+       copy ..\..\Common\include\blocktim.h Source\Common_Demo_Tasks\include\r
+       copy ..\..\Common\include\recmutex.h Source\Common_Demo_Tasks\include\r
+       copy ..\..\Common\include\countsem.h Source\Common_Demo_Tasks\include\r
+       copy ..\..\Common\include\IntQueue.h Source\Common_Demo_Tasks\include\r
+       \r
+: END
\ No newline at end of file
index 991c301b2cf96fc79a337d6b0c6464064a24d1fc..e68ca16ceb8a7858d8b0c5d665a329cc6f5c2c08 100644 (file)
@@ -103,60 +103,16 @@ static void vPortStartFirstTask( void ) __attribute__ (( naked ));
  */\r
 portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
 {\r
-       /* Ordering the registers in numerical order on the stack allows a context\r
-       switch using 4 ldmia and 2 arithmetic instructions.  The alternative, of\r
-       having a group of four high registers and a group of four low registers,\r
-       and then placing the group of low before the group of high, would require\r
-       4 ldmia and 4 arithmetic instructions.  Therefore a numerical ordering is\r
-       preferred. */\r
-#if 0\r
        /* Simulate the stack frame as it would be created by a context switch\r
        interrupt. */\r
        pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */\r
        *pxTopOfStack = portINITIAL_XPSR;       /* xPSR */\r
        pxTopOfStack--;\r
        *pxTopOfStack = ( portSTACK_TYPE ) pxCode;      /* PC */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0;      /* LR */\r
-       pxTopOfStack -= 5;      /* R12, R3, R2 and R1. */\r
+       pxTopOfStack -= 6;      /* LR, R12, R3..R1 */\r
        *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;        /* R0 */\r
-       pxTopOfStack -= 8;      /* R11, R10, R9, R8, R7, R6, R5 and R4. */\r
-#else\r
-       /* Simulate the stack frame as it would be created by a context switch\r
-       interrupt. */\r
-       pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */\r
-       *pxTopOfStack = portINITIAL_XPSR;       /* xPSR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = ( portSTACK_TYPE ) pxCode;      /* PC */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x14;   /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x12;   /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x3;    /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x2;    /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x1;    /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;        /* R0 */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x11;   /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x10;   /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x09;   /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x08;   /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x07;   /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x06;   /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x05;   /* LR */\r
-       pxTopOfStack--;\r
-       *pxTopOfStack = 0x04;\r
-#endif\r
+       pxTopOfStack -= 8; /* R11..R4. */\r
+\r
        return pxTopOfStack;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -277,7 +233,7 @@ void PendSV_Handler( void )
        "       mov r7, r11                                                     \n"\r
        "       stmia r0!, {r4-r7}                      \n"\r
        "                                                                               \n"\r
-       "       push {r3, r14}                                                  \n"\r
+       "       push {r3, r14}                                          \n"\r
        "       cpsid i                                                         \n"\r
        "       bl vTaskSwitchContext                           \n"\r
        "       cpsie i                                                         \n"\r
index 60f36cf3c69d30ce926d3a2cc821f8726dacb01b..4b0c13780f6f06d6d239a3ec2159e70c613ef526 100644 (file)
@@ -97,28 +97,23 @@ extern "C" {
 \r
 /* Scheduler utilities. */\r
 extern void vPortYieldFromISR( void );\r
-\r
-#define portYIELD()                                    vPortYieldFromISR()\r
-\r
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vPortYieldFromISR()\r
+#define portYIELD()                                                                    vPortYieldFromISR()\r
+#define portEND_SWITCHING_ISR( xSwitchRequired )       if( xSwitchRequired ) vPortYieldFromISR()\r
 /*-----------------------------------------------------------*/\r
 \r
 \r
 /* Critical section management. */\r
-#define portSET_INTERRUPT_MASK()       __asm volatile  ( " cpsid i " )\r
-#define portCLEAR_INTERRUPT_MASK()     __asm volatile  ( " cpsie i " )\r
-\r
-#define portSET_INTERRUPT_MASK_FROM_ISR()              0;portSET_INTERRUPT_MASK()\r
-#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)   portCLEAR_INTERRUPT_MASK();(void)x\r
-\r
-\r
 extern void vPortEnterCritical( void );\r
 extern void vPortExitCritical( void );\r
+#define portSET_INTERRUPT_MASK()                               __asm volatile  ( " cpsid i " )\r
+#define portCLEAR_INTERRUPT_MASK()                             __asm volatile  ( " cpsie i " )\r
+#define portSET_INTERRUPT_MASK_FROM_ISR()              0;portSET_INTERRUPT_MASK()\r
+#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)   portCLEAR_INTERRUPT_MASK();(void)x\r
+#define portDISABLE_INTERRUPTS()                               portSET_INTERRUPT_MASK()\r
+#define portENABLE_INTERRUPTS()                                        portCLEAR_INTERRUPT_MASK()\r
+#define portENTER_CRITICAL()                                   vPortEnterCritical()\r
+#define portEXIT_CRITICAL()                                            vPortExitCritical()\r
 \r
-#define portDISABLE_INTERRUPTS()       portSET_INTERRUPT_MASK()\r
-#define portENABLE_INTERRUPTS()                portCLEAR_INTERRUPT_MASK()\r
-#define portENTER_CRITICAL()           vPortEnterCritical()\r
-#define portEXIT_CRITICAL()                    vPortExitCritical()\r
 /*-----------------------------------------------------------*/\r
 \r
 /* Task function macros as described on the FreeRTOS.org WEB site. */\r
@@ -132,3 +127,4 @@ extern void vPortExitCritical( void );
 #endif\r
 \r
 #endif /* PORTMACRO_H */\r
+\r
index f3401365bbbfa14d83f71394a3bc24bfeb0a1bd6..ee9c67c667ad1cd483a176fb2ed644edb5b650c3 100644 (file)
@@ -67,6 +67,8 @@
  *\r
  *****************************************************************************/\r
 \r
+//#error The batch file Demo\CORTEX_M0_LPC1114_LPCXpresso\RTOSDemo\CreateProjectDirectoryStructure.bat must be executed before the first build.  After executing the batch file hit F5 to refrech the Eclipse project, then delete this line.\r
+\r
 /* Standard includes. */\r
 #include "string.h"\r
 \r
@@ -79,7 +81,7 @@
 \r
 /* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,\r
 or 0 to run the more comprehensive test and demo application. */\r
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     1\r
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     0\r
 \r
 /* The bit on port 0 to which the LED is wired. */\r
 #define mainLED_BIT            ( 1UL << 7UL )\r
@@ -136,6 +138,8 @@ int main( void )
                main_full();\r
        }\r
        #endif\r
+\r
+       return 0;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r