-
Notifications
You must be signed in to change notification settings - Fork 592
make foc_utils functions WEAK #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make foc_utils functions WEAK #262
Conversation
Makes sense, I like it. And would you be able to implement these functions in the arduino sketch? |
Yeah, in any cpp file that is part of the compile. But people can put them right in their sketch. I'm thinking of including an example also. So if its ok, then I will merge this :-) Then next I think we maybe have an optimised _sin() function - a little faster, a little more accurate and with built-in normalisation of the angle. I'm just testing it on various architectures. But I'll make a separate PR for you to examine when its ready. |
What do you think of these simple codes? |
Hi @FFiot , Thank you for pointing this out! I have tested it, and on the STM32G474 the arm_sin_f32 function is around 40-50% slower than the lookup table version we have. But it is more accurate than the lookup table version. It is considerably faster than the CORDIC for a single operation, but also a bit less accurate than the CORDIC. It's certainly something people on ARM MCUs can consider using. |
For anyone interested here are my current timings on a STM32G474:
|
Awesome overview @runger1101001, I'd just like to add that when I wrote the |
Compare on stm32G431CBU6。 |
A change to enable alternative implementations of
_sin()
and_cos()
:Tested this so far on STM32G4, where it has no impact on performance (none is expected since these are linker level things), and seems to work as expected in terms of the array: if I supply a different implementation of _sin() that just calls stdlib, the program size is 500 bytes smaller.