"No definition found" in Button example using VSC

Hello everyone,

We have installed NRF Connect SDK / Toolchain through the Connect App. We then open up VSC and "Open an existing application", choose from "C:\ncs\v2.4.0\zephyr\samples\basic\button" and let it compile.

When right click and select "Go to definition" on sw0 on line 20 of main.c, it just returns "No definition found for 'sw0'".

We tried Ctrl+Shift+P - "nRF Connect: Add nRF Connect SDK to Workspace" - to no avail.

We tried File -> Add Folder to Workspace on our NCS folder - to no avail.

So, what's up? How to get the "Go to definition" to work in VSC using nRF Connect?

Thanks for any help

Parents Reply Children
  • Hi,

    I have build it (first pristine, then normal build). Does not work. Also, I have made sure that 2.4.0 toolchain is installed and is what is used.

    What I select after opening existing application in the build configuration:

    Then I do a pristine build, after which is complains that the CMAKE extension is not the correct one (I just did a complete fresh install on a brand new computer, which is the fourth computer on which I can reproduce this exact issue!).

    So I disable that extension, now NRF connect VSC thing is happy... I then save the workspace and do a normal compile (click the Build button), and I get the following warnings:

    And the go to definition for the sw0 is still not working.

    Now, it seems to me it has to do with linking the devicetree with the C file(s)?

    Also, I get the distinct feeling that this whole development platform using nRF connect desktop app, toolchain manager, VSC, VSC extensions, is half-baked and not at all ready for real usage? It seems to be on an Alpha testing level? But what else to use then? Or what is going on that I am clearly not understanding?

  • Hi,

    If you haven't already I recommend to start with the nRF Connect SDK Fundamentals course:
    https://academy.nordicsemi.com/ 

    Normally you can go to definition for variables, but those devicetree aliases (DT_ALIAS(..)) might be the exception. You will need to open the .dts file for the board you are working with, in my case nrf52840dk_nrf52840.dts.

    Kenneth

Related