I want to use DSB instruction with inline assembly in my C code.
With ARM C/C++ Compiler, 4.1 [Build 894], it results in compilation error - instruction not allowed for inline assembly.
__asm("DSB"); is not allowed.
But it is possible to use embedded assembly of this instruction with a wrapper function as below.
__asm void fXYZ()
{
DSB
}
But since I need to use it inline in C code, I tried
__inline __asm void fXYZ()
or
__forceinline __asm void fXYZ()
but compiler is ignoring the __inline/__forceinline.
I tried using optimization option -Otime as suggested in ARM manual, but still there was no success.
Please suggest a solution.
You're in luck: although it's not documented that old version of armcc has the __dsb intrinsic from ACLE 1.1 (ARM® C Language Extensions). So you can use: __inline void fXYZ() { __dsb(15); }
Thanks.