Skip to content

apps: POC for bitfield-based compile-time apps#1672

Closed
FintasticMan wants to merge 2 commits intoInfiniTimeOrg:mainfrom
FintasticMan:compile_time_apps
Closed

apps: POC for bitfield-based compile-time apps#1672
FintasticMan wants to merge 2 commits intoInfiniTimeOrg:mainfrom
FintasticMan:compile_time_apps

Conversation

@FintasticMan
Copy link
Member

@FintasticMan FintasticMan commented Mar 5, 2023

Proof-of-concept for using the value of the Apps enumerations for a 64-bit bitfield for choosing what apps to include at compile-time. The reason for making this is because we want to minimise the number of places people need to add their new app to. By using the values of the Apps enumerations and a bitfield developers don't need to add their app to another place just for it to be togglable at compile-time. (Inspired by #1408 (comment)).

This also attempts to use the preprocessor as little as possible, and I've got it down to one ifdef for the declaration of disabledApps.

For some reason, this increases flash usage considerably, but it does fluctuate as expected by changing the disabledApps variable.

The implementation for the ApplicationList is really ugly (and clang-format can't format it properly), so if anyone has any suggestions on how to make that nicer, it would be much appreciated. It also doesn't move apps in the UI, so there are just gaps wherever apps have been disabled.

Another issue is that, to disable apps via the CMake command-line, users need to calculate bitwise operations for the apps they want to disable. This isn't very friendly, so if someone has any ideas, I'd love to hear them.

Fixes #1114

Uses the value of the Apps enumerations for a 64-bit bitfield.
Increases memory usage considerably for some reason.
ApplicationList is pretty ugly.
@FintasticMan FintasticMan changed the title apps: Initial implementation for compile-time apps apps: POC for bitfield-based compile-time apps Mar 5, 2023
@github-actions
Copy link

github-actions bot commented Mar 5, 2023

Build size and comparison to main:

Section Size Difference
text 407564B 864B
data 940B 0B
bss 53632B 64B

@FintasticMan
Copy link
Member Author

Now the ApplicationList is a little bit cleaner, but it still leave holes in the app list UI where the apps used to be.

@minacode
Copy link
Contributor

minacode commented Mar 8, 2023

Nice to see someone else play around with this concept, too! 😊

I will take a closer look at your idea with the bit array.

In #1408 I aimed to fix the holes in the application list by creating the array iteratively in a function and hoping for the compiler to optimize it 😄

@FintasticMan
Copy link
Member Author

This isn't the way we want to solve this issue.

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.

Build Firmware with Optional Apps

2 participants