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