Add a cleaned-up version of a script I used to find a bunch of unused
symbols and some other Kconfig issues. It's set up to be run directly,
with few environment dependencies.
West is required, because the checks need to see Kconfig files and
source code from all modules.
Checks so far:
- Symbols that can never be anything but n/empty
- Symbols that look unused
- menuconfig symbols with empty menus
- Symbols only defined in Kconfig.defconfig files
See the help strings for the command-line flags for more information.
Some of these checks could probably be checked in CI later, though the
always-n and unused-symbol checks are a bit heuristic and might need a
lot of whitelisting.
Another reason I want to get this in is to have a clean standalone
reference for how to set up the environment for parsing the Kconfig
files. It's gotten trickier over time.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add function that will return 'y' or 'n' if a node pointed to by a
chosen property exists and is enabled.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Replace:
dt_chosen_reg_addr
dt_chosen_reg_size
dt_node_reg_addr
dt_node_reg_size
with:
dt_chosen_reg_addr_int
dt_chosen_reg_size_int
dt_chosen_reg_addr_hex
dt_chosen_reg_size_hex
dt_node_reg_addr_int
dt_node_reg_size_int
dt_node_reg_addr_hex
dt_node_reg_size_hex
So that we get the proper formatted string for the type of symbol.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Fix a bug where DTS_BINDINGS_DIRS could only have one entry. When
there were more than one entry the command for invoking menuconfig
became corrupted.
This changes the separator of DTS_BINDINGS_DIR from a space to ? so
that the shell does not interpret the space as an argument separator.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Prompted by an upstream bug report. Nothing in Zephyr triggers this at
the moment, but might as well fix it.
Update Kconfiglib to upstream revision 7d05084b7e, to get this commit
in:
Fix handling of parentheses in macro argument values
As an oversight, there was no check for nested parentheses in macro
arguments, making the preprocessor think the call ended after
'void)' in
def_bool $(success,echo 'void foo(void) { asm inline (""); }' \
| $(CC) -x c - -c -o /dev/null)
This broke the latest linux-next kernels (with a Kconfig error),
starting with commit eb111869301e1 ("compiler-types.h: add
asm_inline definition").
I remember seeing this when going through the C code, but somehow
forgot to put it in. Fix it, and clean up _expand_macro() a bit at
the same time.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
edtlib.Device is just a devicetree node augmented with binding
information and some interpretation of properties. Rename it to
edtlib.Node to make that clearer. That also avoids calling things like
flash partition nodes "devices", which is a bit confusing.
I called it edtlib.Device instead of edtlib.Node originally to avoid
confusion with dtlib.Node, but in retrospect it probably makes it more
confusing on the whole. Something like edtlib.ENode might work too, but
it's probably overkill. Clients of edtlib.py only interact with
edtlib.Node, so the only potential for confusion is within edtlib.py
itself, and it doesn't get too bad there either.
Piggyback some documentation nits, and consistently write it
"devicetree" instead of "device tree", to match the spec.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Some confluence of recent changes resulted in builds with
application-specific bindings being unable to find bindings present in
the system directory. Add quotes and splits as necessary to propagate
multiple directories through the system.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
As we work on removing the .conf file that is generated by the dt
scripts, mark dt_{int,hex,str}_val functions as deprecated.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Update Kconfiglib (and menuconfig/guiconfig, just to sync) to upstream
revision f2ce282eca, to get this commit in:
Allow preprocessor user functions to access the parsing location
Just requires making Kconfig.filename/linenr public.
'lineno' would be a more standard name, but be consistent with
MenuNode.linenr.
This can be used to give friendly errors in
scripts/kconfig/kconfigfunctions.py, e.g. for
https://github.com/zephyrproject-rtos/zephyr/pull/18752.
Some minor optimizations are included too.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
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>
Warnings generated during symbol evaluation were accidentally ignored,
due to checking for warnings before writing .config and autoconf.h
(which indirectly evaluates all symbols).
Move the warning checking code to after writing the configuration to
catch such warnings. kconfig.py still gets rerun if any
warnings-turned-errors show up.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
$srctree was changed to an absolute path when the documentation building
was switched over to CMake, which uncovered a bug in Kconfiglib that
caused symbols in gsource'd files to show up with absolute paths in the
auto-generated Kconfig documentation.
This commit adds upstream commit ac692af07a123 ("Fix absolute $srctree
prefixes showing up on gsource'd files"), which fixes it.
Upstream commit message:
When using gsource with $srctree set to an absolute path, the $srctree
prefix would show up in MenuNode.filename, trickling its way into e.g.
generated documentation.
This was due to a broken test: os.path.isabs() was checked after
joining the pattern with $srctree, making it mistake an absolute
$srctree for an absolute path in the Kconfig file.
Fix the test.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib to upstream revision 547fced630611 to get a new
Kconfig preprocessor in, documented in
https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kconfig-macro-language.txt.
The preprocessor allows shell functions to be run directly from Kconfig.
Things like 'default "prefix-$(shell,some-cmd)' and
'depends on (success,some-cmd)' are supported.
The preprocessor might come in handy for Kconfig/DTS integration. I'm
thinking of extending it so that Python functions can be called as well.
There's also two new warnings:
- Trying to use an int/hex symbol like a bool symbol in an expression
(where it will always evaluate to n)
- Having a 'default' on an int/hex symbol that lies outside an active
'range'.
The parser is more strict now as well (due to dropping some hacks for 3+
year old kernel versions).
A related fix for scripts/kconfig.py is also included:
The comment above the whitelist lies. I accidentally changed the warning
text for the select-with-unsatisfied-dependencies warning while
generalizing it (for m-valued dependencies, which you'd never get in
Zephyr).
Update the whitelist to detect the new warning text.
Last-minute piggyback:
Include a change that improved the parse time for U-Boot from 4 seconds
to about 0.6 seconds, related to symbols defined in multiple locations.
It might be helpful for Zephyr as well, as it also uses a lot of symbols
defined in multiple locations.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Andy Ross wanted to override a choice selection from a board defconfig
file in a prj.conf, but this could trigger the
assigned-value-didn't-take warning, because the choice symbol set to y
in the board defconfig file ends up as n after another choice symbol is
selected.
(Note: Setting any choice symbol to y is enough to make it the choice
(user) selection. There's no need to set the other symbols to n.)
Fix the warning by checking choices at the choice level rather than at
the level of individual choice symbols. This also makes the warning a
bit more informative in general for choice symbols.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The warnings were fixed by commit c4123643b5 ("tests: fp_sharing:
Extract x86 configs to separate .conf").
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib to get upstream commit eb6c21a9b33a2 ("Turn
MenuNode/Symbol/Choice.referenced() into a @property") in. It converts
the MenuNode.referenced() function into a property, which makes the API
more consistent (read-only stuff uses properties).
Also update scripts/ci/list_undef_kconfig_refs.py to access .referenced
as a property.
Piggyback a small is_num() simplification.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib to get upstream commit ca89ca0c0c420 ("Add dependency
loop detection") in.
Upstream commit message
=======================
Pretty long overdue.
Until now, dependency loops have raised a hard-to-debug Python
RecursionError during evaluation. A Kconfiglib exception is raised now
instead, with a message that lists all the items in the loop.
See the comment at the start of _check_dep_loop_sym() for an overview of
the algorithm. At a high level, it's loop detection in a directed graph
by keeping track of unvisited/visited nodes during depth-first search.
(A third "visited, known to not be in a dependency loop" state is used
as well.)
Choices complicate things, as they're inherently loopy: The choice
depends on the choice symbols and vice versa, and the choice symbols in
a sense all depend on each other.
Add the choice-to-choice-symbol dependencies separately after dependency
loop detection, so that there's just the choice-symbol-to-choice
dependencies to deal with. It simplifies things, as it makes it possible
to tell dependencies from 'prompt' and 'default' conditions on the
choice from choice symbol dependencies.
Do some flag shenanigans to prevent the choice from being "re-entered"
while looping through the choice symbols. Maybe this could be cleaned up
a bit somehow...
Example exception message:
Dependency loop
===============
A (defined at tests/Kdeploop10:1), with definition...
config A
bool
depends on B
...depends on B (defined at tests/Kdeploop10:5), with definition...
config B
bool
depends on C = 7
...depends on C (defined at tests/Kdeploop10:9), with definition...
config C
int
range D 8
...depends on D (defined at tests/Kdeploop10:13), with definition...
config D
int
default 3 if E
default 8
...depends on E (defined at tests/Kdeploop10:18), with definition...
config E
bool
(select-related dependencies: F && G)
...depends on G (defined at tests/Kdeploop10:25), with definition...
config G
bool
depends on H
...depends on the choice symbol H (defined at tests/Kdeploop10:32), with
definition...
config H
bool
prompt "H" if I && <choice>
depends on I && <choice>
...depends on the choice symbol I (defined at tests/Kdeploop10:41), with
definition...
config I
bool
prompt "I" if <choice>
depends on <choice>
...depends on <choice> (defined at tests/Kdeploop10:38), with
definition...
choice
bool
prompt "choice" if J
...depends on J (defined at tests/Kdeploop10:46), with definition...
config J
bool
depends on A
...depends again on A (defined at tests/Kdeploop10:1)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Having to go back to the main display all the time gets awkward,
especially when searching to look up symbol information.
Allow the symbol information dialog to be opened from the search dialog
(with Ctrl-F, since '?' is already used there as a regex metacharacter),
and also allow a search to be started from the symbol information
dialog.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit gets upstream commit dc0b022247b85 ("Correctly report choice
locations in some warnings") in, which fixes some warnings that would
previously report the location of a choice as being "undefined" (which
is impossible).
Upstream commit message:
Menu nodes were added to choices after parsing their properties,
making some warnings generated during parsing (as opposed to in
_check_choice_sanity()) incorrectly give the choice as '<choice>
(undefined)'.
Add the node before parsing choice properties to fix those warnings.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- Tailor the warning when the symbol has no prompt, explaining how
promptless symbols get values. Add some anti-select propaganda too.
- Reference the 'Setting configuration values' in the Board Porting
Guide. It explains Kconfig.defconfig files.
Fixes: #8388
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit fixes a pretty nasty bug that could cause properties on
symbols and choices defined in multiple locations to end up in the wrong
order, potentially affecting evaluation.
Alexander Wachter ran into this for an out-of-tree build.
Multi.def. symbols are rare in the Linux kernel, which is what the
Kconfiglib test suite uses for compatibility testing, so this managed to
slip through. Comprehensive selftests have been added for property
ordering on nested multi.def. symbols/choices.
This bug was introduced by commit e307ba340c ("kconfiglib: Record
which MenuNode has each property").
Commit message from Kconfiglib (c8801514d63aa)
==============================================
Fix incorrectly ordered properties for some nested multi.def. symbols
_propagate_deps() visits menu nodes roughly breadth-first, meaning
properties on symbols and choices defined in multiple locations could
end up in the wrong order when copied from the menu node for some
unlucky if/menu nestings.
Fix it by moving the menu-node-to-symbol/choice property copying in
_finalize_tree() so that it's guaranteed to happen in definition order.
This bug was introduced by commit 63a4418 ("Record which MenuNode has
each property").
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Some prj.conf files seem to deliberately override settings from the
board configuration (e.g. samples/bluetooth/hci_usb/prj.conf, with
GPIO=y). Disable the warning about a symbol being assigned more than
once to avoid warnings for those cases.
A list similar to WARNING_WHITELIST could be added later if more
warnings need to be disabled.
Also refactor the warning checking code a bit to get rid of some not's.
Suggested by Sebastian Bøe.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit fixes an issue when user searches for a nonexistent object
(e.g. adsdsaasda) and presses enter.
Having all the key checks in one continuous if statement makes sure that
the very last 'else' statement does not get executed when enter is
pressed.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
In particular, this will turn assignments to undefined Kconfig variables
into errors, which are very easy to miss otherwise (e.g. when Kconfig
symbols get renamed or removed).
Warnings generated by anything tested by CI (scripts/sanitycheck) will
be caught.
Have a whitelist of warnings that are not turned into errors. Some
warnings currently whitelisted should be turned into errors as well, but
would require a bit of work.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Symbols that are assigned values in .config files must have satisfied
dependencies, and must have a prompt. Otherwise, the assigned value is
ignored. A warning is printed if the symbol ends up with a different
value than the assigned value as a result.
It might be difficult to know how to fix the problem just from seeing
the current warning. Add some hints to it to help out:
- The symbol information dialog in menuconfig is good for figuring out
dependencies that need to be enabled. Mention menuconfig in the
warning.
- The page for the symbol in the autogenerated Kconfig docs can be
helpful too, so link it. There's a slight chance that it'll be
outdated, but it's usually correct when working on the master
branch.
Automatically enabling dependencies is much trickier than it might seem
at first, due to the generality of Kconfig. See
https://github.com/zephyrproject-rtos/zephyr/issues/8181 for some
discussion.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib to upstream revision 9fba375c65341 (+ local Zephyr
modifications) to get commit 94020beb311eb ("Make Kconfig._choices
public") in. It will be used to generate Kconfig reference pages for
choices.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- Pressing 'c' ('n' was taken) toggles a mode where the names of all
symbols are shown before their prompts. This saves going into the
help display when you just want the name.
- The name of the symbol/choice now appears in the main text of the
help dialog rather than in the title, where it might be hard to
spot, as pointed out by Carles Cufi.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Unquoted string defaults work through a quirk of Kconfig (undefined
symbols get their name as their string value), but look confusing. It's
done inconsistently now too.
Suggested by Kumar Gala.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- Show the value of each symbol in the jump-to dialog.
- Search names and prompts separately in the jump-to dialog.
Previously, '_BAR$' wouldn't match FOO_BAR if it had a prompt,
because '_BAR$' was matched against the string 'FOO_BAR "prompt"'.
- Show the working directory in save/load dialog boxes. Paths will be
relative to it, and Carles Cufi pointed out that it might not be
obvious.
Also allow ~ to be used to refer to the home directory.
- Implement scroll offset for edit boxes. This makes it clearer when
they're scrolled horizontally.
Piggyback an update of Kconfiglib to the latest version (no functional
changes).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Make all menu paths ("(top menu) -> menu -> submenu -> ...") exclude
implicit submenus, which are shown indented in the menuconfig interface
and are created when items depend on the symbol before them.
Previously, implicit submenus were excluded in the menu path at the top
of the menuconfig interface, but were included in the menuconfig symbol
information dialog and in the docs generated by genrest.py.
This makes it consistent, and un-spams the documentation for some
symbols a bit.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Leading/trailing whitespace in prompts requires ugly workarounds in
genrest.py, as e.g. *prompt * is invalid RST. strip() all prompts in
Kconfiglib and get rid of the genrest.py workarounds. Add a warning too.
The Kconfiglib update has some unrelated cleanups and fixes (that won't
affect Zephyr).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
.config files can now be loaded from within the menuconfig interface.
Show-all mode is turned on if the selected menu entry becomes invisible.
Unrelated fix: The menu path at the top of the display no longer
includes implicit (indentation-based) submenus, which makes it a bit
less spammy and confusing.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit mirrors 0f1229bd68866 ("doc: genrest: Show properties on the
correct symbol definition"), for the menuconfig symbol information
display.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit does some major surgery to Kconfiglib so that properties
(defaults, selects, etc.) can be shown on the menu node that actually
has the propetrty for symbols and choices defined in multiple locations.
This will be used to improve the output of genrest.py and the symbol
information display in the menuconfig.
The parsing code is a bit simpler now too as a side effect.
Commit message from Kconfiglib (63a44186137e2)
==============================================
This allows accurate documentation to be generated for symbols and
choices defined in multiple locations. There are now MenuNode.defaults,
MenuNode.selects, etc., lists that mirror the corresponding
Symbol/Choice lists.
Symbol/Choice.__str__() now correctly show property locations as well,
by simply concatenating the strings returned by MenuNode.__str__() for
each node.
_parse_properties() was modified to add all properties directly to the
menu node instead of adding them to the contained symbol or choice. The
properties are then copied up to symbols and choices in
_finalize_tree(). Dependency propagation is handled at the same time.
As a side effect, this cleans up the code a bit and de-bloats
_parse_properties().
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit gets rid of the 'option env="ENV_VAR"' bounce symbols.
"$FOO" now expands directly to the value of the environment variable
FOO, instead of to the value of the Kconfig symbol FOO.
This change is likely to soon appear in the C tools as well. Those
'option env' symbols always seemed kinda pointless, and have broken
dependency handling due to forcing symbol evaluation during parsing,
before all the symbols have even been seen.
Compatibility with the C tools could be retained by naming all
'option env' symbols the same as the environment variable they
reference.
This commit also updated the Zephyr documentation to explain the new
behavior. It's relevant for $ZEPHYR_BASE and out-of-tree Kconfig
extensions.
Commit message from Kconfiglib (cbf32e29a130d)
==============================================
Make "$FOO" directly reference the environment variable $FOO in e.g.
'source' statements, instead of the symbol FOO. Use os.path.expandvars()
to expand strings (which preserves "$FOO" as-is if no environment
variable FOO exists).
This gets rid of the 'option env' "bounce" symbols, which are mostly
just spam and are buggy in the C tools (dependencies aren't always
respected, due to parsing and evaluation getting mixed up). The same
change will probably appear soon in the C tools as well.
Keep accepting 'option env' to preserve some backwards compatibility,
but ignore it when expanding strings. For compatibility with the C
tools, bounce symbols will need to be named the same as the environment
variables they reference (which is the case for the Linux kernel).
This is a compatibility break, so the major version will be bumped to 6
at the next release.
The main motivation for adding this now is to allow recording properties
on each MenuNode in a clean way. 'option env' symbols interact badly
with delayed dependency propagation.
Side note: I have a feeling that recording environment variable values
might be redundant to trigger rebuilds if sync_deps() is run at each
compile. It should detect all changes to symbol values due to
environment variables changing value.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit gets the following incremental search improvements in from
upstream:
- 1d3db5de9b8c2 ("menuconfig: Add search with multiple search
strings")
This makes a search string like 'foo bar' match all symbol names
that match both 'foo' and 'bar' (which can be regexes), regardless
of the order in which they appear in the match. This is faster and
more flexible than having to type a bunch of '.*'.
- 9bf8fc6e6907e ("menuconfig: Add prompts to incremental search")
This makes the incremental searcher search prompt strings as well as
symbol names.
The prompt is now displayed next to the symbol name in the list of
matches as well.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
The horizontal scroll (hscroll) wasn't initialized properly when the
initial (prefilled) contents of an edit box was longer than the edit box
itself (e.g. when saving with a long path in KCONFIG_CONFIG). Things
snapped back into place once a key was pressed.
Properly initialize hscroll to fix the initial rendering.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
This commit adds the following changes from upstream:
- ed38e895ace ("Increase indent for implicit submenus to 4")
Suggested by Carles Cufí. Makes it easier to see the menu structure
at a glance.
- 1d252b30c77 ("menuconfig: Convert the C locale to a UTF-8 locale for
LC_CTYPE")
Makes Unicode input work on many systems with bad defaults.
Also fixes some interface ugliness, like down arrows turning into
upside-down T's.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Until now, Zephyr has used a patched Kconfiglib that turns 'source' into
a globbing source (by replacing 'source' with 'gsource' at the token
level). There's two problems with this:
- The patch needs to be maintained separately
- Misspelled filenames are silently ignored, as they look like glob
patterns that don't match anything
Fix it as follows:
1. Replace all 'source' statements that use wildcards with 'gsource'
2. Remove the custom Kconfiglib patch so that 'source' no longer globs
The sed pattern '/source.*[*?]/s/source/gsource/' was run over all
Kconfig* files to do the replacement.
source's that use environment variables that might contain glob patterns
were manually changed to gsource.
Building the docs in doc/ is a good test, as doc/Makefile deliberately
sets the environment variables to glob up as many Kconfig files as
possible.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Remove the C Kconfig tools and various scripts associated with them.
scripts/kconfig/diffconfig is popular, so keep it.
I don't know whether anyone is using scripts/kconfig/config. Remove it
and see if anyone screams.
scripts/kconfig/streamline_config.pl deals with modules ('m' values) and
can safely be removed. Zephyr's Kconfig files do not use modules.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Pressing [/] brings up a dialog with an edit box where a regex can be
entered. The list of matching symbols is always shown below it.
Selecting a symbol and pressing [Enter] jumps directly to it in the menu
tree. If the symbol is invisible, show-all mode is turned on
automatically.
This commit also includes a bunch of more-or-less unrelated changes from
poking around with the code:
- Some redundant styles were merged. Probably wouldn't want to have a
different style for each separator line, for example...
- [ESC] in the top menu now works like [Q]
- Returning to a parent menu now makes sure that the selected row is
visible, even if the terminal was shrunk between entering the child
menu and leaving it.
- A _max_scroll() helper was factored out to reduce code duplication.
It takes a list of items and a window in which the list is
displayed, with one row per item, and returns the minimum scroll
value that will make the final item visible.
- The save dialog now pops up a message to confirm that the save was
successful.
- Lots of minor code nits all over (renamings, etc.)
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Kconfig.py is not following the de-facto (real?) coding standards of
Zephyr. This commit refactors kconfig.py with two changes:
Use __main__ and def main().
Use argparse instead of sys.argv.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Update Kconfiglib to upstream revision da40c014398f3 (+ local Zephyr
modifications) to get commit da40c014398f3 ("Force encoding to UTF-8 by
default on Python 3") in. It sets a (configurable) UTF-8 default for
Python 3, overriding the encoding specified in the current locale.
I've decided that this is a good idea after some problem reports
unrelated to Zephyr. Running with the C locale breaks things horribly
otherwise, and the fix isn't obvious.
Plain strings aren't decoded on Python 2, so no changes are needed
there.
Related PEP: https://www.python.org/dev/peps/pep-0538/
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
The warning from Kconfiglib might be hard to spot, and the problem is
easily fixed right away (note that malformed .config lines are different
from assignments to undefined symbols).
Do not make malformed .config lines an error in Kconfiglib itself (just
a warning), as you end up with messy "half-loaded" configurations.
Suggested by Marti Bolivar.
Piggyback some minor cleanups in kconfig.py. Make the warning for
configuration settings that didn't match the final value go to stderr,
for consistency.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Update Kconfiglib to upstream revision ed3ceaa056262 (+ local Zephyr
modifications) to get commits c1c5ef2eb1009 ("Print a warning for
malformed .config lines") and ed3ceaa05626f ("Make warnings available in
a list") in.
This warning for malformed .config lines will be turned into an error in
kconfig.py, which is made easier by making the warnings available in a
list in Kconfiglib.
It's now configurable whether warnings are printed to stderr or not. In
this case, it still makes sense to print them to stderr as well.
Suggested by Marti Bolivar.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
This commit adds a Kconfiglib-based menuconfig implementation, built
with the standard Python 'curses' module. A new 'pymenuconfig' target is
added to run it.
The C tools are kept for now. Removing them separately allows testing of
pymenuconfig alongside the C tools, and keeps changes small and focused.
A feature is planned for later that shows all symbols -- including those
that aren't currently visible -- along with a search and "jump to"
feature. Loading of arbitrary .config files will be supported later as
well (as opposed to always loading .config/KCONFIG_CONFIG). Those
features are all connected implementation-wise.
For Windows, the wheels at
https://www.lfd.uci.edu/~gohlke/pythonlibs/#curses provide the curses
implementation. They use the standard Python curses module
(_cursesmodule.c), linked against PDCurses.
Running 'python -VV' gives the Python version and bitness, to know which
wheel to install. User documentation will be added once the C tools are
removed and the 'pymenuconfig' target is moved over to 'menuconfig'.
The CMake parts are originally by Sebastian Bøe.
Description, taken from the menuconfig.py docstring:
Overview
========
A curses-based menuconfig implementation. The interface should feel
familiar to people used to mconf ('make menuconfig').
Supports the same keys as mconf, and also supports a set of
keybindings inspired by Vi:
J/K : Down/Up
L : Enter menu/Toggle item
H : Leave menu
Ctrl-D/U: Page Down/Page Down
G/End : Jump to end of list
g/Home : Jump to beginning of list
The mconf feature where pressing a key jumps to a menu entry with
that character in it in the current menu isn't supported. A search
feature with a "jump to" function for jumping directly to a
particular symbol regardless of where it is defined will be added
later instead.
Space and Enter are "smart" and try to do what you'd expect for the
given menu entry.
Running
=======
menuconfig.py can be run either as a standalone executable or by
calling the menu.menuconfig() function with an existing Kconfig
instance. The second option is a bit inflexible in that it will
still load and save .config, etc.
When run in standalone mode, the top-level Kconfig file to load can
be passed as a command-line argument. With no argument, it defaults
to "Kconfig".
The KCONFIG_CONFIG environment variable specifies the .config file
to load (if it exists) and save. If KCONFIG_CONFIG is unset,
".config" is used.
$srctree is supported through Kconfiglib.
Other features
==============
- Seamless terminal resizing
- No dependencies on *nix, as the 'curses' module is in the Python
standard library
- Unicode text entry
- Improved information screen compared to mconf:
* Expressions are split up by their top-level &&/|| operands
to improve readability
* Undefined symbols in expressions are pointed out
* Menus and comments have information displays
* Kconfig definitions are printed
Limitations
===========
- Python 3 only
This is mostly due to Python 2 not having curses.get_wch(),
which is needed for Unicode support.
- Doesn't work out of the box on Windows
Has been tested to work with the wheels provided at
https://www.lfd.uci.edu/~gohlke/pythonlibs/#curses though.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Update Kconfiglib to upstream revision 509e374dfcadb (+ local Zephyr
modifications) to get commit 509e374dfcadb ("Add Choice.direct_dep
field") in. It is used by the upcoming Python menuconfig implementation
when displaying information about choices.
Origin: https://github.com/zephyrproject-rtos/Kconfiglib/tree/zephyr
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Update Kconfiglib to upstream revision 105c835e70a5b (+ local Zephyr
modifications) to get commit 105c835e70a5b ("Add helper for splitting
expressions") in. It will simplify the 'select' logic in genrest.py and
the upcoming menuconfig implementation, and also simplifies some
Kconfiglib internals.
split_expr() will also be helpful if genrest.py ever needs to split
other expressions, e.g. over multiple lines.
Origin: https://github.com/zephyrproject-rtos/Kconfiglib/tree/zephyr
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Update Kconfiglib to upstream revision 981d24aff7654 (+ local Zephyr
modifications) to get commit 981d24aff7654 ("Set is_menuconfig True on
the top menu") in. It will be needed by the menuconfig implementation.
Origin: https://github.com/zephyrproject-rtos/Kconfiglib/tree/zephyr
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Update Kconfiglib to upstream revision 2259d353426f1 (+ local Zephyr
modifications) to get commit 2259d353426f1 ("Generalize is_menuconfig to
non-symbol items") in. It will be used by the menuconfig implementation.
Origin: https://github.com/zephyrproject-rtos/Kconfiglib/tree/zephyr
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Update Kconfiglib to upstream revision 7245bad9ebb58 (+ local Zephyr
modifications), to get the following improvements/fixes in:
- Print a warning if an int or hex symbol is assigned a value that lies
outside an active 'range' constraint.
- Turn 'FOO' into a link in 'select FOO' when generating the Kconfig
reference documentation.
- Parenthesize '&&' expressions within '||' expressions --
(A && B) || (C && D) is more readable than A && B || C && D.
The final two fixes will only be visible once the fix for #5622 gets in.
Fixes#6749Fixes#6844
Origin: https://github.com/zephyrproject-rtos/Kconfiglib/tree/zephyr
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Warnings from Kconfiglib itself always give symbol locations, but the
custom value mismatch warning in kconfig.py doesn't. Make it print the
symbol location(s) too. This is helpful when debugging.
Before:
warning: UART_QMSI_0_HW_FC was assigned the value "y" but got the
value "n" -- check dependencies
After:
warning: UART_QMSI_0_HW_FC (defined at
.../drivers/serial/Kconfig.qmsi:35,
.../arch/x86/soc/intel_quark/quark_se/Kconfig.defconfig.series:194)
was assigned the value "y" but got the value "n" -- check
dependencies
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Decode Kconfig sources as UTF-8 instead of decoding them according to
the system locale (which might be ascii-only).
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Decode Kconfig sources as UTF-8 instead of decoding them according to
the system locale (which might be ascii-only).
This resolves an issue that can be reproduced like this:
$ export LANG=C
$ echo '# Sebastian Bøe' >> ~/zephyr/Kconfig
$ build_any_zephyr_app
See the Python comment for details.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Sort the glob results when Kconfig sources do 'source
"/path/*/Kconfig"' to ensure that the resulting dotconfig file is the
same for all platforms.
This fixes#5743
Credit goes to @ulfalizer.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
A lot of improvements have made it into Kconfiglib since we introduced
it into Zephyr. This rebases our 2 Zephyr-specific commits into the
latest Kconfiglib upstream.
Origin: https://github.com/zephyrproject-rtos/Kconfiglib/tree/zephyr
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Specifying a C standard triggered a compiler warning on Ubuntu (gcc
5.4.0) and a compiler error on Mac OS 10.12.6. Omit specifying the
standard and let the host toolchain use it's default instead. Tested
on Mac OS and Ubuntu 16.04.3.
This fixes#5640
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
We have been using a fork of the Linux kernel's Kconfig system to
configure the Zephyr tree. The issue is that this is a native tool
written in C that is not easy to compile for Windows. This patch
replaces the use of the conf executable with kconfig.py, a script that
uses Kconfiglib to generate the .config and autoconf.h files required to
compile Zephyr.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Some projects use wildcards when sourcing a Kconfig file. Add
support for globbing the files that match the wildcards and process
them one by one.
Origin: https://github.com/carlescufi/Kconfiglib/tree/zephyr
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Import Kconfiglib, the Python Kconfig parsing library.
Origin: https://github.com/ulfalizer/Kconfiglib
Revision: 8d30e5bb1ad5cab16d1226cc5cd3a03d64664f5d
Note that this will in time replace doc/scripts/genrest/kconfiglib.py,
which is an earlier version and should not live in that folder.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.
Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.
This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.
For users that just want to continue their work with minimal
disruption the following should suffice:
Install CMake 3.8.2+
Port any out-of-tree Makefiles to CMake.
Learn the absolute minimum about the new command line interface:
$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..
$ cd build
$ make
PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
When a configuration file fragment ends in a line that is not
terminated by a \n, it will mange the pasting of the following
fragment. For example, in file1.prj:
CONFIG_SETTING_A=34
CONFIG_SETTING_B=12
and file2.prj:
CONFIG_SETTING_C=56
would become:
CONFIG_SETTING_A=34
CONFIG_SETTING_B=12CONFIG_SETTING_C=56
because there was no \n at the end of CONFIG_SETTING_B=12. This makes
the kconfig parser to reject CONFIG_SETTING_B and to loose
CONFIG_SETTING_C, which then has random consequences.
So, to avoid that problem, always add a newline after a config fragment.
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
To speed up builds, this change allows building the needed host tools
that are built for every application and stores them un
${ZEPHYR_BASE}/bin.
Run 'make host-tools' and then define PREBUILT_HOST_TOOLS to reuse the
host tools across multiple builds.
$ make host-tools
HOSTCC scripts/basic/fixdep
HOSTCC scripts/gen_idt/version.o
HOSTCC scripts/gen_idt/gen_idt.o
HOSTLD scripts/gen_idt/gen_idt
HOSTCC scripts/gen_offset_header/gen_offset_header.o
HOSTLD scripts/gen_offset_header/gen_offset_header
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
$ export PREBUILT_HOST_TOOLS=${ZEPHYR_BASE}/bin
$ make -C samples/hello_world
Now you will notice a speedup when building the application!
Change-Id: Ie0aeee7f9a60b1fd49e7e32d78601f03473d73b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
getenv() returns an string of unknown size, so Coverity warns that it
might be used to overflow the stack in the call chain off
conf_read_simple().
To avoid that, wisdom says copy to an string of known size and pass
that.
Change-Id: I9e468de0ae66429062027f58fe0a0a4e1197218f
Coverity-ID: 150819
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
(cherry picked from commit 0307d6ea5fa361abe5c9fb1872f9dc8256208ee0)
In windows systems the rename() function fails if the new name
of the original file corresponds to a file that already exists.
The fix removes the new file before renaming the original one.
Jira: ZEP-980
Change-Id: Ib3a43db86c0dd3fabb592f53ea7619eb5738bb65
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
Coverity reported 150819 issue, which steams off Flex generated code
from zconf.l in which sprintf() was use. Because of that, the
conf_read_simple() @name parameter could be used to overrun
zconf_open() @fullname by crafting SRCTREE and KCONFIG_ALLCONFIG
environment variables.
Change-Id: I2cff817dccafe0e06b35636bbb7be95e062410af
Coverity-ID: 150819
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Right now the build system builds the host tools over and over again, in some
environments especially when running in an IDE on windows for example,
this is not desired and a set of pre-built host tools should be used.
Provide an option to use pre-built tools instead of building them
from source.
To use, set PREBUILT_HOST_TOOLS to the path where all pre-built host tools
are hosted. To get a prebuilt version of the host tools, build without the
variable set and copy the generated host binaries from outdir. The following
tools are supported:
* conf
* fixdep
* gen_idt
* gen_offset_header
Jira: ZEP-237
Change-Id: Iea505bfd0b50f851ee2781b5117bb6085ab20157
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
On OS X (macOS), "make menuconfig" fails with missing
linker symbols. By specifying the "-l" linker options
with the menu, panel and ncurses libraries directly if
the autodetection fails, it builds and links properly.
Note that this might denote a problem with
"check-lxdialog.sh".
Change-Id: Ib2721646cc01c3e977911d8e6d0c8303dcedbc58
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Since the root Makefile already provides a HOST_OS
environment variable that is exported by using uname,
make use of it in the Kconfig Makefile.
Change-Id: I13655a5295bbcd9f2fdfa8b6309634c1ab143f70
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
It allows to silently ignore non-existent files.
When using wildcards in Kconfig source files
(e.g. source folder/*/Kconfig), it is possible to refer files
that does not exist. In the previous example, it is possible
that Kconfig files do not exist in one of the folder's
subfolders and it is not a requirement for the file to exist
in each one of the subfolders.
Additionally, it fixes an issue for wildcards in the file name.
If the name contains a wildcard, Kconfig should iterate
over each file included in the wildcard
(e.g source folder/myKconfig.*)
Jira: ZEP-177
Change-Id: I5aa192ca1e2df83461b12a86fe29a98cd95c4256
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
There are two major issues with the kconfig:
() Some of the config options have incorrect dependencies inside help
under menuconfig. For example, CONFIG_GPIO depends on BOARD_GALILEO.
() Since the SoC and board specific kconfig files are parsed first,
the help screen would say, for example, CONFIG_SPI is defined at
arch/arm/soc/fsl_frdm_k64f/Kconfig. This is incorrect because
the actual config is defined in drivers/spi/Kconfig.
These cause great confusion to users of menuconfig/xconfig.
To fix these, the SoC and board defaults are now to be parsed last.
Note that the position swapping of defaults in this patch is due to
the fact the the default parsed last will be used.
And, spi_test is broken due to the fact that it requires
CONFIG_SPI_INTEL_PORT_1, but never enables it anywhere. This is
bypassed for now.
Origin: refactored and edited from existing files
Change-Id: I2a4b1ae5be4d27e68c960aa47d91ef350f2d500f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This is in preparation to move SoC and board kconfig defaults
to be parsed later.
Change-Id: If24bdf310dac7034da63f34c0e2add173fe75844
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a debug option to print defaults and their conditions
inside config description under menuconfig/xconfig. This aids in
debugging of kconfig creation.
Change-Id: Ie651435f6b2115dac1bd3a6f7a1b3c2df3c9b0ed
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
MinGW have small conventions differences in the
call of some APIs. The following differences are
addressed:
- mkdir method parameters
- printf format for 64 bit integers
- utsname structure
- glob library
MinGW does not provide glob library.
This patch adapts the code to avoid this library when
building for MinGW on windows systems.
The new routines allow windows to support wildcards
(*, ?) on Kconfig paths.
zconf.lex.c_shipped is the file that the build system
compiles by default. If the user defines the
REGENERATE_PARSES environment variable for the build,
then zconf.lex.c_shipped is generated from the file
zconf.l. Both files are provided in the patch
to keep coherency with the REGENERATE_PARSES option.
Change-Id: I5b6ad24ead0521913ab6ea9da93551edcd2dc66b
Signed-off-by: Louise Mendoza <yonattan.a.louise.mendoza@intel.com>
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
Build kconfig with -DKBUILD_NO_NLS by default and disable compiler
warning on Mac OS when building the host tools.
Change-Id: I76a2b5ab6b6b1c0bbe2dc2b31e3bd651fd05948e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit also renames boards and makes naming consistent between
board name and defconfig files.
quark_d2000_reference -> quark_d2000_crb
quark_se_test_sss -> quark_se_sss_ctb
quark_se_test -> quark_se_ctb
Change-Id: Ibe6a5102edb987fe1d6ce32c8c392a87d45d6951
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When building for a certain platform, we have no idea
what architecture we are building for.
We used to specify the architecture alongside the board or platform
name and this was used to find the defconfig in arch/<arch>/configs.
By putting all board configurations we support in one place we do
not have to specify the architecture, just the configuration name.
Change-Id: Ib7e9f63b9a8051714dc207f583fd26ef620497d8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This allows using wildcards with kconfig files so there is no need
to include individual files within a well define tree structure.
For example, you add
source "drivers/*/Kconfig"
and all Kconfig files under drivers/ will be sourced and the order in
menuconfig will be based on the wildcard processing, not in any particular
order.
The main advantage here is that drivers and platforms become drop-ins, a platform
or a driver can be added by just placing it in the right place without having to
change system Kconfig files or Makefiles (Makefiles will be supported in other change).
Change-Id: Id223ba10e6f48b4c48435e9ea37885162ce55e7c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit removes *config targets that does not apply to
the system or that are not implemented
Change-Id: Ib7739fda4085562fbe7d14491b7de9f354d0dc7d
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
"scripts/kconfig/merge_config.sh && make oldconfig" works well
enough for merging local config fragments, but Kbuild currently has
the entry points only for "kvmconfig" and "tinyconfig".
This commit provides the generic target for mergeconfig, so we can
manage our own config fragments easily:
put "foo.config" in arch/$(SRCARCH)/configs/ or kernel/configs/,
and then run "make foo.config".
Now "make kvmconfig" is just a shorthand of "make kvm_guest.config".
Likewise, "make tinyconfig" is equivalent to
"make allnoconfig tiny.config".
Change-Id: I9ea4fd21ac46b42c2b6d87ee7eeeff67768bc375
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Kbuild always runs in $(objtree). Actually, $(objtree) is always
set to "." by the top-level Makefile.
We can omit "-O $(objtree)" and "$(objtree)/".
Change-Id: I17eea62cc3b85957572f9f9eb5207caa1a91f881
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If "make kvmconfig" is run with "-j" option, a warning message,
"jobserver unavailable: using -j1. Add `+' to parent make rule.",
is displayed.
$ make -s defconfig
*** Default configuration is based on 'x86_64_defconfig'
#
# configuration written to .config
#
$ make -j8 kvmconfig
Using ./.config as base
Merging ./arch/x86/configs/kvm_guest.config
[ snip ]
#
# merged configuration written to ./.config (needs make)
#
make[2]: warning: jobserver unavailable: using -j1. Add `+' to
parent make rule.
scripts/kconfig/conf --oldconfig Kconfig
[ snip ]
#
# configuration written to .config
#
Change-Id: Icda8d75af0bb50612cb020874649593c2ed0154f
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The variable "MAKE" is used to store the command name that has
invoked the Makefile. (Actually, it is already set to "make"
if you run this script from a Makefile.)
In this script, however, it is used to determine if Make should be
run or not. It is not what we usually expect.
Change-Id: I6891ecfc5003b4494d72878fa0da00a6ab452b21
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a check for the existence of input files and exit (with failure)
if they are missing.
Without this additional check, missing files produce error messages
but still result in an output file being generated and a successful
exit code.
Change-Id: I8609e00ce99b491dcb1d41e64106a6829dc1fb41
Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Michal Marek <mmarek@suse.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Currently, "make tinyconfig" does not work with "-j" option.
$ make mrproper
$ make -j8 tinyconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --allnoconfig Kconfig
#
# configuration written to .config
#
scripts/kconfig/Makefile:122: *** You need an existing .config
for this target. Stop.
make: *** [tinyconfig] Error 2
As shown above, "allnoconfig" has created the .config file before
mergeconfig is called, but Make still raises a false alarm because
of some sort of race condition.
We can fix this issue by moving the error check to the shell script.
Anyway, scripts/kconfig/merge_config.sh always requires an existing
.config as a base file. It is reasonable to check its existence in
the shell script.
Change-Id: I4c6b26bf3b19c5d5b19ed43ee6b553f7a5944c21
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Change-Id: I5fdbe712db8e15031c8c214c0d4378f8508d03da
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>