zephyrproject-rtos / eclipse-plugin

Zephyr Eclipse Plugin
Eclipse Public License 2.0
16 stars 18 forks source link

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

Open stoberblog opened 4 years ago

stoberblog commented 4 years ago

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.

dcpleung commented 4 years ago

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

stoberblog commented 4 years ago

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.

dcpleung commented 4 years ago

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.