How can I make the VS code Connect IDE build for the MCU and an accompanying shield?

OS: Ubuntu 22.04 LTS

SDK: NRF Connect SDK 2.3.0 (in VS Code, installed through the tutorial)

Hardware: nRF52840dk_52840



Basically, I am using a Waveshare E-paper Display Raw Shield with the Waveshare e-paper 1.54 inch e-ink panel. This screen is incorrectly documented, but that is a story for a different day.
In any case, in order to build an application for a shield, west must be called in a specific way.


https://docs.zephyrproject.org/latest/boards/shields/waveshare_epaper/doc/index.html

as can be seen in the Zephyr documentation.

Specifically, a flag is added to west in the following manner:
-----------------------------------------------
# From the root of the zephyr repository
west build -b nrf52840dk_nrf52840 samples/subsys/display/lvgl -- -DSHIELD=waveshare_epaper_gdeh0213b1
------------------------------------------------

In my case, it would say waveshare_epaper_gdeh0154a07 according to the table in the documentation.

But it seems that in VS code, this is not automatically done, (after all, how could VS code know what I've attached to the shield?)
But how can I modify the way build is called from nrf Connect in VS code so that it does take this into account?



In the file index.rst (Found in zephyr/boards/shields/waveshare_epaper/doc) the above segment is found.
That seems like it would be the answer to my question, but I have not yet seen a file where these "zephyr-app-commands" are used. Where might they be added?

Another solution is off course to build it with command line tools. This works for me, when (and only when) I follow this helper (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/getting_started/programming.html) and start the terminal through the toolchain manager (This does not yield any image on the screen, could be many reasons, different discussion, just saying)  . But the problem is that I would like to be able to run, flash and debug from VS code so that I can do everything in the same place. I don't particularly like writing code in it, but it's wonderful for reading code and debugging, as well as all the building, flashing, etc. Perhaps one can build from command line in such a way that the application shows up in the nRF connect interface in VS code? I am still a bit new to everything zephyr, but open to suggestions.

Thanks in advance


Parents
  • Hi,

    But how can I modify the way build is called from nrf Connect in VS code so that it does take this into account?

    This can be achieved when creating a build configuration (or editing an existing one). There is a field for "Extra CMake arguments" where you can add the -DSHIELD option you need. I know that this might not be obvious, since you usually only create a build config once and then forget about that screen.

    Note that you have to press the "OK" button for the argument to be saved!

    Perhaps one can build from command line in such a way that the application shows up in the nRF connect interface in VS code?

    I believe that if you build with the command line once, and then open the application directory in VS Code, the NCS extension should pick up the existing build folder and use it as a build configuration.

    Best regards,
    Raoul

Reply
  • Hi,

    But how can I modify the way build is called from nrf Connect in VS code so that it does take this into account?

    This can be achieved when creating a build configuration (or editing an existing one). There is a field for "Extra CMake arguments" where you can add the -DSHIELD option you need. I know that this might not be obvious, since you usually only create a build config once and then forget about that screen.

    Note that you have to press the "OK" button for the argument to be saved!

    Perhaps one can build from command line in such a way that the application shows up in the nRF connect interface in VS code?

    I believe that if you build with the command line once, and then open the application directory in VS Code, the NCS extension should pick up the existing build folder and use it as a build configuration.

    Best regards,
    Raoul

Children
Related