2023-01-17 09:55 AM
I want to use the intrinsic floating point absolute value function `__fabs` as noted in the compiler specific features in the armcc documentation.
When I build my project using the following settings on STM32CubeIDE:
I get an error saying undefined reference to `__fabs`; when I switch Toolchains to MDK-ARM the project compiles fine with `__fabs`. Are there some settings to enable intrinsic on STM32CubeIDE?
Thanks
2023-01-17 10:06 AM
> as noted in the compiler specific features in the armcc documentation.
But the compiler of CubeIDE is not armcc. It is gcc.
2023-01-19 07:43 AM
Hello @DLian.3,
I wonder check with you if your issue was resolved or you are stilling blocked :smirking_face: ?
I wait your reply.
Best regards,
Wijeden,
2023-01-19 09:00 AM
This issue is now resolved.
2023-01-20 12:47 AM
2023-01-23 09:06 AM
This may not be the solution you were looking for; however, I was left with some constraints;
My goal for the following code snippet was to use the standard math libraries `fabs` function if the intrinsic function was not defined.
// declare math fabs
double fabs(double);
// declare instrinsic __fabs for armcc
double __fabs(double value) __attribute__((weak));
double __fabs(double value) {
// use math libraries if not found
return fabs(value);
}
static inline double floatAbs(double value) {
return __fabs(value);
}