From: richardbarry Date: Sun, 28 Aug 2011 13:06:11 +0000 (+0000) Subject: Modify the stack set up when ARM7/9 tasks are created to ensure the assert() calls... X-Git-Tag: V7.0.2~39 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6f7e62ab8caf796690a8030eba9459b36216227d;p=freertos 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. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1571 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/portable/GCC/ARM7_AT91FR40008/port.c b/Source/portable/GCC/ARM7_AT91FR40008/port.c index 0570d8227..238c4f27e 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 482dcd561..27fa749fe 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 29d2e45bc..4a98d5d55 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 b29f3e160..c366bef72 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 0a7794963..766fbb451 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 693028f0b..6bde1b1a6 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 69f6a5dff..704f71cd2 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 3ecc9b4db..0aebb8266 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 fd56f44ec..11e983ec4 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 4a0cd97aa..12f3f08b9 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 307f06e90..98ccaad02 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