Closed jmattsson closed 1 year ago
Overall I think the approach is a good one 👍 Do you have any suggestion for how to deal with having multiple EXTRA_COMPONENT_DIRS set? I have two separate external modules to include (each is a separate git repo) each with a separate Kconfig file, and as I've initially set them up based on the example, I have 2 separate "External modules" menu entries under "Component config". Which works, but is inelegant. I guess maybe don't put a menu "External modules"
in my Kconfigs and let those 2 modules' config options both be directly under "Component config"?
Hmm, that is a good point. I forgot that Kconfig doesn't merge menus with the same name. Right now I can't think of an elegant way around it (that isn't fighting against the IDF structure lots). What you suggest is probably the least ugly option.
Alright, @tomsci I've pushed an updated version here, heavily based on your suggestions. After thinking it through, I agree that trying to use the same mechanism for the NodeMCU modules
directory and external modules is not worth it (and possibly even a bad idea).
I've added two functions - extmod_register_conditional(MODNAME)
and extmod_register_unconditional(MODNAME)
. The former for when there is a Kconfig option for toggling the module on/off, and the latter for when there isn't. The mere action of listing the module dir in EXTRA_COMPONENT_DIRS
could be considered enough for some some people to want a module automatically enabled, so it seemed worth providing the option.
Merging in the absence of further feedback. Happy to refine later if needed.
Addresses comments in #3397
dev
branch rather than for therelease
branch.docs/*
.With the switch to IDFv4, the old
extmod
support became defunct, and we've lacked an ability to easily have external modules. This PR builds on modifications used at my $work, where we do have that need. The functional change is simply takingEXTRA_COMPONENT_DIRS
from the environment and injecting it into the IDF, letting it do it's thing (since extra component support is already baked into it). Additionally I've included a template here as a quick-start, and added some basic documentation to hopefully give people the information needed to get off the ground.I also fixed up some old esp866'isms that I found in the nodemcu-pil.md documentation.
@tomsci this is for you. @jpeletier you may want to have a look at this; it is not as neat as your
extmod
stuff, but on the other hand it leaves the heavy lifting to the IDF and is likely to stay supported longer.Feedback and improvements welcome.