diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/.cproject b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/.cproject
index 3587cf6cc..b1a634498 100644
--- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/.cproject
+++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/.cproject
@@ -1014,6 +1014,7 @@
+
@@ -1043,6 +1044,8 @@
+
+
diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h
index c862d9465..63162ec94 100644
--- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h
+++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h
@@ -83,10 +83,10 @@
#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. */
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 6 )
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 60 * 1024 ) )
+#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 200 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY 0
-#define configUSE_16_BIT_TICKS 1
+#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 0
@@ -96,7 +96,7 @@
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
-#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 230 )
+#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 250 )
#define configINTERRUPT_STACK_SIZE configMINIMAL_STACK_SIZE
/* Co-routine definitions. */
@@ -105,7 +105,7 @@
/* Software timer definitions. */
#define configUSE_TIMERS 1
-#define configTIMER_TASK_PRIORITY ( 3 )
+#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/list.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/list.c
index c3ef2a89d..04682f2ca 100644
--- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/list.c
+++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/list.c
@@ -195,3 +195,15 @@ xList * pxList;
}
/*-----------------------------------------------------------*/
+void vlistGET_OWNER_OF_NEXT_ENTRY( void *pxTCB, xList *pxList )
+{
+xList * const pxConstList = ( pxList );
+ /* Increment the index to the next item and return the item, ensuring */
+ /* we don't return the marker used at the end of the list. */
+ ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;
+ if( ( pxConstList )->pxIndex == ( xListItem * ) &( ( pxConstList )->xListEnd ) )
+ {
+ ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;
+ }
+ ( pxTCB ) = ( pxConstList )->pxIndex->pvOwner;
+}
diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c
index 77a69fec3..c91813c0c 100644
--- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c
+++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c
@@ -99,7 +99,8 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE;
/* To limit the amount of stack required by each task, this port uses a
separate stack for interrupts. */
-unsigned long *pulISRStack;
+unsigned long ulISRStack;
+unsigned long *pulISRStack = &ulISRStack;
/* The instance of the interrupt controller used by this port. */
static XIntc xInterruptControllerInstance;
@@ -176,7 +177,7 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14 - return address for interrupt. */
pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0x0f; /* R15 - return address for subroutine. */
+ *pxTopOfStack = ( portSTACK_TYPE ) NULL; /* R15 - return address for subroutine. */
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16 - return address for trap (debugger). */
pxTopOfStack--;
@@ -225,14 +226,15 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
portBASE_TYPE xPortStartScheduler( void )
{
extern void ( vPortStartFirstTask )( void );
-extern unsigned long *_stack;
+extern unsigned long _stack[];
/* Setup the hardware to generate the tick. Interrupts are disabled when
this function is called. */
vApplicationSetupTimerInterrupt();
/* Allocate the stack to be used by the interrupt handler. */
- pulISRStack = _stack;
+ pulISRStack = ( unsigned long * ) _stack;
+ pulISRStack--;
/* Restore the context of the first task that is going to run. From here
on, the created tasks will be executing. */
diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/queue.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/queue.c
index 2ae7c7030..a58d6379c 100644
--- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/queue.c
+++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/queue.c
@@ -1529,8 +1529,15 @@ signed portBASE_TYPE xReturn;
prvLockQueue( pxQueue );
if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0U )
{
- /* There is nothing in the queue, block for the specified period. */
- vTaskPlaceOnEventListRestricted( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
+ /* There is nothing in the queue, block for the specified period,
+ provided the period is not zero. This guards against the case
+ where the time to wake is set to zero because there are no active
+ timers, but the tick count value also happens to be zero - creating
+ a block time of zero which confuses the logic. */
+ if( 1 )//_RB_if( xTicksToWait != 0U ) //_RB_ This should not be needed as the scheduler is suspended so the tick count cannot increment.
+ {
+ vTaskPlaceOnEventListRestricted( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
+ }
}
prvUnlockQueue( pxQueue );
}
diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/tasks.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/tasks.c
index 020443d31..aa398d7ca 100644
--- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/tasks.c
+++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/tasks.c
@@ -1792,7 +1792,7 @@ portTickType xTimeToWake;
designed for use by kernel code, and has special calling requirements -
it should be called from a critical section. */
-
+
/* Place the event list item of the TCB in the appropriate event list.
In this case it is assume that this is the only task that is going to
be waiting on this event list, so the faster vListInsertEnd() function
diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/timers.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/timers.c
index 7e5ef22ad..5d47efd40 100644
--- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/timers.c
+++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/timers.c
@@ -311,6 +311,8 @@ portBASE_TYPE xListWasEmpty;
/* Just to avoid compiler warnings. */
( void ) pvParameters;
+ vTaskDelay( 2 );
+
for( ;; )
{
/* Query the timers list to see if it contains any timers, and if so,
diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/RegisterTests.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/RegisterTests.c
index 867d56fa1..a855e564b 100644
--- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/RegisterTests.c
+++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/RegisterTests.c
@@ -208,13 +208,16 @@ void vRegisterTest2( void *pvParameters )
" addi r31, r0, 1031 \n\t"
);
+ /* Yield. */
+ asm volatile ( "Loop_Start_2: \n\t" \
+ "bralid r14, VPortYieldASM \n\t" \
+ "or r0, r0, r0 \n\t" );
+
/* Now test the register values to ensure they contain the same value that
was written to them above. This task will get preempted frequently so
other tasks are likely to have executed since the register values were
written. */
-
- asm volatile ( "Loop_Start_2: \n\t" \
- " xori r18, r3, 103 \n\t" \
+ asm volatile ( " xori r18, r3, 103 \n\t" \
" bnei r18, Error_Loop_2 \n\t" \
" xori r18, r4, 104 \n\t" \
" bnei r18, Error_Loop_2 \n\t" \
diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-full.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-full.c
index 8a97747fc..385f0873a 100644
--- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-full.c
+++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-full.c
@@ -269,9 +269,9 @@ int main( void )
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
-// vStartQueuePeekTasks();
-// vStartRecursiveMutexTasks();
-// vStartMathTasks( mainFLOP_TASK_PRIORITY );
+ vStartQueuePeekTasks();
+ vStartRecursiveMutexTasks();
+ vStartMathTasks( mainFLOP_TASK_PRIORITY );
/* The suicide tasks must be created last as they need to know how many
tasks were running prior to their creation in order to ascertain whether
@@ -283,13 +283,13 @@ int main( void )
the reasons stated in the comments above the call to
vStartTimerDemoTask(), that the check timer is not actually started
until after the scheduler has been started. */
-// xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainNO_ERROR_CHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback );
+ xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainNO_ERROR_CHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback );
/* Ensure the check timer will start running as soon as the scheduler
starts. The block time is set to 0 (mainDONT_BLOCK), but would be
ingnored at this point anyway as block times can only be specified when
the scheduler is running. */
-// xTimerStart( xCheckTimer, mainDONT_BLOCK );
+ xTimerStart( xCheckTimer, mainDONT_BLOCK );
/* Start the tasks running. */
vTaskStartScheduler();