-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
unix: Add build variants (analogous to boards on baremetal). #5253
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
Conversation
@@ -0,0 +1,20 @@ | |||
PROG ?= micropython |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the default make
will now be the dev build, with executable named micropython
... then the original base variant (got with make
currently) is gone? Maybe we need a STANDARD variant (lean but featureful) and a DEV variant (all features, including settrace?)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was specifically to make it match the current behavior -- the default target produces the micropython
binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but the default variant is now called "DEV", right? As below, maybe we need a BASE/STANDARD build and a DEV/FULL build.
Yeah, that needs some discussion. Maybe it should be called "STANDARD" or "BASE". And then also a full development version could be the "DEV" variant, like discussed in #4309 |
The name 'variant' sounds ok. Since 'DEV' leaves some room for interpretation, I'd rather go for more descriptive names which when looked at together should reveal more clearly what they might be, think Some general questions:
|
Yes, minimal/standard/full is conceptually pretty good. Standard will be the current thing you get when you run "make", and full can be a build with everything enabled.
I guess it's following stm32/esp32/esp8266/samd upper-case naming (nrf uses lower case). Maybe they can be lower case because they are "variants" rather than "boards"? Or better to just be consistent with everything using upper-case?
stm32 includes mpconfigboard.h first in mpconfigport.h, which allows a board to enable things like threading, networking or bluetooth, then giving mpconfigport.h a chance to enable settings based on these board-level settings. Eg threading requires a different Also, including it first matches how py/mpconfig.h includes mpconfigport.h first. To reduce the need for ifdefs in mpconfigport.h, it's possible to move more of the config in mpconfigport.h to mpconfigvariant.h, and in mpconfigport.h only put those things that are enabled always for all variants. Downside of this is that common things that are enabled for most variants will be duplicated in all those variants. So, probably the way it is is the "simplest", by some definition of simple :)
I assume you mean the subdirs for each variant in |
Yeah, DEV is the wrong name for what this currently is. STANDARD seems fine as the default variant (identical to the current default target, producing the But to facilitate this I will add a BASE variant, which probably isn't one you'd build directly, but includes shared config for several of the variants (STANDARD, DEV, COVERAGE, etc). Also BASE can be the one that adds the test target, so it's available for these variants.
Agreed.
The simple, but maybe not good, answer to all of the above is "because that's how the STM port does it" (and by extension, NRF, SAMD, ESP32 and ESP8266) (although NRF is an exception to the capitalised names). I'm keen to keep the configurations as similar as possible between ports, including things the order that the files get included in. The convention (as I understand it?) is that it's a deliberate choice to add the #ifndef to mpconfigport.h to "allow" a board to override something. However, I think maybe adding the BASE config could help here -- so the order would be mpconfigvariant.h, which could then include BASE/mpconfigvariant.h at any point it likes, followed by mpconfigport.h. |
Ok people, thanks for the extra explanation! |
42d62f5
to
83b6de2
Compare
Updated with feedback. STANDARD is now the default variant. I didn't do the refactoring via a "BASE" variant, that can come later. |
MICROPY_PY_BTREE = 0 | ||
|
||
MICROPY_PY_THREAD = 0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably don't need these empty lines between MICROPY_PY's, similar to bare-metal ports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (and in MINIMAL too)
py/mphal.h
Outdated
@@ -34,6 +34,9 @@ | |||
#include <mphalport.h> | |||
#endif | |||
|
|||
// For uintptr_t | |||
#include <stdint.h> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed, I have fixed it in a different way in #5227 (define mp_hal_stdio_poll
to nothing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, grabbed the same fix from that PR.
0aa9303
to
90bdbc1
Compare
This allows ports/variants to configure MICROPY_FORCE_32BIT after including mkenv.mk, but before py.mk.
This will eventually become the "full featured" unix binary with more features enabled, specifically useful for development and testing.
Merged, see #5519 |
Fix GPIOTE crashes by checking everything is ok
I don't have strong feelings on the name "variant", but "board" doesn't make sense. "target" is sort of the next best thing but also a bit overloaded.
Also, the "DEV" name for the default variant.. open to suggestions. Most people won't see this though? (Edit: updated to use "STANDARD", with "DEV" as the optional more-features build).
Some refactoring of mpconfigport.h might be worth doing now (especially common stuff between minimal and default).
Fixes #3043
(Edit: no longer enables help (ref #1354), will do that in a separate PR. I added settrace to the DEV variant as a different example).