Quality RTOS & Embedded Software

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


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 ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists