summaryrefslogtreecommitdiff
path: root/util/kconfig_check.py
Commit message (Collapse)AuthorAgeFilesLines
* ec: Prevent #undef or #define of zephyr KconfigsJeremy Bettis2023-04-041-0/+71
| | | | | | | | | | | | | | | | | | | | Block all #undef or #define of Kconfigs in include/config.h. This will allow removing the #include <autoconf.h> from zephyr/shim/include/config_chip.h, which will in turn allow removing all of the #line directives we've sprinkled throughout the headers. BRANCH=None BUG=b:272518464 TEST=make buildall_only -j$(nproc), fails before crrev/c/4396143 TEST=CQ, fails before crrev/c/4396143, passes after Change-Id: I09649cf778e339fb45dc05c6ebdffc9aaa5778d2 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4396142 Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
* ec: Fix kconfig_check.pyJeremy Bettis2023-04-031-14/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kconfig_check.py tool was reporting all symbols in the Kconfigs as configs, including things like ``` config PLATFORM_EC_PREINIT_HW_CYCLES_PER_SEC default 100000000 ``` would return CONFIG_PLATFORM_EC_PREINIT_HW_CYCLES_PER_SEC and CONFIG_100000000 as valid configs. Read only Symbol node names instead. Include Kconfigs in platform/ec but outside of platform/ec/zephyr also. Also include Kconfig.zephyr from third_party/zephyr/main, which was previously omitted. This requires setting some environment variables. BRANCH=None BUG=b:272518464 TEST=make buildall Change-Id: I02e86f5c96f1e9943386d1610af1b2ab07550754 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4383371 Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* ec: Use chromite isort configJeremy Bettis2023-02-031-0/+1
| | | | | | | | | | | | | | | | | | Remove the .isort.cfg from platform/ec and use the one from chromite instead. This should be compatible with cros format. BRANCH=None BUG=b:267757300 TEST=Ran firmware_builder.py Change-Id: Ice4955b6995bd1f9380e97f58e89efb7c1e8aeb1 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4221928 Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: rename projects folder to programKeith Short2022-11-041-2/+2
| | | | | | | | | | | | | | | | Renme the projects folder to program for consistency with the name scheme used by the boxster configuration. BUG=b:254097139 BRANCH=none TEST=zmake compare-builds -a TEST=twister Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ib56a57f1e5942e6dd0460e3be81722896eed72af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3968444 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ec: Switch black to 80 cols and reformat filesJeremy Bettis2022-07-261-7/+32
| | | | | | | | | | | | | | | | | | | | Add pyproject.toml config file to set black to 80 columns. Remove column length overrides from other config files. Reformat python files to 80 cols. BRANCH=None BUG=b:238434058 TEST=presubmit/CQ Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I870a68f1bb751f4bad97024045f6e3075489e80f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3764071 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* py: Fix pylint errors discovered by cros lintJeremy Bettis2022-07-141-1/+1
| | | | | | | | | | | | | | | | | | Resolve all pylint warnings in these files. Disable fixme and too-many-arguments globally, because they are very common, and aren't really problems. BRANCH=None BUG=b:238434058 TEST=cros lint Change-Id: I94c410330d6d576d3cc9518503699a514a28758d Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3760093 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* kconfig_check: Exclude board, project, test filesJeremy Bettis2022-07-141-0/+8
| | | | | | | | | | | | | | | | | | | | | Instead of ignoring BOARD_ and VARIANT_ configs from the list of CONFIGs allowed to use in legacy EC, just don't parse the Kconfig files from board, test, project, or chip dirs. That gives better parity between the kconfiglib based logic and the grep based logic. This also prevents simple refactors like crrev/c/3745106 from breaking the unit test. BRANCH=None BUG=b:238773780 TEST=util/run_tests.sh && make -j40 buildall Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Idf1d6a2ede86c587c092df1cf060200d178a881b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3763781 Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* ec: Fix kconfig_check and run unit test in cqJeremy Bettis2022-07-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Changed the unit test to fail if it can't find zephyr or the kconfiglib instead of skipping, and make it pass. Run the unit test in the CQ. In the process, I discovered that it never used kconfiglib because of errors with ZEPHYR_BASE not being set. Changed kconfig_check to output the error when it falls back to no kconfiglib. This exposed that there were missing configs in util/config_allowed.txt BRANCH=None BUG=b:238773780,b:181253613 TEST=make -j40 buildall && util/run_tests.sh Change-Id: I28a050d448a40df034dd9f2305a2d17cd0797468 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3759263 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
* ec: Format all python files with black and isortJeremy Bettis2022-07-121-79/+151
| | | | | | | | | | | | | | | | | | | find . \( -path ./private -prune \) -o -name '*.py' -print | xargs black find . \( -path ./private -prune \) -o -name '*.py' -print | xargs ~/chromiumos/chromite/scripts/isort --settings-file=.isort.cfg BRANCH=None BUG=b:238434058 TEST=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I63462d6f15d1eaf3db84eb20d1404ee976be8382 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3749242 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* util: Allow ignoring problematic Kconfig optionsSimon Glass2022-02-071-4/+14
| | | | | | | | | | | | | | | | | | | | | | The script normally complains if an option is in config_allowed but is actually defined in Kconfig. This doesn't always work though, since it is possible that the option is defined in Zephyr itself, not in the platform/etc/zephyr directory. Add an option to ignore them. BUG=b:181323955 BRANCH=none TEST=./util/kconfig_check.py -c build/blipper/.config -a util/config_allowed.txt -p PLATFORM_EC_ -s zephyr/ -I ~/cosarm/src/third_party/zephyr/main -i DAC check See that this does not cause an error now Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Icbb245b0cd4dcdc59a72a970020314d8a265fb98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425451 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* util: Support building a new list of ad-hoc CONFIGsSimon Glass2022-02-071-0/+30
| | | | | | | | | | | | | | | | Add a separate command for this, so that the file can easily be regenerated completely. BUG=b:181323955 BRANCH=none TEST=./util/kconfig_check.py -c build/blipper/.config -a util/config_allowed.txt -p PLATFORM_EC_ -s zephyr/ build See that the output file is generated Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ife8e4cee3bcacf3d8206cd598140b88608a13109 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425450 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* util: Tweak kconfig_check for use in the MakefileSimon Glass2022-02-051-2/+14
| | | | | | | | | | | | | | | | | | | | Deal with two problems we have in the chroot: - An old Python requires a workaround for required arguments - We may not have access to the Zephyr tree and its full Kconfig, so need to gracefully fall back to using ad-hoc searching Note: This was part of a reverted commit. It is being split out to avoid mixing the switch-over with updates to the script. BUG=b:181323955 BRANCH=none TEST=CQ and see if it passes now Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I4c885cc0661955b3b091c339b61e21cc2af7ac72 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425449 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Revert "Makefile: Switch to the Python script for CONFIG checking"David Stevens2022-01-301-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5b4c6473a341ebbd88463c908b39bb2820e5c43b. Reason for revert: b:216919905 - breaks chromeos CQ Original change's description: > Makefile: Switch to the Python script for CONFIG checking > > Now that the Python script seems to do what we need, switch over to > use that for checking for allowed ad-hoc CONFIGs. > > Sadly we need a work-around for the very old Python 3 version used in > the chroot. > > The new script is better at finding Kconfig options, so this allows some > reductions in the config_allowed.txt file. > > Delete the now-unused shell scripts. > > BUG=b:181323955 > BRANCH=none > TEST=python3 util/test_kconfig_check.py > > Signed-off-by: Simon Glass <sjg@chromium.org> > Change-Id: I2dafc9dfe9d9020638f4e49b5c5ee0fc0b10000b > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2923233 > Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Bug: b:181323955 Change-Id: I9b5514f9d2df43033cfd95555612e2e89e6ce724 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3426237 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Nicolas Norvez <norvez@chromium.org> Tested-by: Nicolas Norvez <norvez@chromium.org>
* Makefile: Switch to the Python script for CONFIG checkingSimon Glass2022-01-281-2/+14
| | | | | | | | | | | | | | | | | | | | | | Now that the Python script seems to do what we need, switch over to use that for checking for allowed ad-hoc CONFIGs. Sadly we need a work-around for the very old Python 3 version used in the chroot. The new script is better at finding Kconfig options, so this allows some reductions in the config_allowed.txt file. Delete the now-unused shell scripts. BUG=b:181323955 BRANCH=none TEST=python3 util/test_kconfig_check.py Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I2dafc9dfe9d9020638f4e49b5c5ee0fc0b10000b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2923233 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* util: Support updating the list of allowed configsSimon Glass2022-01-281-5/+70
| | | | | | | | | | | | | | | When there are unneeded ad-hoc configs in the 'allowed configs' file, require the user to add their removal to the CL. This helps to ensure that config_allowed.txt reduces in size over time. BUG=b:181323955 BRANCH=none TEST=python3 util/test_kconfig_check.py Change-Id: I56784bd2a147637e2bf98f7e8353584292019f51 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2923232 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* util: Support using kconfiglib in the CONFIG checkerSimon Glass2022-01-281-32/+109
| | | | | | | | | | | | | | | | | | | | | Update this to use kconfiglib so that it might be easier to maintain. This needs a more correct Kconfig setup in the tests. Also we need to provide the root Kconfig instead of just the directory. Overall this takes about 50% more time, but the total is only about 50ms, so this is not a significant factor in build performance. We must leave it optional, since U-Boot is unlikely to want this extra dependency. BUG=b:181323955 BRANCH=none TEST=python3 util/test_kconfig_check.py Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I5cce2ca1fa16a7c334cef15b1f66dd7ede2644bd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2923227 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* util: Make a start on writing a Python-based CONFIG checkerSimon Glass2021-05-271-0/+209
Add a new class which can handle the operations required to check that new ad-hoc CONFIGs are not added to the source tree. More work is needed in future CLs: - building the list of allowed CONFIGs - plumbing it into the build and removing the existing shell scripts BUG=b:181323955 BRANCH=none TEST=python3 util/test_kconfig_check.py Change-Id: Icec295effc4bf3c7b644f671b0cb83dcb0c97b68 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2864428 Reviewed-by: Yuval Peress <peress@chromium.org>