-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake: confgen.py can't handle hex ranges when generating JSON metadata (IDFGH-1273) #3568
Comments
@devanlai Thanks for reporting the issue. We will look into it. |
Might want to take the symbol type into account. Something like this will work: for min_range, max_range, cond_expr in sym.ranges:
if kconfiglib.expr_value(cond_expr):
base = 16 if sym.type == kconfiglib.HEX else 10
greatest_range = [int(min_range.str_value, base),
int(max_range.str_value, base)]
break
Related note from the
|
Thank you @devanlai for letting us know about this problem and thank you @ulfalizer for the suggestion. The fix will be added soon. |
You guys should update Kconfiglib someday by the way. Tons of improvements and optimizations, and probably no API changes that'd affect you (there's a list in the README). Would help avoid user issues like this one too. Sorry for nagging.~ |
Environment
v4.0-dev-667-gda13efc17
crosstool-NG crosstool-ng-1.22.0-80-g6c4433a5 5.2.0
Problem Description
When using the CMake build system and a KConfig file with a symbol of type hex and the range of valid values is defined using hex literals,
idf.py menuconfig
fails due toconfgen.py
throwing an exception when it tries to convert the hex literals to integers to output the JSON "range" field.I believe that this could be fixed by tweaking the code that outputs the JSON range field to use
int(min_range.str_value, 0)
instead ofint(min_range.str_value)
so that it will accept any well-formed numeric literal that Python accepts.Steps to repropduce
idf.py menuconfig
.Code to reproduce this issue
Sample
Kconfig.projbuild
to reproduce the issue:Debug Logs
confgen.py
traceback:The text was updated successfully, but these errors were encountered: