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/portable/GCC/MicroBlaze}&quot;"/>
</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"/>
</tool>
<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"/>
</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.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">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<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 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 )

@ -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
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. */

@ -1529,9 +1529,16 @@ signed portBASE_TYPE xReturn;
prvLockQueue( pxQueue );
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,
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 );
}

@ -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,

@ -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" \

@ -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();

Loading…
Cancel
Save