compiler error in queue.c at taskYIELD

mkrug wrote on Sunday, January 03, 2010:


I get the compiler error:
Error: missing expression - `swi’ in queue.c at the line(s) taskYIELD. I am using RTOS 6.0.1 for the ARM7 in the GCC version. However I tried a 5.x queue.c file with the same result. Additionally I generated a list file of queue. c that has the following appearence:
485:C:/ARM7Programme/workspace/RTOS/rtos/source\queue.c **** taskYIELD

308              .loc 1 486 0

309              @ 486 “C:/ARM7Programme/workspace/RTOS/rtos/source/queue.c” 1

310              SWI

311              @ 0 “” 2

So in principle the replacement of taskYIELD() to SWI seems OK. So my guess is more of an assembler syntax problem. I also tried the different portmacro.h versions for the ARM7 that are available without any success.
I am using the gcc version 4.4.2 and assembler 2.2.

Does anybody has a hint ?

Best Regards

aturowski wrote on Sunday, January 03, 2010:

Latest GCC & binutils requires that every SWI instruction should be followed by number which is passed to called software exception. Before tools assumed that the lack of this number means 0. So add 0 to SWI and it should compile/work.

You may fing example how to change that in


aturowski wrote on Sunday, January 03, 2010:

Exactly in line 231

Hope that helps,

bejkarna wrote on Tuesday, January 05, 2010:


to previous reply its actulay line 213

as I changed the line to

#define portYIELD() __asm volatile ( “SWI 0” )

the SWI errors disappeared but others came out:

…/…/…/Source/queue.c: In function ‘xQueueGenericSend’:

…/…/…/Source/queue.c:480: error: stray ‘\240’ in program

eclipse shows that this error is caused everywhere the portYIELD_WITHIN_API(); function is called in queue.c

rtel wrote on Tuesday, January 05, 2010:

In all but the ports that support memory protection it is defined as

#define portYIELD_WITHIN_API portYIELD

I would guess that the problem is in your edit of portYIELD.

240 is not an ascii character (only an extended ascii character).


bejkarna wrote on Tuesday, January 05, 2010:

Sorry, you are right I found this somewhere else, now I changed it to

<pre><code> #define portYIELD()              asm volatile  ( “SWI 0” ) </code></pre>

and everything works fine.

Thanks all of you.

mkrug wrote on Tuesday, January 05, 2010:


thanks everyone for their help. It was simply to change the SWI instruction to SWI 0

Best Regards