I want to use the SIMD and other CM7 instructions in my application. It is not clear to me whether the SDK/CMSIS or compiler has either built-ins functions or macros that support them. I see that the cmsis_gcc.h file contains some macros for the SIMD intrinsics, but they seem to be guarded by some #if defined statements, and the symbols do not appear to be defined anywhere (one of the symbols is __ARM_ARCH_7EM__, is that the architecture of the CM7?). Also, if I look at the gnu C documentation, there appears to possibly be some built-in functions for these intrinisics. However, it is not clear to me whether MCUXpresso is using the GNU c compiler (all the pre-processor symbols seem to indicate so, however, the current toolchain is listed as "NXP MCU Tools" - though I assume they are just vendor specific compilations of GNU tools).
Bottom line, there are some specific CM7 core instructions I would like to take advantage of without needing to write assembly routines. How do I go about doing so?
Hi,
I have had a similar issue recently. and this is what i got . It depends on the kind of compiler you are using. if you have included the cmsis files in your project, then in your project tree within your IDE, you can find cmsis_compiler.h within the cmsis folder. that defines the compiler your project will compile with. ( GNU Compiler, IAR Compiler, TI Arm Compiler,TASKING Compiler,COSMIC Compiler). so depending on which compiler you are using, you need to define some #define symbols for generic C/C++ source code. for those #defines that you need , check this link
Compiler Control . if you are using arm cortex m4 with FPU and your compiler is GNU Compiler, you need to define
````#define | |
#define __ARM_FEATURE_DSP 1 |
in the cmsis_gcc.h
and the project should compile fine without problems
KV58F1M0xxx24.
One of the things I noticed is that I assumed the functions were not available because the C indexer shows them as gray ( in cmsis_gcc.h, line 963 and following) - indicating that the C indexer does not see the following symbols defines:
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
(defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
However, when I compile, I am not getting any errors using these intrinsics - so either the values are recognized natively by the compiler, or these symbols are being defined somewhere that the Eclipse C indexer (and myself) cannot see.
It may turn out that I don't need to use these intrinsics because I just found the NXP RTCESL library which may end up giving me what I am looking for (which is efficient fixed point math using supporting the Cortex-M7 core).
Also, I noticed that the cmsis_gcc.h file does not contain the _SMLAL and _UMLAL instructions which I was thinking I might try to use - but that seems to be more of a CMSIS choice to not include those rather than anything NXP specific.
Hi,
Could you tell us which MCU are you using?
Thanks in advance!
Best Regards,
Carlos Mendoza
Technical Support Engineer
I am trying to use simd instructions on CM7 (RT1010, RT1050...). I tried to set those macro to 1. It did not work. So I add arm_neon.h path to project properties (C/C++ build -> Settings -> Includes). So now I can compile my simdy code. and got more erroes. So I tried ...
-mcpu=cortex-a7 -mfpu=neon
--with-arch=armv7-a --with-fpu=vfpv3-d16
.... and bunch of other options on the Internet I can find .... but I am still getting this error. Any suggestions?
C:\nxp\MCUXpressoIDE_11.4.1_6260\ide\tools\lib\gcc\arm-none-eabi\10.2.1\include/arm_neon.h:10403:1: error: inlining failed in call to 'always_inline' 'vld1q_u8': target specific option mismatch
10403 | vld1q_u8 (const uint8_t * __a)
| ^~~~~~~~