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

Tidy AP_DAL memory allocation and freeing #27962

Merged
merged 3 commits into from
Sep 3, 2024

Conversation

peterbarker
Copy link
Contributor

Board                    AP_Periph  blimp  bootloader  copter  heli  iofirmware  plane  rover  sub
CubeOrange-periph-heavy  *                                                                     
Durandal                            -8     *           -16     -16               -16    -8     -8
Hitec-Airspeed           *                                                                     
KakuteH7-bdshot                     -16    *           -8      -8                -16    -16    -8
MatekF405                           -8     *           -16     -8                -16    -8     -8
Pixhawk1-1M-bdshot                  -8                 -8      -8                -8     -16    -8
f103-QiotekPeriph        *                                                                     
f303-Universal           *                                                                     
iomcu                                                                *                         
revo-mini                           -16    *           -16     -16               -16    -8     -16
skyviper-v2450                                         -8                                      

Be consistent in the way we use the enumeration (and which enumeration we use...)

Make sure we're symmetric for allocation/free calls by adding a free_type method to the DAL.

@tpwrules
Copy link
Contributor

tpwrules commented Sep 1, 2024

Why the redundant alloc/free and MemoryType? Is the point that the EKFs only use the DAL and not the HAL?

Might be able to save more code size by putting those in the .h so they can be inlined.

@peterbarker peterbarker force-pushed the pr/dal-memory-type-enum branch from e1b4333 to 2d9eb94 Compare September 3, 2024 02:49
@peterbarker
Copy link
Contributor Author

Why the redundant alloc/free and MemoryType? Is the point that the EKFs only use the DAL and not the HAL?

As discussed on the call, I think this was an attempt to aid in the "dal-standalone-build" testing. I don't think it's actually required now!

Might be able to save more code size by putting those in the .h so they can be inlined.

Also looked at this on the call - the header doesn't know about the HAL ATM.

I think my preference would be to remove the wrapping if we can - but that would require making sure the stand-alone build is definitely still doing its job, I think.

@peterbarker
Copy link
Contributor Author

This is now a zero-compiler-output change:

Board                    AP_Periph  blimp  bootloader  copter  heli  iofirmware  plane  rover  sub
CubeOrange-periph-heavy  *                                                                     
Durandal                            *      *           *       *                 *      *      *
Hitec-Airspeed           *                                                                     
KakuteH7-bdshot                     *      *           *       *                 *      *      *
MatekF405                           *      *           *       *                 *      *      *
Pixhawk1-1M-bdshot                  *                  *       *                 *      *      *
f103-QiotekPeriph        *                                                                     
f303-Universal           *                                                                     
iomcu                                                                *                         
revo-mini                           *      *           *       *                 *      *      *
skyviper-v2450                                         *                                       

That's because we merged the change which makes the dal in NavEKF3 a reference, so we're not longer making a method call to get the value of the enumeration.

The compiler must be optimising away the new wrapping function, so that's all happy.

@peterbarker peterbarker merged commit 6cfecaa into ArduPilot:master Sep 3, 2024
93 checks passed
@peterbarker peterbarker deleted the pr/dal-memory-type-enum branch September 4, 2024 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants