I am trying to use the kconfig in RIOT. I have some parameters which can be set using Kconfig in my application. When I try to build the app for native,everything works fine (build is successfull). But when I build the app for other boards I get some error from kconfig library tool in riot. What could be the possible solution ? Any leads are highly appreciated.
just realized that the same error happens when I build “RIOT/tests/kconfig” sample. It builds and runs for native,but not for other boards.
Also I noticed the following.
I tested the example on the Main branch. I could build the “RIOT/tests/kconfig” sample for the msbiot board first. Then I build for the native board.It was also successful. After that, whenever I build the sample for boards other than native,I get the error mentioned above.
I have also tried cleaning the building files and building again.But the same issue persists.
Thanks for reporting this. I may have an idea where the issue is coming from. In our dist/kconfiglib/genconfig.py we perform an initial write of the configuration to check for errors, and the target is os.devnull. Inside write_config kconfiglib checks the existing file (/dev/null in this case) and compares the content (_contents_eq function). It may be that for some reason, the read function is returning something from your /dev/null, which it cannot decode as a valid utf-8.
I can’t reproduce the issue locally, could you please try the following?
diff --git a/dist/tools/kconfiglib/genconfig.py b/dist/tools/kconfiglib/genconfig.py
index 093d78507a..91e5752154 100755
--- a/dist/tools/kconfiglib/genconfig.py
+++ b/dist/tools/kconfiglib/genconfig.py
@@ -390,9 +390,7 @@ with error.""")
kconf = RiotKconfig(args.kconfig_filename, warn_to_stderr=False)
merge_configs(kconf, args.config_sources)
- # HACK: Force all symbols to be evaluated, to catch warnings generated
- # during evaluation (such as out-of-range integers)
- kconf.write_config(os.devnull)
+ kconf.evaluate_config()
if not check_configs(kconf) and not args.ignore_config_errors:
sys.exit(1)
diff --git a/dist/tools/kconfiglib/riot_kconfig.py b/dist/tools/kconfiglib/riot_kconfig.py
index be86733d65..c8a47a0800 100644
--- a/dist/tools/kconfiglib/riot_kconfig.py
+++ b/dist/tools/kconfiglib/riot_kconfig.py
@@ -28,6 +28,14 @@ class RiotKconfig(Kconfig):
super(RiotKconfig, self).write_autoconf(filename, header)
self.unique_defined_syms = tmp_unique_defined_syms
+ def evaluate_config(self):
+ """Evaluate the current configuration.
+
+ Useful to catch warnings (such as out-of-range integers) before writing
+ the configuration to a file.
+ """
+ self._config_contents(None)
+
def standard_riot_kconfig(description=None):
"""