Code replacement for "abs" is "mw_arm_abs_f32" instead of "fabs"

2 views (last 30 days)
I am attempting to generate code for the ARM Cortex-M using Embedded Coder. I am using a code replacement library in order to do this but it is not working correctly because the code generation process is replacing the calls to "abs" with "mw_arm_abs_f32" instead of the expected "fabs". How can I get code to be generated using the "fabs" function?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Feb 2017
Code replacement during the code generation process is based on a series of constraints. If these constraints are met for a given case, the code is replaced with the specific function. You can view the code replacement table for the ARM Cortex-M using the command below:
 
RTW.viewTfl('ARM Cortex-M')
You will be able to see the constraints which must be met in order for each replacement to happen. As can be seen in the "In1Type" section for the "mw_arm_abs_f32" replacement, the size is a column vector of singles. Therefore, if you want to avoid this replacement being applied, you must ensure the size of the input is a 1x1 variable. If none of the replacement constraints are met, "fabs" will be used.

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!