Latest TriCore demo files - these still contain some debug code, and are not yet fully documented.

pull/4/head
Richard Barry 13 years ago
parent b8c1195c40
commit 93c4c48f78

@ -53,8 +53,8 @@ IF EXIST FreeRTOS_Source Goto END
copy %COMMON_SOURCE%\flash.c Common_Demo_Source copy %COMMON_SOURCE%\flash.c Common_Demo_Source
copy %COMMON_SOURCE%\comtest.c Common_Demo_Source copy %COMMON_SOURCE%\comtest.c Common_Demo_Source
copy %COMMON_SOURCE%\TimerDemo.c Common_Demo_Source copy %COMMON_SOURCE%\TimerDemo.c Common_Demo_Source
copy %COMMON_SOURCE%\countsem.c Common_Demo_Source copy %COMMON_SOURCE%\countsem.c Common_Demo_Source
copy %COMMON_SOURCE%\integer.c Common_Demo_Source copy %COMMON_SOURCE%\integer.c Common_Demo_Source
REM Copy the common demo file headers. REM Copy the common demo file headers.
copy %COMMON_INCLUDE%\*.h Common_Demo_Source\include copy %COMMON_INCLUDE%\*.h Common_Demo_Source\include

@ -69,7 +69,7 @@
/*----------------------------------------------------------*/ /*----------------------------------------------------------*/
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0 #define configUSE_IDLE_HOOK 1
/* CPU is actually 150MHz but FPIDIV is 1 meaning divide by 2 for the /* CPU is actually 150MHz but FPIDIV is 1 meaning divide by 2 for the
peripheral clock. */ peripheral clock. */
#define configCPU_CLOCK_HZ ( ( unsigned long ) 150000000UL ) #define configCPU_CLOCK_HZ ( ( unsigned long ) 150000000UL )
@ -77,14 +77,14 @@ peripheral clock. */
#define configTICK_RATE_HZ ( ( portTickType ) 1000UL ) #define configTICK_RATE_HZ ( ( portTickType ) 1000UL )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 6 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 6 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 35U * 1024U ) )
#define configMAX_TASK_NAME_LEN ( 16 ) #define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 0 #define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0 #define configIDLE_SHOULD_YIELD 0
#define configUSE_MALLOC_FAILED_HOOK 1 #define configUSE_MALLOC_FAILED_HOOK 1
#define configCHECK_FOR_STACK_OVERFLOW 0 #define configCHECK_FOR_STACK_OVERFLOW 0
#define configUSE_TICK_HOOK 1
#define configUSE_COUNTING_SEMAPHORES 1 #define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
@ -93,21 +93,11 @@ peripheral clock. */
#define configUSE_CO_ROUTINES 0 #define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Timer functionality. For space constraint reasons, the standard demo timer /* Software timer configuration. */
tests are only included in the build configuration that generates code that #define configUSE_TIMERS 1
runs from Flash, and not in the build configuration that generates code that #define configTIMER_TASK_PRIORITY ( 4 )
runs from RAM. */ #define configTIMER_QUEUE_LENGTH ( 5 )
#ifdef BUILD_FOR_RAM_EXECUTION #define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
#define configUSE_TIMERS 0
#define configUSE_TICK_HOOK 0
#else
#define configUSE_TIMER 1
#define configUSE_TICK_HOOK 1
#endif
#define configTIMER_TASK_PRIORITY ( 4 )
#define configTIMER_QUEUE_LENGTH ( 5 )
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
/* Set the following definitions to 1 to include the API function, or zero /* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */ to exclude the API function. */
@ -120,11 +110,27 @@ runs from RAM. */
#define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1 #define INCLUDE_vTaskDelay 1
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 64 #define configMAX_SYSCALL_INTERRUPT_PRIORITY 64 /* Interrupt above priority 64 are not effected by critical sections, but cannot call interrupt safe FreeRTOS functions. */
#define configKERNEL_INTERRUPT_PRIORITY 1 #define configKERNEL_INTERRUPT_PRIORITY 2 /* This is defined here for clarity, but the value must not be changed from 2. */
#define configKERNEL_YIELD_PRIORITY 1 /* This is defined here for clarity, but must not be changed from its default value of 1. */
/* Interrupt priorities. */
#define configINTERRUPT_PRIORITY_TX 16
#define configINTERRUPT_PRIORITY_RX 18
#define configHIGH_FREQUENCY_TIMER_PRIORITY ( configMAX_SYSCALL_INTERRUPT_PRIORITY - 1UL )
/* Default definition of configASSERT(). */ /* Default definition of configASSERT(). */
#define configASSERT( x ) if( ( x ) == 0 ) { portDISABLE_INTERRUPTS(); for( ;; ); } #define configASSERT( x ) if( ( x ) == 0 ) { portDISABLE_INTERRUPTS(); for( ;; ); }
extern volatile unsigned long ulNest, ulMaxNest;
#define COUNT_NEST() \
{ \
ulNest++; \
if( ulNest > ulMaxNest ) \
{ \
ulMaxNest = ulNest; \
} \
}
#endif /* FREERTOS_CONFIG_H */ #endif /* FREERTOS_CONFIG_H */

@ -69,10 +69,11 @@
#include <machine/cint.h> #include <machine/cint.h>
#include <machine/wdtcon.h> #include <machine/wdtcon.h>
#warning DOCUMENT THIS
/* This constant is specific to this test application. It allows the high /* This constant is specific to this test application. It allows the high
frequency (interrupt nesting test) timer to know how often to trigger, and the frequency (interrupt nesting test) timer to know how often to trigger, and the
check task to know how many iterations to expect at any given time. */ check task to know how many iterations to expect at any given time. */
#define tmrtestHIGH_FREQUENCY_TIMER_TEST_HZ ( 1931UL ) #define tmrtestHIGH_FREQUENCY_TIMER_TEST_HZ ( 8931UL )
static void prvPortHighFrequencyTimerHandler( int iArg ) __attribute__((longcall)); static void prvPortHighFrequencyTimerHandler( int iArg ) __attribute__((longcall));
static void prvHighFrequencyTimerTask( void *pvParameters ); static void prvHighFrequencyTimerTask( void *pvParameters );
@ -101,19 +102,9 @@ unsigned long ulCompareMatchBits;
/* Setup the interrupt itself. The STM module clock divider is setup when /* Setup the interrupt itself. The STM module clock divider is setup when
the tick interrupt is configured - which is when the scheduler is started - the tick interrupt is configured - which is when the scheduler is started -
so there is no need to do it here. */ so there is no need to do it here.
unlock_wdtcon(); The tick interrupt uses compare match 0, so this test uses compare match
{
/* Wait until access to Endint protected register is enabled. */
while( 0 != ( WDT_CON0.reg & 0x1UL ) );
/* RMC == 1 so STM Clock == FPI */
STM_CLC.reg = ( 1UL << 8 );
}
lock_wdtcon();
/* The tick interrupt uses compare match 0, so this test uses compare match
1, which means shifting up the values by 16 before writing them to the 1, which means shifting up the values by 16 before writing them to the
register. */ register. */
ulCompareMatchBits = ( 0x1fUL - __CLZ( ulCompareMatchValue ) ); ulCompareMatchBits = ( 0x1fUL - __CLZ( ulCompareMatchValue ) );
@ -127,10 +118,10 @@ unsigned long ulCompareMatchBits;
STM_CMCON.reg |= ulCompareMatchBits; STM_CMCON.reg |= ulCompareMatchBits;
STM_CMP1.reg = ulCompareMatchValue; STM_CMP1.reg = ulCompareMatchValue;
if( 0 != _install_int_handler( configMAX_SYSCALL_INTERRUPT_PRIORITY - 5, prvPortHighFrequencyTimerHandler, 0 ) ) if( 0 != _install_int_handler( configHIGH_FREQUENCY_TIMER_PRIORITY, prvPortHighFrequencyTimerHandler, 0 ) )
{ {
/* Set-up the interrupt. */ /* Set-up the interrupt. */
STM_SRC1.reg = ( ( configMAX_SYSCALL_INTERRUPT_PRIORITY - 5 ) | 0x00005000UL ); STM_SRC1.reg = ( configHIGH_FREQUENCY_TIMER_PRIORITY | 0x00005000UL );
/* Enable the Interrupt. */ /* Enable the Interrupt. */
STM_ISRR.reg &= ~( 0x03UL << 2UL ); STM_ISRR.reg &= ~( 0x03UL << 2UL );
@ -177,6 +168,7 @@ static void prvPortHighFrequencyTimerHandler( int iArg )
static volatile unsigned long ulExecutionCounter = 0UL; static volatile unsigned long ulExecutionCounter = 0UL;
unsigned long ulHigherPriorityTaskWoken = pdFALSE; unsigned long ulHigherPriorityTaskWoken = pdFALSE;
COUNT_NEST();
/* Just to avoid compiler warnings about unused parameters. */ /* Just to avoid compiler warnings about unused parameters. */
( void ) iArg; ( void ) iArg;
@ -200,4 +192,5 @@ unsigned long ulHigherPriorityTaskWoken = pdFALSE;
} }
portYIELD_FROM_ISR( ulHigherPriorityTaskWoken ); portYIELD_FROM_ISR( ulHigherPriorityTaskWoken );
ulNest--;
} }

@ -1,3 +1,4 @@
volatile unsigned long ulNest = 0UL, ulMaxNest = 0UL;
/* /*
FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd. FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.
@ -297,47 +298,52 @@ unsigned long ulHighFrequencyTimerTaskIterations, ulExpectedIncFrequency_ms;
lReturn = pdFAIL; lReturn = pdFAIL;
} }
if( xArePollingQueuesStillRunning() != pdTRUE ) if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
{ {
lReturn = pdFAIL; lReturn = pdFAIL;
} }
if( xAreSemaphoreTasksStillRunning() != pdTRUE ) if( xAreBlockingQueuesStillRunning() != pdTRUE )
{ {
lReturn = pdFAIL; lReturn = pdFAIL;
} }
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
{ {
lReturn = pdFAIL; lReturn = pdFAIL;
} }
if( xAreBlockingQueuesStillRunning() != pdTRUE ) if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
{ {
lReturn = pdFAIL; lReturn = pdFAIL;
} }
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{ {
lReturn = pdFAIL; lReturn = pdFAIL;
} }
if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) if( prvAreRegTestTasksStillRunning() != pdTRUE )
{ {
lReturn = pdFAIL; lReturn = pdFAIL;
} }
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) if( xIsCreateTaskStillRunning() != pdTRUE )
{ {
lReturn = pdFAIL; lReturn = pdFAIL;
} }
if( prvAreRegTestTasksStillRunning() != pdTRUE ) if( xAreTimerDemoTasksStillRunning( mainNO_ERROR_FLASH_PERIOD_MS ) != pdTRUE )
{ {
lReturn = pdFAIL; lReturn = pdFAIL;
} }
if( xIsCreateTaskStillRunning() != pdTRUE ) if( xArePollingQueuesStillRunning() != pdTRUE )
{
lReturn = pdFAIL;
}
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{ {
lReturn = pdFAIL; lReturn = pdFAIL;
} }
@ -353,18 +359,6 @@ unsigned long ulHighFrequencyTimerTaskIterations, ulExpectedIncFrequency_ms;
lReturn = pdFAIL; lReturn = pdFAIL;
} }
#if configUSE_TIMERS == 1
{
/* For space constraint reasons, do not include the timer demo in
builds that execute from RAM. */
if( xAreTimerDemoTasksStillRunning( mainNO_ERROR_FLASH_PERIOD_MS ) != pdTRUE )
{
lReturn = pdFAIL;
}
}
#endif
return lReturn; return lReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -393,7 +387,6 @@ void vApplicationMallocFailedHook( void )
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
to query the size of free heap space that remains (although it does not to query the size of free heap space that remains (although it does not
provide information on how the remaining heap might be fragmented). */ provide information on how the remaining heap might be fragmented). */
_debug();
taskDISABLE_INTERRUPTS(); taskDISABLE_INTERRUPTS();
for( ;; ); for( ;; );
} }
@ -455,6 +448,46 @@ portBASE_TYPE xReturn = pdPASS;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvOptionallyCreateComprehensveTestApplication( void )
{
#if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0
{
vStartIntegerMathTasks( tskIDLE_PRIORITY );
vStartDynamicPriorityTasks();
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartCountingSemaphoreTasks();
vStartGenericQueueTasks( tskIDLE_PRIORITY );
vStartRecursiveMutexTasks();
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vSetupInterruptNestingTest();
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
/* Create the register test tasks, as described at the top of this file. */
xTaskCreate( prvRegisterCheckTask1, ( signed char * ) "Reg 1", configMINIMAL_STACK_SIZE, &ulRegisterTest1Count, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegisterCheckTask2, ( signed char * ) "Reg 2", configMINIMAL_STACK_SIZE, &ulRegisterTest2Count, tskIDLE_PRIORITY, NULL );
/* Start the check task - which is defined in this file. */
xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* This task has to be created last as it keeps account of the number of tasks
it expects to see running. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
}
#else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */
{
/* Just to prevent compiler warnings when the configuration options are
set such that these static functions are not used. */
( void ) prvCheckTask;
( void ) prvRegisterCheckTask1;
( void ) prvRegisterCheckTask2;
}
#endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */
}
/*-----------------------------------------------------------*/
static void prvRegisterCheckTask1( void *pvParameters ) static void prvRegisterCheckTask1( void *pvParameters )
{ {
/* Make space on the stack for the parameter and a counter. */ /* Make space on the stack for the parameter and a counter. */
@ -668,53 +701,6 @@ static void prvRegisterCheckTask2( void *pvParameters )
/* The parameter is used but in the assembly. */ /* The parameter is used but in the assembly. */
(void)pvParameters; (void)pvParameters;
} }
/*-----------------------------------------------------------*/
static void prvOptionallyCreateComprehensveTestApplication( void )
{
#if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0
{
vStartIntegerMathTasks( tskIDLE_PRIORITY );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartDynamicPriorityTasks();
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartCountingSemaphoreTasks();
vStartGenericQueueTasks( tskIDLE_PRIORITY );
vStartRecursiveMutexTasks();
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vSetupInterruptNestingTest();
#if configUSE_TIMERS == 1
{
/* For space constraint reasons, do not include the timer demo in
builds that execute from RAM. */
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
}
#endif /* configUSE_TIMERS */
/* Create the register test tasks, as described at the top of this file. */
xTaskCreate( prvRegisterCheckTask1, ( signed char * ) "Reg 1", configMINIMAL_STACK_SIZE, &ulRegisterTest1Count, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegisterCheckTask2, ( signed char * ) "Reg 2", configMINIMAL_STACK_SIZE, &ulRegisterTest2Count, tskIDLE_PRIORITY, NULL );
/* Start the check task - which is defined in this file. */
xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* This task has to be created last as it keeps account of the number of tasks
it expects to see running. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
}
#else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */
{
/* Just to prevent compiler warnings when the configuration options are
set such that these static functions are not used. */
( void ) prvCheckTask;
( void ) prvRegisterCheckTask1;
( void ) prvRegisterCheckTask2;
}
#endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */
}
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

@ -67,12 +67,6 @@
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Interrupt priorities. */
#define serialINTERRUPT_PRIORITY_TX 16
#define serialINTERRUPT_PRIORITY_RX 18
/*---------------------------------------------------------------------------*/
/* /*
* See if the Serial Transmit Interrupt is currently activated, meaning that * See if the Serial Transmit Interrupt is currently activated, meaning that
* the interrupt is working through the back log of bytes that it needs to * the interrupt is working through the back log of bytes that it needs to
@ -135,16 +129,16 @@ unsigned long ulReloadValue = 0UL;
ASC0_CON.reg = 0x00008011; /* 1 Start, 1 Stop, 8 Data, No Parity, No Error Checking, Receive On, Module On. */ ASC0_CON.reg = 0x00008011; /* 1 Start, 1 Stop, 8 Data, No Parity, No Error Checking, Receive On, Module On. */
/* Install the Tx interrupt. */ /* Install the Tx interrupt. */
if( 0 != _install_int_handler( serialINTERRUPT_PRIORITY_TX, prvTxBufferInterruptHandler, 0 ) ) if( 0 != _install_int_handler( configINTERRUPT_PRIORITY_TX, prvTxBufferInterruptHandler, 0 ) )
{ {
ASC0_TBSRC.reg = serialINTERRUPT_PRIORITY_TX | 0x5000UL; ASC0_TBSRC.reg = configINTERRUPT_PRIORITY_TX | 0x5000UL;
xTransmitStatus = 0UL; xTransmitStatus = 0UL;
} }
/* Install the Rx interrupt. */ /* Install the Rx interrupt. */
if( 0 != _install_int_handler( serialINTERRUPT_PRIORITY_RX, prvRxInterruptHandler, 0 ) ) if( 0 != _install_int_handler( configINTERRUPT_PRIORITY_RX, prvRxInterruptHandler, 0 ) )
{ {
ASC0_RSRC.reg = serialINTERRUPT_PRIORITY_RX | 0x5000UL; ASC0_RSRC.reg = configINTERRUPT_PRIORITY_RX | 0x5000UL;
} }
/* COM Handle is never used by demo code. */ /* COM Handle is never used by demo code. */
@ -194,6 +188,8 @@ static void prvTxBufferInterruptHandler( int iArg )
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
unsigned char ucTx; unsigned char ucTx;
COUNT_NEST();
/* Just to remove compiler warnings about unused parameters. */ /* Just to remove compiler warnings about unused parameters. */
( void ) iArg; ( void ) iArg;
@ -214,6 +210,7 @@ unsigned char ucTx;
/* Finally end ISR and switch Task. */ /* Finally end ISR and switch Task. */
portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
ulNest--;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -221,7 +218,7 @@ static void prvRxInterruptHandler( int iArg )
{ {
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
unsigned char ucRx; unsigned char ucRx;
COUNT_NEST();
/* Just to remove compiler warnings about unused parameters. */ /* Just to remove compiler warnings about unused parameters. */
( void ) iArg; ( void ) iArg;
@ -239,6 +236,7 @@ unsigned char ucRx;
/* Finally end ISR and switch Task. */ /* Finally end ISR and switch Task. */
portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
ulNest--;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

Loading…
Cancel
Save