-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
py/mpconfig: Add make show-config to parse and view overall config. #8437
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
base: master
Are you sure you want to change the base?
Conversation
ecbf333
to
ec0b69e
Compare
I'm still in favor of using Kconfig (rather than reinventing the wheel, so to speak). It has already solved this problem and more. |
Yep I'm interested in moving toward a config management system too, and I agree the Linux kernel one seems like it would be good. I don't know though about how the kconfig infrastructure fits together to know how to deal with multiple levels of settings (to match to the hierarchical arrangement of port/boards) but I presume it's supported. Regardless of that, this PR is currently about visualising the output of a config system, rather than managing the inputs. I am hoping however that this could be a first step to help gather together all the settings that are in use, could be a parser to use once-off to help create the definitions for use with kconfig? |
Something like OpenWrt config? It manages many target boards and use the linux kernel config tool. |
Yes! I had thought of them as an example showing menuconfig (kconfig) it can be used to manage a similar arrangement of targets - I'm not sure how easy it's going to be to learn how all this fits toghether though, still assuming it's going to be a lot of work to bring such a system in here. Again though, that's definitely a larger future task I'm not quite willing to take on until I get some of my other in-progress stuff finished! |
Brilliant. 😄 |
I've been thinking more on what I really want this tool to be able to do, will add some more features.
As suggested earlier, some of this will require pre-processing all the C files similar to |
a9621f1
to
70e80d9
Compare
70e80d9
to
71dab52
Compare
71dab52
to
285793a
Compare
Add lilygo t-display s3 because it has a parallel display. Fixes micropython#8437
This PR provides a new
make show-config
target which will search for allMICROPY_*
defines used in current build and write them with their computed values for a file in the current build folder, eg.Which produces a
mpconfig.cfg
file likeThis is generated by:
*.c
files used for QSTR generationMICROPY_*
patterns in the C files#include <py/mpconfig.h>
By building on top of the proven QSTR make infrastructure all other standard mechanisms to specify build settings should work with this target, eg.
make show-config BOARD=microbit
to show the configuration used by that board definition etc.background
On a number of occasions I've wanted a way to easily view the overall configuration for a particular build, both to see what settings are available, and to see what settings are resolved down to.
In particular, I'm trying to rebuild #8317 to correctly start with a commit that includes the ROM level definition, but then override the individual settings to have an overall null-change initial commit. I wanted a tool like this which could be used to show before and after that no change to settings has been made.
By parsing all the C files that will go into a build, all settings that are actually used in the code should found and documented, ignoring any that are set in board definitions but not actually used.
The corner case here is if a setting is defined and used in header files only, not ever being referenced directly in a C file, it will be missed. I'm not sure how often this scenareo is likely to happen?
Perhaps all C files should be pre-processed with
-dD
to capture and keep all defines in the.i
output, then scan those outputs rather than the c files directly. If this flag is added to the existingpp
stage in$(HEADER_BUILD)/qstr.i.last
generation then this generated file could be re-used here, however I'm not sure if adding this flag would adversely affect the speed / compatibility of the existing qstr generation tasks.Doing all this however would mean you lose visibility of which settings are used in code however, it would include everything defined, regardless of whether they're actively used or not.