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

5 views (last 30 days)
I am trying to use CMSIS Code Replacement Library (CRL) targeting ARM Cortex-M in R2019a.
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>/Sin
The corresponding implementation header is mw_cmsis.h, which again includes arm_math.h from CMSIS library.
During build, I see below below error using Visual Studio 2017:
....\harness_embedded_light_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 26 Jul 2019
There are two things to note about builds using 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 root cause for the error message is that no Hardware Board was selected in the model. CMSIS CRL will work when you select any of the Hardware boards that we ship as part of ARM Cortex Support Packages.
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, you can follow the Target Creation workflow to create a target for your hardware as explained here: https://www.mathworks.com/help/supportpkg/armcortexm/target-sdk.html
In this way, you can create a target and add the necessary information such as architecture, library name etc.
  1 Comment
Jose Cazarin
Jose Cazarin on 30 Jan 2020
Hello! I cannot find this "Hardware Implementation" are in my Matlab Coder app. I even searched for "hardware" in the "All Setings" tab but nothing is returned (see screenshot attached). Can you tell me where it is please?
matlab.png

Sign in to comment.

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!