Clear Filters
Clear Filters

Why do I get build errors about missing headers (arm_math.h) when using CMSIS Code Replacement Library for ARM Cortex?

11 views (last 30 days)
I am trying to use CMSIS Code Replacement Library (CRL) while targetting ARM Cortex-M with MATLAB/Simulink.
My model contains cosine and sine blocks. After code generation, the Code Replacement Report confirms that crl_table_cmsis.mat library was used:
arm_cos_f32................<Root>/Sin1
arm_sin_f32................<Root>/Sin2
The corresponding implementation header is mw_cmsis.h, which again includes arm_math.h from CMSIS library.
During the build, I see below below error using Visual Studio 2017:
....\<modelname>_ert_rtw\mw_cmsis.h(12): fatal error C1083: Cannot open include file: 'arm_math.h': No such file or directory

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 Apr 2024
Edited: MathWorks Support Team on 17 Apr 2024
There are two things to note about builds using the CMSIS code replacement libraries (CRL):
1) CMSIS libraries only work with GNU toolchains, not with Visual Studio compilers. Ensure that the selected toolchain is "GNU Tools for ARM Embedded Processors" in the "Code Generation" area of your model's Configuration Parameters.
2) The CMSIS CRL works only out-of-the-box with the ARM Cortex-M Support Package:
The CMSIS CRL will work when you select any of the Hardware boards that we ship as part of ARM Cortex Support Packages. Therefore, make sure that you have selected the appropriate board in the model settings under Hardware Implementation > Hardware Board.
CMSIS needs this information, for example which ARM architecture (M0, M3, ...M7) is used. The correct CMSIS library will be selected based on the selected architecture. This information is coming from the Hardware Board parameter. Set this parameter accordingly in the "Hardware Implementation"  area of your model's Configuration Parameters.
If you are not using any of the hardware boards that we support as part of our support packages, or a third-party target, you can follow the Target Creation workflow to create a target for your hardware as explained here: 
In this way, you can create a target and add the necessary information such as architecture, library name etc.
 

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!