InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Build firmware with optional apps

Open minacode opened this issue 3 years ago • 5 comments

This PR implements #1114 . It adds a config file apps.txt that contains a list of apps that should be included in the firmware. Their order is respected in the UI. It also adds tools/apps_prebuild.py.

All you need to do is to build the docker container, change apps.txt and then build the firmware. I hope, that this makes it possible to accept more apps, even if they are not included in the default build.

Other implementation strategies

In this version there is a dict in the python script that contains the paths to all relevant source files for each app. We could automate this, by moving each app to its own directory like src/displayapp/apps/alarm. Each of those directories may also contain a meta-data file (that contains the ui-symbol for example). The script can then just build all files within an apps directory when the app appears in apps.txt.

The same thing as for apps could be done for watch faces, but this is too much for this PR.

Support

I propose that we test and maintain a default sample of apps similar to the ones that are present right now as well as a build with all apps (just for testing) and fix all eventual bugs for custom builds when they are reported.

  • [ ] How do we accept new apps when they are not part of the default apps, but still need to be tested on the hardware at least once?

Todo

  • [x] save .h/.cpp paths and class names in generation script
  • [x] insert paths in CMakeLists.txt
  • [x] insert case in displayapp/DisplayApp.cpp
  • [x] insert value in displayapp/Apps.h
  • [x] runs well on hardware

minacode avatar Aug 23 '22 00:08 minacode

This isn't actually enough to remove the apps from the build, so the build size doesn't decrease and there isn't more space for other apps. This basically extracts the array from ApplicationList.h to a text file, so it's supposedly less intimidating to edit for non developers, but I don't think it's necessary and editing ApplicationList.h directly is hardly more difficult. We can add a document that instructs people how to hide apps, if that's really what they want.

Riksu9000 avatar Aug 23 '22 04:08 Riksu9000

My thought was, that something really user friendly like itd or siglo could build a UI on top of that file interface. Do you know what else must be modified to cut apps out?

I know that this PR introduces it own lot of mess to the code, but I wanted to explore this a little bit, because the result could be worth it.

minacode avatar Aug 23 '22 10:08 minacode

It is very hacky, but my last commit builds a smaller image sucessfully (after running the Python script, so the automatic builds here fail). I know that @JF002 is working on a more convenient solution, but maybe this PR is a good itermediate step. What are your thoughts on this approach?

minacode avatar Aug 24 '22 01:08 minacode

After the last update, I got this image size when disabling all apps:

[ 88%] Linking CXX executable pinetime-mcuboot-app-1.10.0.out
Memory region         Used Size  Region Size  %age Used
           FLASH:      342564 B       480 KB     69.69%
             RAM:       54224 B        64 KB     82.74%

minacode avatar Aug 26 '22 15:08 minacode

I got the last version to build with zero apps and run without a problem on my watch.

minacode avatar Aug 26 '22 18:08 minacode

I am closing this one in favor of #1408.

minacode avatar Nov 14 '22 22:11 minacode