MicroBlaze demo nearly working - death tasks not yet integrated - still a work in progress.

pull/4/head
Richard Barry 14 years ago
parent 57653ee0ea
commit cdac2c4f82

@ -1014,6 +1014,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/include}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/MicroBlaze}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/MicroBlaze}&quot;"/>
</option> </option>
<option id="xilinx.gnu.compiler.misc.other.1660455181" name="Other flags" superClass="xilinx.gnu.compiler.misc.other" value="-c -fmessage-length=0" valueType="string"/>
<inputType id="xilinx.gnu.compiler.input.505106416" name="C source files" superClass="xilinx.gnu.compiler.input"/> <inputType id="xilinx.gnu.compiler.input.505106416" name="C source files" superClass="xilinx.gnu.compiler.input"/>
</tool> </tool>
<tool id="xilinx.gnu.mb.cxx.toolchain.compiler.debug.2087155544" name="MicroBlaze g++ compiler" superClass="xilinx.gnu.mb.cxx.toolchain.compiler.debug"> <tool id="xilinx.gnu.mb.cxx.toolchain.compiler.debug.2087155544" name="MicroBlaze g++ compiler" superClass="xilinx.gnu.mb.cxx.toolchain.compiler.debug">
@ -1043,6 +1044,8 @@
<listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/> <listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/>
</option> </option>
<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"/> <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"/>
<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"/>
<option id="xilinx.gnu.c.link.option.other.791541632" name="Other options (-XLinker [option])" superClass="xilinx.gnu.c.link.option.other" valueType="stringList"/>
<inputType id="xilinx.gnu.linker.input.1399699093" superClass="xilinx.gnu.linker.input"> <inputType id="xilinx.gnu.linker.input.1399699093" superClass="xilinx.gnu.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/> <additionalInput kind="additionalinput" paths="$(LIBS)"/>

@ -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 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 configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 6 ) #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 configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY 0 #define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 1 #define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1 #define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 0 #define configQUEUE_REGISTRY_SIZE 0
@ -96,7 +96,7 @@
#define configUSE_MALLOC_FAILED_HOOK 1 #define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0 #define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1 #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 #define configINTERRUPT_STACK_SIZE configMINIMAL_STACK_SIZE
/* Co-routine definitions. */ /* Co-routine definitions. */
@ -105,7 +105,7 @@
/* Software timer definitions. */ /* Software timer definitions. */
#define configUSE_TIMERS 1 #define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 3 ) #define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 10 #define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE ) #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )

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

@ -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 /* To limit the amount of stack required by each task, this port uses a
separate stack for interrupts. */ separate stack for interrupts. */
unsigned long *pulISRStack; unsigned long ulISRStack;
unsigned long *pulISRStack = &ulISRStack;
/* The instance of the interrupt controller used by this port. */ /* The instance of the interrupt controller used by this port. */
static XIntc xInterruptControllerInstance; static XIntc xInterruptControllerInstance;
@ -176,7 +177,7 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14 - return address for interrupt. */ *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14 - return address for interrupt. */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x0f; /* R15 - return address for subroutine. */ *pxTopOfStack = ( portSTACK_TYPE ) NULL; /* R15 - return address for subroutine. */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16 - return address for trap (debugger). */ *pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16 - return address for trap (debugger). */
pxTopOfStack--; pxTopOfStack--;
@ -225,14 +226,15 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
portBASE_TYPE xPortStartScheduler( void ) portBASE_TYPE xPortStartScheduler( void )
{ {
extern void ( vPortStartFirstTask )( void ); extern void ( vPortStartFirstTask )( void );
extern unsigned long *_stack; extern unsigned long _stack[];
/* Setup the hardware to generate the tick. Interrupts are disabled when /* Setup the hardware to generate the tick. Interrupts are disabled when
this function is called. */ this function is called. */
vApplicationSetupTimerInterrupt(); vApplicationSetupTimerInterrupt();
/* Allocate the stack to be used by the interrupt handler. */ /* 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 /* Restore the context of the first task that is going to run. From here
on, the created tasks will be executing. */ on, the created tasks will be executing. */

@ -1529,8 +1529,15 @@ signed portBASE_TYPE xReturn;
prvLockQueue( pxQueue ); prvLockQueue( pxQueue );
if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0U ) if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0U )
{ {
/* There is nothing in the queue, block for the specified period. */ /* There is nothing in the queue, block for the specified period,
vTaskPlaceOnEventListRestricted( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait ); 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 ); prvUnlockQueue( pxQueue );
} }

@ -1792,7 +1792,7 @@ portTickType xTimeToWake;
designed for use by kernel code, and has special calling requirements - designed for use by kernel code, and has special calling requirements -
it should be called from a critical section. */ it should be called from a critical section. */
/* Place the event list item of the TCB in the appropriate event list. /* 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 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 be waiting on this event list, so the faster vListInsertEnd() function

@ -311,6 +311,8 @@ portBASE_TYPE xListWasEmpty;
/* Just to avoid compiler warnings. */ /* Just to avoid compiler warnings. */
( void ) pvParameters; ( void ) pvParameters;
vTaskDelay( 2 );
for( ;; ) for( ;; )
{ {
/* Query the timers list to see if it contains any timers, and if so, /* Query the timers list to see if it contains any timers, and if so,

@ -208,13 +208,16 @@ void vRegisterTest2( void *pvParameters )
" addi r31, r0, 1031 \n\t" " 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 /* 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 was written to them above. This task will get preempted frequently so
other tasks are likely to have executed since the register values were other tasks are likely to have executed since the register values were
written. */ written. */
asm volatile ( " xori r18, r3, 103 \n\t" \
asm volatile ( "Loop_Start_2: \n\t" \
" xori r18, r3, 103 \n\t" \
" bnei r18, Error_Loop_2 \n\t" \ " bnei r18, Error_Loop_2 \n\t" \
" xori r18, r4, 104 \n\t" \ " xori r18, r4, 104 \n\t" \
" bnei r18, Error_Loop_2 \n\t" \ " bnei r18, Error_Loop_2 \n\t" \

@ -269,9 +269,9 @@ int main( void )
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
// vStartQueuePeekTasks(); vStartQueuePeekTasks();
// vStartRecursiveMutexTasks(); vStartRecursiveMutexTasks();
// vStartMathTasks( mainFLOP_TASK_PRIORITY ); vStartMathTasks( mainFLOP_TASK_PRIORITY );
/* The suicide tasks must be created last as they need to know how many /* 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 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 the reasons stated in the comments above the call to
vStartTimerDemoTask(), that the check timer is not actually started vStartTimerDemoTask(), that the check timer is not actually started
until after the scheduler has been 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 /* 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 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 ingnored at this point anyway as block times can only be specified when
the scheduler is running. */ the scheduler is running. */
// xTimerStart( xCheckTimer, mainDONT_BLOCK ); xTimerStart( xCheckTimer, mainDONT_BLOCK );
/* Start the tasks running. */ /* Start the tasks running. */
vTaskStartScheduler(); vTaskStartScheduler();

Loading…
Cancel
Save