Skip to content
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

syntax highlighting does not have zephyr/.config #39

Open
asteriskSF opened this issue Apr 19, 2024 · 5 comments
Open

syntax highlighting does not have zephyr/.config #39

asteriskSF opened this issue Apr 19, 2024 · 5 comments

Comments

@asteriskSF
Copy link

I have a zephyr project imported with MCUXpresso for VSCode extension.
When I open source files from the project the intellisense highlighting shows incorrect values for preprocessor condition.
The tooltips when hovering over a preprocessor macro show the information from Kconfig but it shows the default value instead of the one set in the prj.conf.

Why isn't it using the values from the generated build/zephyr/.config? How do I fix it?

@asteriskSF
Copy link
Author

Any help? The user experience with NXP is highly impacted by this issue, and I work with other vendors who do have this issue.

@cristitep-nxp
Copy link
Contributor

Hi,

I tried your scenario and for me it seems to be working, please check below what I did and let me know if there are any diffs comparing with what you've tried:

  1. import a Zephr project (hello world)

  2. I used an existing/random config to guard a code snippet (in main.c):
    #if (CONFIG_HEAP_MEM_POOL_SIZE == 256)
    int x = 1;
    #endif
    In this case, highlight shows the "int x = 1" as disabled, which is obvious since the default value for CONFIG_HEAP_MEM_POOL_SIZE in autoconf.h is 0

  3. then, in prj.conf I added "CONFIG_HEAP_MEM_POOL_SIZE=256" and saved the file.
    In the moment I saved the file, it is triggered project config task which is starting to regenerate files, including autoconf.h which, on the end of generation/configuration step, updates CONFIG_HEAP_MEM_POOL_SIZE to the new 256 value. In this moment, the code snippet in my main.c indicates "int x = 1" as active - which is what I expect.

Considering this, and the flow for IntelliSense is working as long as your source files indicates the right value for macros (which is true after saving the edited prj.conf file and the regeneration of Zephyr files is ended) I consider the highlight is correctly working. Please let me know details about your case.

Regards,
Cristian

@asteriskSF
Copy link
Author

I have code in the zephyr library that is not highlighting, when debugging the code even gets executed. Perhaps only files in the app folder are getting the .config settings?

vscode_highlighting

The file is a custom driver for flexspi that i'm working on, but it also occurs with the lpspi driver.

Is it possible I have multiple extensions provided intellisense? How do I know where intellisense gets its info?

@asteriskSF
Copy link
Author

I think I found the problem. In C/C++ Configurations under Advanced Settings, Confguration Provider, I had a value from nordic's nrf connect extension. However I have disabled that extension while working on my nxp project. After switching to ms-vscode.cmake-tools I started getting correct values.
Does MCUxpresso extention provide intellisense or is ms-vscode.cmake-tools the recommended option?

@cpopa-nxp
Copy link

Glad you found the solution! Indeed, the NXP extension relies on cmake-tools as the Intellisense configuration provider so that is the recommended option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants