groufosse wrote on Wednesday, December 19, 2012:
Hi,
I’ve managed to modify this example program to compile:
FreeRTOSV7.3.0\FreeRTOS\Demo\CORTEX_LPC1768_IAR
I have also added CMSIS library files that I require and everything seems to compile OK. One of the files added is
“debug_frmwrk.h” that allows me to add debug statements to output on the UART0 port of the device. This too is working.
I have removed any of the code associated with the web server and USB, just leaving in the code for the LED flashing task.
I’ve palced DBG statements in the code so I can see how far it’s getting. The code gets into the function “vTaskStartScheduler”, up to line AFTER this function call:
portCONFIGURE_TIMER_FOR_RUN_TIME_STATS();
It executes that function, and that’s the end of it. The LED’s do not flash. In the function “vParTestInitialise”, I can enable the LED’s on my board to be ON or OFF to start, but they stay in the initialized state. Below is the code from “main” if it helps
Can someone please advise on what to try next.
Thank you, regards,
Gary
****************************************************************************************************************************
/* Scheduler includes. */
#include “FreeRTOS.h”
#include “task.h”
/* Demo app includes. */
#include “BlockQ.h”
#include “integer.h”
#include “blocktim.h”
#include “flash.h”
#include “partest.h”
#include “semtest.h”
#include “PollQ.h”
#include “GenQTest.h”
#include “QPeek.h”
#include “recmutex.h”
//gr includes
#include “debug_frmwrk.h”
#include “lpc17xx.h”
/*---------------------------------------*/
/* The time between cycles of the ‘check’ functionality (defined within the
tick hook). */
#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS )
/* The toggle rate for the LED. */
#define mainLED_TOGGLE_RATE ( ( portTickType ) 1000 / portTICK_RATE_MS )
/* Task priorities. */
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainUIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
/* The WEB server has a larger stack as it utilises stack hungry string
handling library calls. */
/* The message displayed by the WEB server when all tasks are executing
without an error being reported. */
#define mainPASS_STATUS_MESSAGE “All tasks are executing without error.”
/*---------------------------------------*/
/*
* Configure the hardware for the demo.
*/
static void prvSetupHardware( void );
/*
* Very basic task that does nothing but use delays to flash an LED.
*/
static void prvFlashTask( void *pvParameters );
/*---------------------------------------*/
int main( void )
{
debug_frmwrk_init();
_DBG_(“Initialized”);
/* Configure the hardware for use by this demo. */
prvSetupHardware();
/* Start the standard demo tasks. These are just here to exercise the
kernel port and provide examples of how the FreeRTOS API can be used. */
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartQueuePeekTasks();
vStartRecursiveMutexTasks();
_DBG_(“Demo tasks started.”);
/* Create the simple LED flash task. */
xTaskCreate( prvFlashTask, ( signed char * ) “Flash”, configMINIMAL_STACK_SIZE, ( void * ) NULL, mainFLASH_TASK_PRIORITY, NULL );
_DBG_(“xTask created.”);
/* Start the scheduler. */
vTaskStartScheduler();
/* Will only get here if there was insufficient memory to create the idle
task. The idle task is created within vTaskStartScheduler(). */
for( ;; );
}
/*---------------------------------------*/
void vApplicationTickHook( void )
{
static unsigned long ulTicksSinceLastDisplay = 0;
_DBG_(“In vApplicationTickHook.”);
/* Called from every tick interrupt as described in the comments at the top
of this file.
Have enough ticks passed to make it time to perform our health status
check again? */
ulTicksSinceLastDisplay++;
if( ulTicksSinceLastDisplay >= mainCHECK_DELAY )
{
/* Reset the counter so these checks run again in mainCHECK_DELAY
ticks time. */
ulTicksSinceLastDisplay = 0;
/* Has an error been found in any task? */
if( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
_DBG_(“An error has been detected in the Generic Queue test/demo.”);
}
else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
{
_DBG_(“An error has been detected in the Peek Queue test/demo.”);
}
else if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
_DBG_(“An error has been detected in the Block Queue test/demo.”);
}
else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
{
_DBG_(“An error has been detected in the Block Time test/demo.”);
}
else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
_DBG_(“An error has been detected in the Semaphore test/demo.”);
}
else if( xArePollingQueuesStillRunning() != pdTRUE )
{
_DBG_(“An error has been detected in the Poll Queue test/demo.”);
}
else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
_DBG_(“An error has been detected in the Int Math test/demo.”);
}
else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
_DBG_(“An error has been detected in the Mutex test/demo.”);
}
}
}
/*---------------------------------------*/
static void prvFlashTask( void *pvParameters )
{
_DBG_(“In prvFlashTask.”);
portTickType xLastFlashTime;
/* We need to initialise xLastFlashTime prior to the first call to
vTaskDelayUntil(). */
xLastFlashTime = xTaskGetTickCount();
for(;
{
/* Simply toggle the LED between delays. */
vTaskDelayUntil( &xLastFlashTime, mainLED_TOGGLE_RATE );
vParTestToggleLED( 0 );
}
}
/*---------------------------------------*/
void prvSetupHardware( void )
{
_DBG_(“In prvSetupHardware.”);
/* Configure the LEDs. */
vParTestInitialise();
}
/*---------------------------------------*/
void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
{
_DBG_(“In vApplicationStackOverflowHook.”);
/* This function will get called if a task overflows its stack. */
( void ) pxTask;
( void ) pcTaskName;
for( ;; );
}
/*---------------------------------------*/
void vConfigureTimerForRunTimeStats( void )
{
const unsigned long TCR_COUNT_RESET = 2, CTCR_CTM_TIMER = 0x00, TCR_COUNT_ENABLE = 0x01;
_DBG_(“In vConfigureTimerForRunTimeStats.”);
/* This function configures a timer that is used as the time base when
collecting run time statistical information - basically the percentage
of CPU time that each task is utilising. It is called automatically when
the scheduler is started (assuming configGENERATE_RUN_TIME_STATS is set
to 1). */
/* Power up and feed the timer. */
LPC_SC->PCONP |= 0x02UL;
LPC_SC->PCLKSEL0 = (LPC_SC->PCLKSEL0 & (~(0x3<<2))) | (0x01 << 2);
/* Reset Timer 0 */
LPC_TIM0->TCR = TCR_COUNT_RESET;
/* Just count up. */
LPC_TIM0->CTCR = CTCR_CTM_TIMER;
/* Prescale to a frequency that is good enough to get a decent resolution,
but not too fast so as to overflow all the time. */
LPC_TIM0->PR = ( configCPU_CLOCK_HZ / 10000UL ) - 1UL;
/* Start the counter. */
LPC_TIM0->TCR = TCR_COUNT_ENABLE;
_DBG_(“Exiting vConfigureTimerForRunTimeStats.”);
}
/*---------------------------------------*/