]> git.sur5r.net Git - freertos/commitdiff
MicroBlaze demo nearly working - death tasks not yet integrated - still a work in...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 12 Jun 2011 15:55:45 +0000 (15:55 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 12 Jun 2011 15:55:45 +0000 (15:55 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1453 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/.cproject
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/list.c
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/queue.c
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/tasks.c
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/timers.c
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/RegisterTests.c
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-full.c

index 3587cf6cc2119978390d239bd9cc2aded0fdeeea..b1a634498883402cb2e2eedab5eeb438edd60f49 100644 (file)
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/include}&quot;"/>\r
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/MicroBlaze}&quot;"/>\r
                                                                </option>\r
+                                                               <option id="xilinx.gnu.compiler.misc.other.1660455181" name="Other flags" superClass="xilinx.gnu.compiler.misc.other" value="-c -fmessage-length=0" valueType="string"/>\r
                                                                <inputType id="xilinx.gnu.compiler.input.505106416" name="C source files" superClass="xilinx.gnu.compiler.input"/>\r
                                                        </tool>\r
                                                        <tool id="xilinx.gnu.mb.cxx.toolchain.compiler.debug.2087155544" name="MicroBlaze g++ compiler" superClass="xilinx.gnu.mb.cxx.toolchain.compiler.debug">\r
                                                                        <listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/>\r
                                                                </option>\r
                                                                <option id="xilinx.gnu.c.linker.option.lscript.1073578867" name="Linker Script" superClass="xilinx.gnu.c.linker.option.lscript" value="../src/lscript.ld" valueType="string"/>\r
+                                                               <option id="xilinx.gnu.c.link.option.ldflags.471396681" name="Linker Flags" superClass="xilinx.gnu.c.link.option.ldflags" value="-Map=output.map" valueType="string"/>\r
+                                                               <option id="xilinx.gnu.c.link.option.other.791541632" name="Other options (-XLinker [option])" superClass="xilinx.gnu.c.link.option.other" valueType="stringList"/>\r
                                                                <inputType id="xilinx.gnu.linker.input.1399699093" superClass="xilinx.gnu.linker.input">\r
                                                                        <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>\r
                                                                        <additionalInput kind="additionalinput" paths="$(LIBS)"/>\r
index c862d94651bfda873cf4ed6e1964a9a0d271599e..63162ec94be9920342865c9761a5161e0e85d88d 100644 (file)
 #define configCPU_CLOCK_HZ                             ( XPAR_MICROBLAZE_CORE_CLOCK_FREQ_HZ ) /* Not actually used in this demo as the timer is set up in main and uses the peripheral clock, not the CPU clock. */\r
 #define configTICK_RATE_HZ                             ( ( portTickType ) 1000 )\r
 #define configMAX_PRIORITIES                   ( ( unsigned portBASE_TYPE ) 6 )\r
-#define configTOTAL_HEAP_SIZE                  ( ( size_t ) ( 60 * 1024 ) )\r
+#define configTOTAL_HEAP_SIZE                  ( ( size_t ) ( 200 * 1024 ) )\r
 #define configMAX_TASK_NAME_LEN                        ( 10 )\r
 #define configUSE_TRACE_FACILITY               0\r
-#define configUSE_16_BIT_TICKS                 1\r
+#define configUSE_16_BIT_TICKS                 0\r
 #define configIDLE_SHOULD_YIELD                        1\r
 #define configUSE_MUTEXES                              1\r
 #define configQUEUE_REGISTRY_SIZE              0\r
@@ -96,7 +96,7 @@
 #define configUSE_MALLOC_FAILED_HOOK   1\r
 #define configUSE_APPLICATION_TASK_TAG 0\r
 #define configUSE_COUNTING_SEMAPHORES  1\r
-#define configMINIMAL_STACK_SIZE               ( ( unsigned short ) 230 )\r
+#define configMINIMAL_STACK_SIZE               ( ( unsigned short ) 250 )\r
 #define configINTERRUPT_STACK_SIZE             configMINIMAL_STACK_SIZE\r
 \r
 /* Co-routine definitions. */\r
 \r
 /* Software timer definitions. */\r
 #define configUSE_TIMERS                               1\r
-#define configTIMER_TASK_PRIORITY              ( 3 )\r
+#define configTIMER_TASK_PRIORITY              ( configMAX_PRIORITIES - 1 )\r
 #define configTIMER_QUEUE_LENGTH               10\r
 #define configTIMER_TASK_STACK_DEPTH   ( configMINIMAL_STACK_SIZE )\r
 \r
index c3ef2a89dd717defcc730c4d1d94a9187600db33..04682f2ca987b417ebe0cab72ef4e072186a72a9 100644 (file)
@@ -195,3 +195,15 @@ xList * pxList;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+void vlistGET_OWNER_OF_NEXT_ENTRY( void *pxTCB, xList *pxList )\r
+{\r
+xList * const pxConstList = ( pxList );\r
+       /* Increment the index to the next item and return the item, ensuring */\r
+       /* we don't return the marker used at the end of the list.  */\r
+       ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;\r
+       if( ( pxConstList )->pxIndex == ( xListItem * ) &( ( pxConstList )->xListEnd ) )\r
+       {\r
+               ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;\r
+       }\r
+       ( pxTCB ) = ( pxConstList )->pxIndex->pvOwner;\r
+}\r
index 77a69fec3a2ee4c8de21875a9d6b893fff6ddaef..c91813c0c26b362063bc88f5badf46b97679f494 100644 (file)
@@ -99,7 +99,8 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE;
 \r
 /* To limit the amount of stack required by each task, this port uses a\r
 separate stack for interrupts. */\r
-unsigned long *pulISRStack;\r
+unsigned long ulISRStack;\r
+unsigned long *pulISRStack = &ulISRStack;\r
 \r
 /* The instance of the interrupt controller used by this port. */\r
 static XIntc xInterruptControllerInstance;\r
@@ -176,7 +177,7 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
        pxTopOfStack--;\r
        *pxTopOfStack = ( portSTACK_TYPE ) pxCode;      /* R14 - return address for interrupt. */\r
        pxTopOfStack--;\r
-       *pxTopOfStack = ( portSTACK_TYPE ) 0x0f;        /* R15 - return address for subroutine. */\r
+       *pxTopOfStack = ( portSTACK_TYPE ) NULL;        /* R15 - return address for subroutine. */\r
        pxTopOfStack--;\r
        *pxTopOfStack = ( portSTACK_TYPE ) 0x10;        /* R16 - return address for trap (debugger). */\r
        pxTopOfStack--;\r
@@ -225,14 +226,15 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
 portBASE_TYPE xPortStartScheduler( void )\r
 {\r
 extern void ( vPortStartFirstTask )( void );\r
-extern unsigned long *_stack;\r
+extern unsigned long _stack[];\r
 \r
        /* Setup the hardware to generate the tick.  Interrupts are disabled when\r
        this function is called. */\r
        vApplicationSetupTimerInterrupt();\r
 \r
        /* Allocate the stack to be used by the interrupt handler. */\r
-       pulISRStack = _stack;\r
+       pulISRStack = ( unsigned long * ) _stack;\r
+       pulISRStack--;\r
 \r
        /* Restore the context of the first task that is going to run.  From here\r
        on, the created tasks will be executing. */\r
index 2ae7c7030d709346aaca69cd83296bcd0b1ed95f..a58d6379c661839100ff2991b1d58490477c110e 100644 (file)
@@ -1529,8 +1529,15 @@ signed portBASE_TYPE xReturn;
                prvLockQueue( pxQueue );\r
                if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0U )\r
                {\r
-                       /* There is nothing in the queue, block for the specified period. */\r
-                       vTaskPlaceOnEventListRestricted( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );\r
+                       /* There is nothing in the queue, block for the specified period,\r
+                       provided the period is not zero.  This guards against the case\r
+                       where the time to wake is set to zero because there are no active\r
+                       timers, but the tick count value also happens to be zero - creating\r
+                       a block time of zero which confuses the logic. */\r
+                       if( 1 )//_RB_if( xTicksToWait != 0U ) //_RB_ This should not be needed as the scheduler is suspended so the tick count cannot increment.\r
+                       {\r
+                               vTaskPlaceOnEventListRestricted( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );\r
+                       }\r
                }\r
                prvUnlockQueue( pxQueue );\r
        }\r
index 020443d31e45790d7e0f9fe1f2921140ad39ae44..aa398d7ca7a92fa47a06682bc5f9560f90c5eea3 100644 (file)
@@ -1792,7 +1792,7 @@ portTickType xTimeToWake;
                designed for use by kernel code, and has special calling requirements -\r
                it should be called from a critical section. */\r
 \r
-       \r
+\r
                /* Place the event list item of the TCB in the appropriate event list.\r
                In this case it is assume that this is the only task that is going to\r
                be waiting on this event list, so the faster vListInsertEnd() function\r
index 7e5ef22addaf00433a7a10800cca496cdca84111..5d47efd404888e06bf40ed7783d246ac37d2a850 100644 (file)
@@ -311,6 +311,8 @@ portBASE_TYPE xListWasEmpty;
        /* Just to avoid compiler warnings. */\r
        ( void ) pvParameters;\r
 \r
+       vTaskDelay( 2 );\r
+\r
        for( ;; )\r
        {\r
                /* Query the timers list to see if it contains any timers, and if so,\r
index 867d56fa1eab00e44a91ca37ecb0e385078452b1..a855e564b29d83ea68026115bb444dd2e653b251 100644 (file)
@@ -208,13 +208,16 @@ void vRegisterTest2( void *pvParameters )
                                        "       addi r31, r0, 1031      \n\t"\r
                                );\r
 \r
+       /* Yield. */\r
+       asm volatile (  "Loop_Start_2:                          \n\t" \\r
+                                       "bralid r14, VPortYieldASM      \n\t" \\r
+                                       "or r0, r0, r0                          \n\t" );\r
+\r
        /* Now test the register values to ensure they contain the same value that\r
        was written to them above.       This task will get preempted frequently so \r
        other tasks are likely to have executed since the register values were \r
        written. */\r
-\r
-       asm volatile (  "Loop_Start_2:                          \n\t" \\r
-                                       "       xori r18, r3, 103               \n\t" \\r
+       asm volatile (  "       xori r18, r3, 103               \n\t" \\r
                                        "       bnei r18, Error_Loop_2  \n\t" \\r
                                        "       xori r18, r4, 104               \n\t" \\r
                                        "       bnei r18, Error_Loop_2  \n\t" \\r
index 8a97747fc9c903d908b82dc9f05beb718b820654..385f0873a9db57cebb20902cf52e1b18ef8e875a 100644 (file)
@@ -269,9 +269,9 @@ int main( void )
        vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
        vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
        vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );\r
-//     vStartQueuePeekTasks();\r
-//     vStartRecursiveMutexTasks();\r
-//     vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
+       vStartQueuePeekTasks();\r
+       vStartRecursiveMutexTasks();\r
+       vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
 \r
        /* The suicide tasks must be created last as they need to know how many\r
        tasks were running prior to their creation in order to ascertain whether\r
@@ -283,13 +283,13 @@ int main( void )
        the reasons stated in the comments above the call to\r
        vStartTimerDemoTask(), that the check timer is not actually started\r
        until after the scheduler has been started. */\r
-//     xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainNO_ERROR_CHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback );\r
+       xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainNO_ERROR_CHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback );\r
 \r
        /* Ensure the check timer will start running as soon as the scheduler\r
        starts.  The block time is set to 0 (mainDONT_BLOCK), but would be\r
        ingnored at this point anyway as block times can only be specified when\r
        the scheduler is running. */\r
-//     xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
+       xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
 \r
        /* Start the tasks running. */\r
        vTaskStartScheduler();\r