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.
This commit is contained in:
Richard Barry 2012-01-21 18:38:21 +00:00
parent 7298ffd3f2
commit de570548f0
4 changed files with 71 additions and 64 deletions

View file

@ -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"

View file

@ -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 */

View file

@ -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;
}
/*-----------------------------------------------------------*/