eclipse-plugin icon indicating copy to clipboard operation
eclipse-plugin copied to clipboard

Device Tree (board file) Expanding - Eclipse currently blocking out code wrong

Open stoberblog opened this issue 5 years ago • 3 comments

Hi,

I'm new to Zephyr, so this may already be possible, but I'm wondering if the device tree can be expanded, using the board file.

My example use case is I started a project using the "samples/basic/button/" sample, and with the "nrf51dk_nrf51422" board, however, the preprocessor line #if DT_NODE_HAS_STATUS(SW0_NODE, okay), is failing and thus eclipse has blocked out sections of code, which is incorrect (it compiles fine, and I know sw0 is in board file). Device Tree Expansion Failure

For background details, I'm using Eclipse 2020-06, newest plugin (I downloaded from the marketplace), Windows 10, latest Zephyr (downloaded today).

Thanks in advance.

stoberblog avatar Aug 19 '20 07:08 stoberblog

Have you tried re-building the index after building the project? This might fix the issue.

dcpleung avatar Aug 19 '20 16:08 dcpleung

Alas that hasn't helped. Also I flashed the build onto the dev board (nRF51-DK) and works properly, thus compiling is definitely setting the SW0_* values correctly.

stoberblog avatar Aug 19 '20 23:08 stoberblog

The code parser uses pre-processed source files produced by the toolchain, where those device tree macros should have been expanded. So it is possible that the pre-processed files cannot be parsed by Eclipse correctly. Let me take a look.

dcpleung avatar Aug 20 '20 08:08 dcpleung