|ARM Technical Support Knowledge Articles|
In order to utilize some of the DSP multiplication instructions in the ARM v6 and v7 ISA such as
SMMULR, the ARM Compiler toolchain provides the header file
armdsp.h in the "
Include" directory which uses inline assembly to define functions that implement these instructions. These functions are declared with the keyword
__inline which allows the ARM Compiler (
armcc) to efficiently inline the desired instructions in the calling C source code.
However, prior to ARM Compiler 5.01, the inline assembler does not support Thumb code,
armcc does not inline the desired DSP instructions when building for Thumb (using compiler option
--thumb), but instead produces branches to these subroutines. This does not occur when compiling for ARM (using the default compiler option
armcc can also generate these DSP instructions by recognizing specific C idioms in the source code. The attached header file
signed_mul.h defines inline functions using these C idioms that allow
armcc to effectively produce the aforementioned DSP instructions for both ARM and Thumb modes.
The attached file
main.c shows how to use the functions defined in the header file
signed_mul.h. This C code is built using the following commands:
armcc --thumb -c --debug --cpu=7E-M -O3 --forceinline --asm --interleave -o main.o main.c armlink --cpu=7E-M --map --list=map.txt -o image.axf main.o
Article last edited on: 2011-10-07 10:08:27
Did you find this article helpful? Yes No
How can we improve this article?