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

AP_ROMFS: tweak data storage to reduce size #26060

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

tpwrules
Copy link
Contributor

Some nice size reductions and code simplifications. Save roughly 300 bytes depending on board. See commit messages for details.

Tested on a CubeOrange. Made sure that it can flash its own bootloader using the button in Mission Planner and that it still boots afterward.

@khancyr
Copy link
Contributor

khancyr commented Jan 22, 2024

I think it could be a good idea, but the lost of the checksum is an issue IMHO. If we can validate the data at compile time and have the whole flash integrity check to also check the embeded data I think that would be fine . Otherwise, having a bunch of memory without integrity check will be an issue

@tpwrules
Copy link
Contributor Author

tpwrules commented Jan 22, 2024

This PR removes the uncompressed data CRC-32 from the GZIP footer, however, that was never checked by the existing code. There is still a CRC-32 of the uncompressed data stored in the embedded_file struct that's checked after decompression.

Therefore, this PR does not change the way checksums are used in any way. I'm not sure if there's any checksum on the compressed data, that should be covered by whatever flash integrity checks are already in Ardupilot.

Saves size not including unnecessary headers or code to parse them.
Ensure buffer is properly null terminated without changing the indicated
size even for uncompressed data.
@tpwrules
Copy link
Contributor Author

Fixed the null termination issue. There are things that depend on it so I haven't removed it yet, though I may in the future.

Rebased also and tested again on CubeOrange and looks good.

@tpwrules tpwrules requested a review from tridge January 25, 2024 00:16
@tridge
Copy link
Contributor

tridge commented Jan 25, 2024

looks good, thanks!

@tridge tridge merged commit 52468f0 into ArduPilot:master Jan 25, 2024
92 checks passed
@tpwrules tpwrules deleted the embed-raw-deflate branch January 25, 2024 14:32
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