--- /dev/null
+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
*/\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
" 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
\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
#endif\r
\r
#endif /* PORTMACRO_H */\r
+\r
*\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
\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
main_full();\r
}\r
#endif\r
+\r
+ return 0;\r
}\r
/*-----------------------------------------------------------*/\r
\r