FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2013 Threads] xTaskCreate Parameter ErrorPosted by rog57 on March 27, 2013 Hi, I'm getting this error when I compile : Error[Pe167]: argument of type "void (*)(void *, void *)" is incompatible with parameter of type "pdTASK_CODE" C:\Users\jdd\Documents\IAR Embedded Workbench\Code_Base\RTOS\System_Control.c 36
Can someone please tell me what might cause this? It's in a separate file (System_Control.c) , in a function that's called from main(), which that function is declared in a header file. Here is the call from main: ReadCOMmBufferTaskFunction( pvParameters );
The function in main is itself a task created by "xTaskCreate"
Thanks for any help!
RE: xTaskCreate Parameter ErrorPosted by Richard Damon on March 27, 2013 The error say that the task function being passed at this point is taking two parameters, both of which are pointer to void. This is the wrong signature. A task function needs to have exactly 1 parameter, of type pointer to void.
Check carefully the function, and its signature, on the line being flaged as an error.
RE: xTaskCreate Parameter ErrorPosted by rog57 on March 27, 2013 Hi, Thanks - that fixed it. Sometimes those messages can be a bit cryptic to the non-experienced. What I was trying to do was pass in an additional parameter - the xMutexMemoryAccess handle. I was not aware I couldn't add extra parameters to the function call. I need to get that handle over to the C file that has functions that use it. it's also used in the C file where it's created. No other way to get it over other than using an "extern" ?
RE: xTaskCreate Parameter ErrorPosted by Richard on March 27, 2013 The void * parameter allows you to send whatever you want - but it has to be a single parameter. If you want to send multiple parameters then place the parameters in a structure and send a pointer to the structure. Here is an example from one of the standard demo tasks: /* Structure used to pass parameters to each task. */ typedef struct SEMAPHORE_PARAMETERS { xSemaphoreHandle xSemaphore; volatile unsigned long *pulSharedVariable; portTickType xBlockTime; } xSemaphoreParameters;
/* Create the structure used to pass parameters to the first two tasks. */ pxFirstSemaphoreParameters = pvPortMalloc( sizeof( xSemaphoreParameters ) );
if( pxFirstSemaphoreParameters != NULL ) { /* Create the semaphore used by the first two tasks. */ vSemaphoreCreateBinary( pxFirstSemaphoreParameters->xSemaphore );
if( pxFirstSemaphoreParameters->xSemaphore != NULL ) { /* Create the variable which is to be shared by the first two tasks. */ pxFirstSemaphoreParameters->pulSharedVariable = ( unsigned long * ) pvPortMalloc( sizeof( unsigned long ) );
/* Initialise the share variable to the value the tasks expect. */ *( pxFirstSemaphoreParameters->pulSharedVariable ) = semtstNON_BLOCKING_EXPECTED_VALUE;
/* The first two tasks do not block on semaphore calls. */ pxFirstSemaphoreParameters->xBlockTime = ( portTickType ) 0;
/* Spawn the first two tasks. As they poll they operate at the idle priority. */ xTaskCreate( prvSemaphoreTest, ( signed char * ) "PolSEM1", semtstSTACK_SIZE, ( void * ) pxFirstSemaphoreParameters, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL ); } }
Regards.
RE: xTaskCreate Parameter ErrorPosted by rog57 on March 27, 2013 Richard,
Thanks for taking the time to explain this. I'll give that a try as it looks to be what I need.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|