Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

unable to create semaphore

Posted by Angel Eyes on September 2, 2008
Hi I am getting some compilation errors when I am trying to create semaphores , like "implicit declaration of function in xQueueCreate" etc

Am I going wrong somewhere , am I not including the right header files ? I am pasting the code below. This is for the Samsung S3C4510 processor, I am able to run simple tasks on it .


#include "S3C4510.h"
/* Standard includes. */
#include <stdlib.h>
#include <string.h>
#include "semphr.h"

/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"

/* Demo application includes. */
#include "partest.h"
#include "flash.h"
#include "integer.h"
#include "PollQ.h"
#include "comtest2.h"
#include "semtest.h"
#include "flop.h"
#include "dynamic.h"
#include "BlockQ.h"
#include "serial.h"
int counter = 0 ;
#define mainCHECK_TASK_PRIORITY 3
#define mainCHECK_TASK_PRIORITY1 3

static void vErrorChecks( void *pvParameters );

static void vErrorChecks1( void *pvParameters );
xSemaphoreHandle xSemaphore = NULL ;
void timersetup (void );

int main(void)
{
int i;



xTaskCreate( vErrorChecks, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
xTaskCreate( vErrorChecks1, ( signed portCHAR * ) "Check1", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY1, NULL );

char * hellostr=" Hi this is mr y here, Starting Scheduler! \n ";
long* paddr=(long*)0x3ffd00c;

for(i=0;i<45;i++)
{
* paddr=hellostr;

}


vSemaphoreCreateBinary( xSemaphore );

vTaskStartScheduler();

return 0;
}



void vErrorChecks( void * pvParameters )
{
for (;;) {
// Task code goes here.
if ( cSemaphoreTake( xSemaphore, 0 ) )
{

int i;
char * hellostr="Running Task T1 \n ";
long* paddr=(long*)0x3ffd00c;

for(i=0;i<20;i++)
{
* paddr=hellostr;

}
cSemaphoreGive( xSemaphore );

}
}
}



void vErrorChecks1( void * pvParameters )
{
for (;;) {
// Task code goes here.
if ( cSemaphoreTake( xSemaphore, 0 ) )
{

int i;
char * hellostr="Running Task T2 \n ";
long* paddr=(long*)0x3ffd00c;

for(i=0;i<20;i++)
{
* paddr=hellostr;

}
cSemaphoreGive( xSemaphore );

}
}
}

RE: unable to create semaphore

Posted by Richard on September 2, 2008
Include FreeRTOS.h before semphr.h, then you should be ok.

Coincidentally I updated the code in SVN just yesterday to add in a #error message to inform people of just this problem.

Regards.

RE: unable to create semaphore

Posted by Angel Eyes on September 2, 2008
Hi Richard,

Thanks , I will try it out . As you can see in the code I had pasted previously, I have created the semaphore in the main function and declared it before main . Will this work ?

Do I need to create a semaphore in a task explicitly ?

Regards


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS