mohanraoksm wrote on Tuesday, December 02, 2014:
BaseType_t taskReturn;
QueueHandle_t xQueue;
void my_task(void *variable1)
{
long i;
while(1)
{
IOSET0 |= 0xC00000;
xQueueReceive(xQueue,&i,1000);
vTaskDelay(100); //keeps task in sleep mode for 100ms
}
}
void my_task1(void *variable1)
{
long j;
while(1)
{
IOCLR0 |= 0xC00000;
xQueueSend(xQueue,&j,1000);
vTaskDelay(100); //keeps task in sleep mode for 100ms
}
}
int main()
{
IODIR0 |= 0xC00000;
//number of items in the queue = 10
// each size is int
xQueue = xQueueCreate( 1024, sizeof( uint32_t ) );
if (xQueue != NULL)
{
//Create Tasks here
//Task name is my_task
// const char * is used for task list creation
//prority = 1
//pointer passed, variable1 = NULL
taskReturn = xTaskCreate(my_task, (const char *) "my_task", 1024, NULL, 1, NULL);
taskReturn = xTaskCreate(my_task1, (const char *) "my_task1", 1024, NULL, 1, NULL);
}
//scheduler to be started once the queue and tasks are defined
vTaskStartScheduler();
return 0;
}
I have the above code written for LPC2148 microcontroller. When i try to compile and run the code, it doesn’t give any error. but the code goes to DATA ABORT condition. The Data abort occurs when it tries to execute vTaskStartScheduler() function.
When i see the port.c, i see the following code:
BaseType_t xPortStartScheduler( void )
{
/* Start the timer that generates the tick ISR. */
prvSetupTimerInterrupt();
/* Start the first task. This is done from portISR.c as ARM mode must be
used. */
vPortStartFirstTask();
/* Should not get here! */
return 0;
}
In the above code, we have vPortStartFirstTask(); which is not defined anywhere. also, i see the following declaration in port.c
extern __asm void vPortStartFirstTask( void );
The above declaration shows a warning “expected identifier or ‘(’” when i place the cursor.
I am unable to understand how asm file gets intergated to c code here and where from vPortStartFirstTask(); is coming. Please, guide me here.
This is my first project with FreeRTOS and i am trying to find a way out of here.