Re: issues with devicetree in 2.2


Bolivar, Marti
 

"Trevor Clarke via lists.zephyrproject.org"
<pythonpimp=gmail.com@lists.zephyrproject.org> writes:

'm using Zephyr 2.2 for stm32 through platformio. I'm trying to use the
newer device tree API to configure hardware through an overlay.
I've got an overlay with:

&usart3 { current-speed = <31250>; };
/ { aliases { midi-port = &usart2; }; };

In devicetree_unfixed.h I get defines like DT_ALIAS_MIDI_PORT_BASE_ADDRESS
so I know my overlay is being processed.

In my C code I do:

#define MIDI_DEV DT_ALIAS(midi_port)
...
struct device* midiin = device_get_binding(MIDI_DEV);
In the zephyr master branch, it would be DT_LABEL(MIDI_DEV).

https://docs.zephyrproject.org/latest/guides/dts/howtos.html#get-a-struct-device-from-a-devicetree-node

However: this won't work in 2.2.



When I compile (complete clean and rebuild which re-runs cmake, etc.) I see:

warning: implicit declaration of function 'DT_ALIAS';

A search through my build artifacts and through the zephyr source shows no
definie for DT_ALIAS. I'm following the examples in the documentation. Am I
missing something?
This new DT API is only in the master branch, not Zephyr 2.2.

Since you're on 2.2, use the old API:

https://docs.zephyrproject.org/2.2.0/guides/dts/index.html

HTH,
Marti


--
Trevor R.H. Clarke
Computer Science House
Rochester Institute of Technology
retrev@csh.rit.edu
http://www.csh.rit.edu/~retrev/

Join users@lists.zephyrproject.org to automatically receive all group messages.