Skip to content
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

ardupilotwaf: add -fno-math-errno to ChibiOS boards #29115

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

tpwrules
Copy link
Contributor

Allows better use of math instructions as opposed to calling library functions to implement math like sqrt. This saves flash and increases speed. ArduPilot does not use EDOM or ERANGE anyway.

Might cause issues with malloc errno:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88576 but ArduPilot does not check for ENOMEM or use errno much anyway.

Board                    AP_Periph  blimp  bootloader  copter  heli   iofirmware  plane  rover  sub
CubeOrange-periph-heavy  -400              *
Durandal                            -352   *           -1216   -1000              -1344  -744   -640
Hitec-Airspeed           *                 *
KakuteH7-bdshot                     368    *           0       208                216    352    400
MatekF405                           16     *           -120    -24                -112   96     0
Pixhawk1-1M-bdshot                  0                  32      -48                -48    32     -16
f103-QiotekPeriph        *                 *
f303-Universal           -160              *
iomcu                                                                 *
revo-mini                           8      *           -120    -32                -120   88     0
skyviper-v2450                                         -168

Seems this results in really bad inlining decisions on -Os targets. I have a followup but am curious if this is a desired flag.

Tested on CubeOrange using scripting aerobatics in SITL on HW.

Allows better use of math instructions as opposed to calling library
functions to implement math like `sqrt`. This saves flash and increases
speed. ArduPilot does not use EDOM or ERANGE anyway.

Might cause issues with malloc errno:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88576 but ArduPilot does
not check for ENOMEM or use errno much anyway.
@tridge tridge merged commit 46e081a into ArduPilot:master Jan 28, 2025
99 checks passed
@tpwrules tpwrules deleted the pr/no-math-errno branch January 28, 2025 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants