From 3a4d907c646ffd8d0a5ae696db0eafb75e8dd94a Mon Sep 17 00:00:00 2001 From: Richard Barry Date: Sun, 28 Aug 2011 13:06:11 +0000 Subject: [PATCH] Modify the stack set up when ARM7/9 tasks are created to ensure the assert() calls in xTaskCreate() don't fail. In this case, the assert that would fail is actually redundant anyway, but should not be removed as it might not be redundant in all ports. --- Source/portable/GCC/ARM7_AT91FR40008/port.c | 4 ++++ Source/portable/GCC/ARM7_AT91SAM7S/port.c | 12 ++++-------- Source/portable/GCC/ARM7_LPC2000/port.c | 4 ++++ Source/portable/GCC/ARM7_LPC23xx/port.c | 4 ++++ Source/portable/GCC/STR75x/port.c | 4 ++++ Source/portable/IAR/AtmelSAM7S64/port.c | 4 ++++ Source/portable/IAR/AtmelSAM9XE/port.c | 4 ++++ Source/portable/IAR/STR71x/port.c | 4 ++++ Source/portable/IAR/STR75x/port.c | 4 ++++ Source/portable/IAR/STR91x/port.c | 4 ++++ Source/portable/RVDS/ARM7_LPC21xx/port.c | 4 ++++ 11 files changed, 44 insertions(+), 8 deletions(-) diff --git a/Source/portable/GCC/ARM7_AT91FR40008/port.c b/Source/portable/GCC/ARM7_AT91FR40008/port.c index 0570d82272..238c4f27e3 100644 --- a/Source/portable/GCC/ARM7_AT91FR40008/port.c +++ b/Source/portable/GCC/ARM7_AT91FR40008/port.c @@ -104,6 +104,10 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE portSTACK_TYPE *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; + + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/GCC/ARM7_AT91SAM7S/port.c b/Source/portable/GCC/ARM7_AT91SAM7S/port.c index 482dcd561b..27fa749fe9 100644 --- a/Source/portable/GCC/ARM7_AT91SAM7S/port.c +++ b/Source/portable/GCC/ARM7_AT91SAM7S/port.c @@ -60,14 +60,6 @@ * to ARM mode are contained in portISR.c. *----------------------------------------------------------*/ -/* - Changes from V2.5.2 - - + ulCriticalNesting is now saved as part of the task context, as is - therefore added to the initial task stack during pxPortInitialiseStack. -*/ - - /* Standard includes. */ #include @@ -122,6 +114,10 @@ portSTACK_TYPE *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; + /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/GCC/ARM7_LPC2000/port.c b/Source/portable/GCC/ARM7_LPC2000/port.c index 29d2e45bc1..4a98d5d55f 100644 --- a/Source/portable/GCC/ARM7_LPC2000/port.c +++ b/Source/portable/GCC/ARM7_LPC2000/port.c @@ -110,6 +110,10 @@ portSTACK_TYPE *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; + /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/GCC/ARM7_LPC23xx/port.c b/Source/portable/GCC/ARM7_LPC23xx/port.c index b29f3e160f..c366bef72c 100644 --- a/Source/portable/GCC/ARM7_LPC23xx/port.c +++ b/Source/portable/GCC/ARM7_LPC23xx/port.c @@ -109,6 +109,10 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE portSTACK_TYPE *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; + + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/GCC/STR75x/port.c b/Source/portable/GCC/STR75x/port.c index 0a77949636..766fbb451d 100644 --- a/Source/portable/GCC/STR75x/port.c +++ b/Source/portable/GCC/STR75x/port.c @@ -95,6 +95,10 @@ portSTACK_TYPE *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; + /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/IAR/AtmelSAM7S64/port.c b/Source/portable/IAR/AtmelSAM7S64/port.c index 693028f0b3..6bde1b1a65 100644 --- a/Source/portable/IAR/AtmelSAM7S64/port.c +++ b/Source/portable/IAR/AtmelSAM7S64/port.c @@ -103,6 +103,10 @@ portSTACK_TYPE *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; + /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/IAR/AtmelSAM9XE/port.c b/Source/portable/IAR/AtmelSAM9XE/port.c index 69f6a5dffd..704f71cd2e 100644 --- a/Source/portable/IAR/AtmelSAM9XE/port.c +++ b/Source/portable/IAR/AtmelSAM9XE/port.c @@ -118,6 +118,10 @@ portSTACK_TYPE *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; + /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/IAR/STR71x/port.c b/Source/portable/IAR/STR71x/port.c index 3ecc9b4db1..0aebb82669 100644 --- a/Source/portable/IAR/STR71x/port.c +++ b/Source/portable/IAR/STR71x/port.c @@ -107,6 +107,10 @@ portSTACK_TYPE *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; + /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/IAR/STR75x/port.c b/Source/portable/IAR/STR75x/port.c index fd56f44ec7..11e983ec48 100644 --- a/Source/portable/IAR/STR75x/port.c +++ b/Source/portable/IAR/STR75x/port.c @@ -102,6 +102,10 @@ portSTACK_TYPE *pxOriginalTOS; pxOriginalTOS = pxTopOfStack; + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; + /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/IAR/STR91x/port.c b/Source/portable/IAR/STR91x/port.c index 4a0cd97aa0..12f3f08b93 100644 --- a/Source/portable/IAR/STR91x/port.c +++ b/Source/portable/IAR/STR91x/port.c @@ -147,6 +147,10 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxOriginalTOS = pxTopOfStack; + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; + /* Setup the initial stack of the task. The stack is set exactly as expected by the portRESTORE_CONTEXT() macro. */ diff --git a/Source/portable/RVDS/ARM7_LPC21xx/port.c b/Source/portable/RVDS/ARM7_LPC21xx/port.c index 307f06e90e..98ccaad02f 100644 --- a/Source/portable/RVDS/ARM7_LPC21xx/port.c +++ b/Source/portable/RVDS/ARM7_LPC21xx/port.c @@ -117,6 +117,10 @@ portSTACK_TYPE *pxOriginalTOS; Remember where the top of the (simulated) stack is before we place anything on it. */ pxOriginalTOS = pxTopOfStack; + + /* To ensure asserts in tasks.c don't fail, although in this case the assert + is not really required. */ + pxTopOfStack--; /* First on the stack is the return address - which in this case is the start of the task. The offset is added to make the return address appear