Quality RTOS & Embedded Software

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


Stuck with semaphore compiler errors

Posted by TC on July 8, 2009
I'm getting two compiler errors due to the use of semaphores that I can' t figure out - details below.

I'm compiling for an NXP LPC-2103 ARM7-TDMI micro using:

- FreeRTOS V5.3.0
- Eclipse Ganeymeded V3.4.2
- Zylin Embedded CDT V4.6.1
binutils: 2.19.1
gcc: 4.3.3
newlib: 1.17.0
gdb: 6.8.50-20080308-cvs

I'm trying to use semaphores to implement deferred interrupt processing. I have:

- an init function called from main.c that creates the semaphore...

vSemaphoreCreateBinary( xI2CSemaphore );

- an isr wrapper and an isr
- the isr "gives" the semaphore

xSemaphoreGiveFromISR(xI2CSemaphore, &xI2CSemaphoreWokeTask);

- a task "takes" the semaphore

if (xSemaphoreTake(xI2CSemaphore, (portTickType) 1) == pdTRUE) {

I have the init function and the task in a common .c file that includes a global variable definition for the semaphore handle

xSemaphoreHandle xI2CSemaphore = NULL;

The isr wrapper and isr are in another .c file that includes an external global variable reference

extern xSemaphoreHandle xI2CSemaphore;

I get the following errors:

PROJECT/i2cISR.c:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'xI2CSemaphore'
PROJECT/i2cISR.c: In function 'vI2C_ISR':
PROJECT/i2cISR.c:74: error: 'xI2CSemaphore' undeclared (first use in this function)

I'm stuck. Any help is appreciated!


RE: Stuck with semaphore compiler errors

Posted by Adam Turowski on July 8, 2009
Compiler doesn't understand, what xSemaphoreHandle means. Propably you forgot to include "semphr.h" file in header, where your

extern xSemaphoreHandle xI2CSemaphore;



RE: Stuck with semaphore compiler errors

Posted by TC on July 8, 2009
That was it. I figured I was leaving out something obvious but I just couldn't figure it out.

Thanks for the help!


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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner