dtlib.py and guiconfig.py do some hackery to build token and image
variable names, which triggers spurious pylint warnings like
scripts/dts/dtlib.py:243:28: E0602: Undefined variable '_T_LABEL'
(undefined-variable)
Suppress the warning for those files. The generated names get used in
lots of places.
Also suppress some warnings in doc/conf.py ('tags' is from Sphinx), and
fix a legitimate issue in scripts/dts/testdtlib.py.
This pylint check is useful enough to want enabled in the upcoming CI
check.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
pylint might be afraid that there'd be less than three elements in
'args', but there never is. Fixes this warning:
scripts/kconfig/menuconfig.py:3184:8: W0632: Possible unbalanced
tuple unpacking with sequence: left side has 3 label(s), right side
has 0 value(s) (unbalanced-tuple-unpacking)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
There is a bug where non-normalized paths can introduce multiple entries
for the same file. E.g. '/1/2/../2.file' and '/1/2/3/../../2.file' would
both be listed, and end in a ninja error because multiple targets
generate the same file.
This commit fixes this issue by normalizing the paths.
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
Similar deal to commit cc14c40a2d ("kconfiglib: Unclutter symbol
strings, avoid redundant writes, misc.").
Hide the direct dependencies in the defaults, selects, and implies
sections. Do the same in menuconfig/guiconfig as well.
This uses a new Kconfiglib API, so update Kconfiglib to upstream
revision 164ef007a8. This also includes some minor optimizations and
cleanups.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
load_config() and write_config() now return a message to print. This
message also says whether the configuration was loaded (replace=True) or
merged (replace=False), and whether the new .config is different from
the old (for write_config()).
Print the returned messages and remove some old print()s.
Also switch to an improved warning control API (the old one is still
supported, but might as well).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update kconfiglib, menuconfig, and guiconfig to upstream revision
5c904f4549 to get various improvements and fixes in:
- Marc Herbert found an issue involving symlinks, absolute paths,
and rsource that could lead to files not being found. The root cause
was relpath() assuming that symlink/../bar is the same as bar/, which
isn't guaranteed.
Fix it by handling paths in a simpler, more textual way.
- Propagated dependencies from 'depends on' are now stripped from
properties when symbols are printed (e.g. in information dialogs and
generated documentation).
The printed representation now also uses shorthands.
Before:
config A
bool
prompt "foo" if C && D
default A if B && C && D
depends on C && D
After:
config A
bool "foo"
default A if B
depends on C && D
- Before writing a configuration file or header, Kconfiglib now
compares the previous contents of the file against the new contents,
and skips the write if there's no change. This avoids updating the
modification time, and can save work.
A message like "No change to '.config'" is shown when there's no
change.
- .config now has '# end of <menu>' comments to make it easier to see
where a menu ends. This was taken from a change to the C tools.
- load_config() and write_(min_)config() now return a message that can
be printed with print(kconf.load_config()). This allows messages to
be reused in e.g. the configuration interfaces (nice now that there's
also a "No change to..." string).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This is a graphical configuration interface written in Tkinter. Like
menuconfig.py, it supports showing all symbols (with invisible symbols
in red) and jumping directly to symbols. Symbol values can also be
changed directly from the jump-to dialog.
This interface should feel a lot smoother than menuconfig.py on Windows.
When single-menu mode is enabled, a single menu is shown at a time, like
in the terminal menuconfig. Only this mode distinguishes between symbols
defined with 'config' and symbols defined with 'menuconfig'.
Compatible with both Python 2 and Python 3. Has been tested on X11,
Windows, and macOS.
To avoid having to carry around a bunch of GIFs, the image data is
embedded in guiconfig.py. To use separate GIF files instead, change
_USE_EMBEDDED_IMAGES to False. The image files can be found in
https://github.com/ulfalizer/Kconfiglib/tree/screenshots/guiconfig.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update menuconfig (and Kconfiglib, just to sync) to upstream revision
7e0b9f7ae1, to get these commits in:
menuconfig: Improve space/enter behavior slightly
Space toggles value is possible, and enters menus otherwise. Enter
works the other way around.
Make this explicit in the code, which also fixes some corner cases,
like space doing nothing on a y-selected menuconfig symbol.
-------------------------------------------------------------------
menuconfig: Fix display issue for unsatisfied-deps selected symbol
with children
A symbol with unsatisfied direct dependencies can end up with visible
children in an implicit submenu if it is selected (though that
generates a warning), so the optimization in _shown_nodes() isn't
safe, and causes the child nodes to not be shown outside show-all
mode.
Just remove the optimization. Trying things out some more,
everything's plenty fast enough anyway.
Checking the direct dependencies of the parent instead would be safe.
The menu path now says "(Top)" instead of "(top menu)" too, which is a
bit more compact. Make the same change in genrest.py.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Splitting a string like 'foo="bar=baz"' on '=' will give ['foo', '"bar',
'baz"'] instead of the intended ['foo', '"bar=baz"']. split() with
maxsplit=1 to avoid potential issues.
Not seen in practice. Just some future safety.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib and menuconfig to upstream revision 90c5573c19, to get
these commits in:
Warn for unquoted argument to 'source', etc.
Print a warning suggesting to add quotes for things like
source foo/bar/Kconfig
menu title
prompt unquoted
Example warning:
Kconfig:32: warning: style: quotes recommended around
'lib/Kconfig.debug' in 'source lib/Kconfig.debug'
That quoteless syntax is supported for compatibility with old
versions of the C tools. It only works for a single word.
==================================================================
menuconfig: Include all parents in menu paths
Previously, symbols not defined with 'menuconfig' with children
weren't listed in the children's menu paths. It was deliberate, but
it's probably an anti-feature in retrospect, because it can make it
harder to find stuff by following the menu path.
Don't try to be clever and just list all the parent nodes in the
menu path.
==================================================================
menuconfig: Fix display issue for optional-prompt menuconfigs
_shown_nodes() needs to check whether invisible 'menuconfig' symbols
with optional prompts have visible children, so that they can be
shown outside show-all mode. Previously, only 'config' symbols were
checked.
==================================================================
menuconfig: Remember last saved/loaded path and improve
_conf_changed
Remember the last path that was manually saved/loaded instead of
reverting back to standard_config_filename() (e.g. .config).
Remember the path to the last saved minimal configuration separately
as well.
Also improve the _conf_changed behavior when loading a .config
within the interface. Instead of always treating it as needing to be
saved, check if it's outdated, like for the .config file loaded on
startup.
Also make the exit message ("No changes to save", etc.) always
include the target .config file, which is helpful. Previously, only
the save message did.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This is an old script for finding references to undefined Kconfig
symbols that assumes Kconfiglib 1 (an older API).
There's now a different check for references to undefined symbols (see
commit 1d0834b35f ("checks: kconfig: Check for references to undefined
Kconfig symbols") in the ci-tools repo).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fixes pylint warnings like this one:
doc/conf.py:325:0: W1401: Anomalous backslash in string: '\s'.
String constant might be missing an r prefix.
(anomalous-backslash-in-string)
The reason for this warning is that backslash escapes are interpreted in
non-raw (non-r-prefixed) strings. For example, '\a' and r'\a' are not
the same string (first one has a single ASCII bell character, second one
has two characters).
It just happens that there's no \s (or \., or \/) escape for example,
and '\s' turns into two characters (as needed for a regex). It's risky
to rely on stuff like that regexes though. Best to make them raw strings
unless they're super trivial.
Also note that '\s' and '\\s' turn into the same string.
Another tip: A literal ' can be put into a string with "blah'blah"
instead of 'blah\'blah'.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Discovered with pylint3.
Use the placeholder name '_' for unproblematic unused variables. It's
what I'm used to, and pylint knows not to flag it.
Python tip:
for i in range(n):
some_list.append(0)
can be replaced with
some_list += n*[0]
Similarly, 3*'\t' gives '\t\t\t'.
(Relevant here because pylint flagged the loop index as unused.)
To do integer division in Python 3, use // instead of /.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Not needed in Python. Detected by check C0325 in pylint3.
Also replace an
if len(tag):
with just
if tag:
Empty strings, byte strings, lists, etc., are falsy in Python.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Users often get confused when they change Kconfig sources and then
rebuild only to discover that nothing happens. To fix this we add a
dependency between re-running cmake, and all Kconfig sources, similair
to how touching CMakeLists.txt files cause CMake to re-run.
This fixes#5634
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Sigvart pointed out that the error message for missing Kconfig files
(which rambles on a lot about $srctree) can easily kick people off in
the wrong direction.
Update Kconfiglib to upstream revision 9f26eb3ae3 to add the following
commit, which makes the error message point to stuff that's more likely
to be the problem:
Give more helpful error messages when files are missing
The current error message talks a lot about $srctree, but $srctree
is seldom the culprit in practice. More common is 'source
"$(SOME_ENV_VAR)/foo"`, where SOME_ENV_VAR hasn't been set.
Include the complete 'source ...' line for missing Kconfig files,
and mention unset environment variables as a hint. Only mention
$srctree briefly.
Also shorten the message when a .config can't be a found a bit. This
message would usually only be seen when working directly with the
library.
Example error:
Kconfig:7: '/Kconfig' not found (in 'source
"$(SOME_ENV_VAR)/Kconfig"'). Check that environment variables are
set correctly (e.g. $srctree, which is unset or blank). Also note
that unset environment variables expand to the empty string.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Do not load the GENERATED_DTS_BOARD_CONF if in doc mode, since it will
not defined as it doesn't apply. No need to defined it to a dummy value.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Update Kconfiglib (and menuconfig, just to sync) to upstream revision
99a7af769352b, to add the commit below, for a doc issue reported by
Sebastian Bøe:
Document that kconfig_filenames keeps absolute paths as-is
Came up in https://github.com/ulfalizer/Kconfiglib/issues/67.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Make kconfigfunctions.py agnostic to where GENERATED_DTS_BOARD_CONF is
located.
We don't want to encode the path of GENERATED_DTS_BOARD_CONF into more
places than necessary. Also, re-using GENERATED_DTS_BOARD_CONF makes
it easier to change where generated_dts_board.conf is located.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
kconfigfunctions.py will silently set all values to '0' when the
environment variable 'PROJECT_BINARY_DIR' is not set.
But PROJECT_BINARY_DIR not being set indicates an internal error, so
we should instead error out with an appropriate error message.
Silently failing is dangerous and increases debug time. It is better
to fail fast.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Documentation for kconfigfunctions, mentions they look up elements
in "the DTS generated "conf" style database". This indication
could be cryptic for new zephyr users. Adding the exact name and
path of the file for disambiguation.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Clarify the docs for dt_str_val that if the name isn't found we return
and empty string. Also cleanup the code slightly as we don't need to
escape the double quote.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Export a new KCONFIG_DOC_MODE environment variable when building the doc
and invoking Kconfig, so that the functions that expect a build folder
can accordingly return a hardcoded value.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
As a step to completing removing use of Kconfig defines in dts files we
need to change how we configure/set CONFIG_FLASH_LOAD_{OFFSET,SIZE}.
Previously we would set them based on how the chosen property
'zephyr,code-partition' was set to. If 'zephyr,code-partition' wasn't
set we would default the values to 0. We had some generic overlay logic
which would define 'zephyr,code-partition' based on
CONFIG_BOOTLOADER_MCUBOOT.
Going forward if the DTS has 'zephyr,code-partition' set we will
generate DT_CODE_PARTITION_OFFSET & DT_CODE_PARTITION_SIZE defines. We
will leave it to Kconfig to set CONFIG_FLASH_LOAD_OFFSET &
CONFIG_FLASH_LOAD_SIZE.
We introduce a python script that allows Kconfig to extract data from
the DTS and thus we can utilize DT_CODE_PARTITION_OFFSET and
DT_CODE_PARTITION_SIZE values to set defaults for
CONFIG_FLASH_LOAD_OFFSET & CONFIG_FLASH_LOAD_SIZE.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Update menuconfig and Kconfiglib to upstream revision 16539b4f223fa, to
add the commit below.
menuconfig: Prompt for save if a different .config would be saved
Previously, menuconfig.py only prompted for saving the configuration
if .config didn't exist or the user changed symbol values within the
interface.
Also make it prompt for save if Kconfig symbols have been added,
removed, or have had their defaults changed, provided it would make
the saved .config differ from the loaded one.
This usually won't matter for correctness, because loading an
outdated configuration performs an implicit olddefconfig, but it's
less confusing.
Also add a Kconfig.missing_syms attribute that records all
assignments to undefined symbols in the most recently loaded .config
file. This is needed to implement the check for whether the saved
.config would be different.
As an unrelated change, always prompt for saving if a .config has
been loaded from within the menuconfig interface. The intention is
probably often to save the configuration somewhere else, even if it
isn't modified.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update menuconfig (and Kconfiglib, just to sync) to upstream revision
e629c33d31e22, to add the commit below.
menuconfig: Add show-help mode
Pressing F toggles show-help mode, where the help window at the bottom
displays the help text of the currently selected item, if any. Can be
handy when browsing through symbols.
Also mention the different modes that are available in the module
docstring.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib (and menuconfig, just to sync) to upstream revision
094f4a9622046, to add the commit below.
Save existing configuration to .<filename>.old in write_config()
Add a default-True 'save_old' flag to write_config(). If 'save_old' is
True and an existing configuration file is being overwritten, a copy
of the old configuration file is saved to .<filename>.old (e.g.
.config.old) in the same directory.
Errors are ignored, as the old configuration would usually just be a
nice-to-have, and not essential.
The same functionality could be added for minimal configuration files
and headers, but it's probably most useful for configuration files.
Other changes:
- Parsing performance is improved a bit
- scripts/kconfig/kconfig.py now prints the path to the merged
configuration in zephyr/.config, to make it a bit easier to
discover.
Fixes: #2907
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update menuconfig to upstream revision 38dff36b0f97b, to improve the
behavior for a case reported by Øyvind Rønningstad.
Upstream commit message:
menuconfig: Only list duplicated choice symbols once
When a Kconfig file defined a named choice and was included multiple
times, the choice symbols were listed multiple times in the
menuconfig as well (due to commit 17d7c1e ("menuconfig: Show all
symbols at each menu location for multi.def. choices")).
That's probably not what you want. Tweak it so that each symbol is
only shown once, with the prompt that was used for it at whatever
choice definition location is entered.
Also change how the choice selection is displayed before the choice
is entered, so that the prompt used for the selected symbol at that
particular location is used. Previously, the prompt at the first
definition location for the symbol was always used.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib and menuconfig to upstream revision e47d7eff1012e, to
add some small fixes/improvements/changes:
- Raise errors for extra trailing tokens anywhere. They were silently
ignored in some places:
* end{if,menu,choice} <extra tokens>
* {default,select,...} FOO <extra tokens> (though e.g.
'default FOO if' raised an error)
- Rephrase the warning when selecting a choice symbol to make it
clearer that select never has any effect on choice symbols.
- Display empty menus with '----' instead of '---> (empty)'. This
matches the C tools. It might be less confusing for symbols defined
with 'menuconfig', which is where you most often get empty menus
(when the symbol is n).
- Speed up parsing performance
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib and menuconfig to upstream revision d3866958c7685, to
add various improvements:
- Support HOME and END in the jump-to dialog in the menuconfig. END can
be handy as choices, menus, and comments appear at the end.
- Add more fine-grained warning controls for multiple assignments to a
symbol in configuration files. Use it to simplify kconfig.py a bit.
Clean up kconfig.py a bit in other ways too, e.g. by removing unused
imports.
- Improve Kconfig parsing performance slightly
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update menuconfig and Kconfiglib to upstream revision 68426efeae6aa, to
add two minor menuconfig improvements and a small bugfix:
- Expected errors, like syntax errors in Kconfig files, no longer
generate a Python backtrace. Just the error message is shown.
- Entering a choice now places the cursor on the selected symbol, if
any.
- Having two consecutive empty 'if's (which could also appear e.g. due
to osource) crashed the menuconfig when entering show-all mode, due
to the 'if' removal logic in Kconfiglib failing to remove one of
them. All configurations of 'if's are now correctly removed.
This error was found while reading the code.
Some minor optimizations and some internal cleanup is included as well.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update menuconfig (and Kconfiglib, just to sync) to upstream revision
bf1701b36634b, to add this commit:
menuconfig: Add jump-to for choices, menus, and comments
For choices, search the name and the prompt. This is the same as for
symbols, except names are optional (and rare) for choices.
For menus and comments, search the prompt (title text).
When jumping to a non-empty choice or menu, jump into it instead of
jumping to its menu node. If show-all mode is off and there are
visible items in the choice/menu, then jump to the first visible
node. Otherwise, enable show-all and jump to the first node.
Previously, only symbols could be jumped to.
Various other small fixes/improvements are included too:
- The "no range constraints" text was dropped from the input dialog
when settings int/hex symbols without an active 'range'. It might be
more confusing than helpful.
- A crash when pressing Ctrl-F (the view-help shortcut) with no matches
in the jump-to dialog was fixed
- Some gnome-terminal shoddiness was worked around to remove minor
jumpiness when reducing the height of the terminal
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update menuconfig (and Kconfiglib, just to sync) to upstream revision
256e5b3e38e92 to get the fix below in, for an issue in an external
project. Also update genrest.py with a similar fix (the genrest issue
was what originally prompted it).
menuconfig: Improve/fix promptless choice handling
The code assumed that all parent (interface) menus always have a
prompt, which is false for items in promptless choices. This led to
a crash e.g. when viewing the symbol information for a symbol within
a promptless choice.
Promptless choices with children can show up "legitimately" when
people define choices in multiple locations to add symbols, though
this is broken in the C tools.
Use standard_sc_expr_str(node.item) instead of the non-existing
prompt for promptless choices. That way they show up as
'<choice (name if any>)>', which is consistent with how they're
shown elsewhere.
This commit also changes how choice names are displayed in
show-name/show-all mode, to the standard_sc_expr_str() format.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib (and menuconfig, just to sync) to upstream revision
8087311cd91be to get the following fix in, for an issue reported by
pfalcon:
Give clearer errors for bad endchoice/endif/endmenu nesting
An endchoice/endif/endmenu with no corresponding choice/if/menu
generated a cryptic 'unrecognized construct' parse error. Improve
the error message so that the problem is pointed out explicitly:
kconfiglib.KconfigError: Kconfig:37: couldn't parse 'endmenu': no
corresponding 'menu'
Reported in https://github.com/ulfalizer/Kconfiglib/issues/56.
This update also adds support for user-defined preprocessor functions in
Python, which could potentially be handy for DTS/Kconfig integration.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update menuconfig.py to upstream revision 35a60b786c646.
This fixes some minor graphical glitching, with parts of lines that
don't fit the terminal wrapping around to the next line, and some
headings disappearing.
This version also adds supports for custom style definitions,
contributed by Mitja Horvat (punkfluid). Colors can be specified both by
number and in #RRGGBB notation. Color accuracy varies depending on
terminal capabilities, but will usually be good.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib to upstream revision 2be02fac78527 to add support for
expanding macros within symbol names, extending the existing Kconfig
preprocessor
(https://github.com/torvalds/linux/blob/master/Documentation/kbuild/
kconfig-macro-language.txt). Some minor optimizations are included as
well.
This makes it possible to add Kconfig templates to avoid code
repetition, e.g. like below:
Kconfig.log_template:
choice
prompt "Max compiled-in log level for $(module-str)"
config $(module)_LOG_LEVEL_OFF
bool "Off"
config $(module)_LOG_LEVEL_ERR
bool "Error"
config $(module)_LOG_LEVEL_WRN
bool "Warning"
config $(module)_LOG_LEVEL_INF
bool "Info"
config $(module)_LOG_LEVEL_DBG
bool "Debug"
endchoice
config $(module)_LOG_LEVEL
int
default 0 if $(module)_LOG_LEVEL_OFF
default 1 if $(module)_LOG_LEVEL_ERR
default 2 if $(module)_LOG_LEVEL_WRN
default 3 if $(module)_LOG_LEVEL_INF
default 4 if $(module)_LOG_LEVEL_DBG
Using the template:
module = FOO
module-str = foo
source "Kconfig.log_template"
...
module = BAR
module-str = bar
source "Kconfig.log_template"
This feature might create harder-to-read Kconfig files if abused, so it
should probably be used sparingly.
Fixes: #9761
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Since the warnings generated by this script are so spammy, it can be
difficult to tell where they start and end. Put a blank line before each
one to make it clearer.
Also put blank lines around the non-whitelisted-warning error.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- Use Kconfig.unique_{defined_syms,choices} to avoid redundant checks
for symbols/choices defined in multiple locations. These were
recently added to Kconfiglib.
- Remove the comment about the alldefconfig starting state. It probably
isn't useful here.
- Print the messages about loading configuration files just before they
are actually loaded. That looks less confusing if one of them fails
to load.
- Line-wrap the error message about non-whitelisted warnings.
- Misc. other minor code cleanup.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update menuconfig (and Kconfiglib, just to sync) to upstream revision
78682a8e3c4fe to get the following fix in, which could cause certain
visible symbols to not show up in the menuconfig interface:
menuconfig: Always show implicit submenus with visible nodes
Currently, the symbol BAR below (which ends up indented in an
implicit submenu) is shown only if DEP is non-n (or if show-all mode
is enabled):
config FOO
bool "foo" if DEP
default y
config BAR
bool "bar" if FOO
This is bad, because it hides visible symbols from the interface.
The assumption was that an implicit submenu (which is only created
if the parent has a prompt) would never have visible items when the
parent item is invisible, but prompt-specific conditions and
select/imply can break that assumption.
Fix it by always showing implicit submenus with visible nodes, along
with the parent node. If the parent node is invisible, show it in
red, like in show-all mode (which happens automatically). That's
probably better than having mysteriously indented nodes when the
parent is invisible.
(Some other tweaks were made later to avoid showing red outside show-all
mode, because it might look confusing/broken.)
A new color scheme for the menuconfig has been added as well,
contributed by Mitja Horvat (pinkfluid). It can be enabled by setting
the environment variable MENUCONFIG_THEME to 'aquatic'.
The default theme has been tweaked to use bold text for the selected
item too.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib and menuconfig to upstream revision a28bc4da9762e,
which adds include path information to menuconfig, showing how the
Kconfig file of the symbol got 'source'd in addition to showing the
definition location.
Add include path information to the auto-generated Kconfig documentation
too.
Some small Kconfiglib bugs are fixed to, like error reporting for
recursive 'source's being broken (crashing instead of printing the
error), a minor file descriptor leak, and syntax checking not catching
extra trailing tokens after 'if <expr>' and 'depends on <expr>'.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Commit f6bf897780 ("kconfiglib: Add preprocessor and two warnings")
accidentally made the ordering of #define's in generated header files
random (dependent on Python's set() implementation). Minimal
configuration files (which can be saved from the menuconfig) were
affected too.
The intent is for the order to match .config files, which in turn match
symbol definition order. This doesn't affect behavior in any way, but
makes things more readable (and is handier if files are checked in).
Update Kconfiglib to upstream revision a3252f620fad9 to make the
ordering match again. Tests have been added upstream.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Due a design goof, the top-level Kconfig file passed to
Kconfig.__init__() wasn't looked up relative to $srctree. This broke a
planned fix for an issue with the CI check for references to undefined
Kconfig files in external projects.
Update Kconfiglib to upstream revision 953cc12464 to fix it.
Also update doc/CMakeLists.txt to pass 'Kconfig' instead of '../Kconfig'
to genrest.py. $srctree is already set to $ZEPHYR_BASE.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib and menuconfig to upstream revision 6aea8d06b637e.
Kconfiglib changes:
- Kconfig files are now looked up just relative to $srctree (if set).
Previously, each source'd Kconfig file was also looked up in the
current directory, and Kconfig files there could override Kconfig
files in $srctree. This is what the C tools do.
I'm pretty sure that behavior was a bug in the C tools all along, and
only meant for .config files. It caused problems (and an ugly
workaround) for the undefined Kconfig symbol CI check in an external
project.
The new behavior also saves a bunch of open()'s, though it's probably
not noticeable.
- Setting the KCONFIG_STRICT environment variable to 'y' now makes
Kconfiglib itself warn for references to undefined symbols. This
isn't safe in general, as some projects use multiple Kconfig trees
with shared Kconfig files (e.g. the Linux kernel).
This will be used to simplify the undefined Kconfig symbol CI check.
- It's now possible to customize how symbols and choices are printed
within expressions.
This will be used to make the RST link generation in genrest.py less
hacky.
- Instead of having 'gsource', a plain 'source' is now globbing, and
requires at least one match. There's also 'osource', for when it's
okay for a glob pattern to match no files.
'gsource' had the design flaw that there was no way to require at
least one file to match. I plan on replacing all 'gsource' statements
with plain 'source's later, but 'gsource' is still supported for
backwards compatibility.
- def_int, def_hex, and def_string are now available as a Kconfig
extensions, analogous to def_bool (set type and add default).
- Misc. internal cleanup.
menuconfig changes:
- Boolean value hints are no longer shown to the right of defaults in
the symbol information for int/hex symbols. Stuff like
'- 74 (value: "n")' wasn't helpful, and looked confusing.
- Symbol information has been made more compact in general, e.g. by
skipping value hints where they aren't helpful
('FOO(=y)' instead of 'FOO(=y) (=y)'), and by shortening stuff like
'(value: "y")' to just '(=y)'.
- Misc. internal cleanup.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.
There are at least three problems with the patch:
1. It's inconsistent with how Kconfig works in other projects, which
might confuse newcomers.
2. Due to oversights, earlier 'range' properties are still preferred,
as well as earlier 'default' properties on choices.
In addition to being inconsistent, this makes it impossible to
override 'range' properties and choice 'default' properties if the
base definition of the symbol/choice already has 'range'/'default'
properties.
I've seen errors caused by the inconsistency, and I suspect there
are more.
3. A fork of Kconfiglib that adds the patch needs to be maintained.
Get rid of the patch and go back to standard Kconfig behavior, as
follows:
1. Include the Kconfig.defconfig files first instead of last in
Kconfig.zephyr.
2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
last in arch/Kconfig.
3. Include arch/<arch>/soc/*/Kconfig first instead of last in
arch/<arch>/Kconfig.
4. Swap a few other 'source's to preserve behavior for some scattered
symbols with multiple definitions.
Swap 'source's in some no-op cases too, where it might match the
intent.
5. Reverse the defaults on symbol definitions that have more than one
default.
Skip defaults that are mutually exclusive, e.g. where each default
has an 'if <some board>' condition. They are already safe.
6. Remove the prefer-later-defaults patch from Kconfiglib.
Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions
As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).
This commit includes some default-related cleanups as well:
- Simplify some symbol definitions, e.g. where a default has 'if FOO'
when the symbol already has 'depends on FOO'.
- Remove some redundant 'default ""' for string symbols. This is the
implicit default.
Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).
Piggyback some fixes for style nits too, e.g. unindented help texts.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Commit b3d165f ("scripts: kconfig: Handle warnings generated
during evaluation") made it common for kconfig.py to fail after writing
zephyr/.config. This confuses the configuration fragment checksum logic
in cmake/kconfig.cmake, because it expects the saved checksum file to
exist if zephyr/.config exists.
The end result is a CMake error when rerunning the configuration after
non-whitelisted Kconfig warnings.
Fix it by only writing zephyr/.config (and zephyr/include/autoconf.h) in
kconfig.py if there are no warnings-turned-errors.
Also check if the saved checksum file exists in kconfig.cmake before
trying to open it. Normally this shouldn't happen though.
Move the writing of the checksum file to before writing zephyr/.config
as well. That way, zephyr/.config only gets written if the other
operations succeed.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>