-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Standardize labels (string device names) used for device binding #10938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@barsok ping |
This topic has already been discussed long time back. Problem is that vendors documents quite different names for their IPs. Though, dts could define aliases. They are already used in for leds and buttons:
I think this can be re-used for other devices to some extent. Not sure we can generalize this to all devices though. |
Hi @erwango , code that you pasted is what I would expect the OS to do. Create a mapping between the application and devices. In Linux if I open To show an example how simple it could be note that Zephyr OS could document that SoC vendor creating an UART driver must name UART in following way: This may not work for all devices obviously but there are some that can be obviously standardized: e.g. GPIO, LEDS or UART. |
Specifically: https://lists.zephyrproject.org/g/devel/message/42 @pdunaj, I like your approach, of 2 cases brought by you I've seen so far, 2 I tried to move forward before too. Definitely try to push them forward, you have my +10 on any good RFC you bring up. But as I already said elsewhere, a word of warning: "nobody cares". That's blatant oversimplification of course, more like "everybody cares in different direction, and all that with 800+ tickets/250+ patches (i.e. so many other topics to care about) open all the time". It's not a discouragement either - vice versa, a good "pep talk" that you should be ready to be very persistent, flexible, and not give up for a long time. |
Oh, and btw, last thing I heard is that "ascii device names" are to be gone. Calling @tbursztyka (with apology if I mixed up and I heard that from somebody else). |
@pfalcon Thanks ;) |
Thanks @pfalcon for the digging.
So, I think lot of arguments were exposed in the discussion, but let me highlight on one specific aspect. In any case, I advise using dt aliases, which should do the trick for most of the usages I think. EDIT: The discussion from the archives was mentioning "ever changing device naming", @pfaclcon, I know you spent much less time in micropython lately but, did you notice an evolution on that precise aspect? |
@erwango I agree that there are differences in the target audience. Still I expect that applications running on Zephyr will become more complex in the coming years. In the end if this would not be true there would be a little need for the OS. I think more and more people will move further away from HW as they will be less concerned about which pin to use and more about how to process data and provide a service to the customer. |
I was thinking about this with the recent jinja work. I think it might not be that difficult to provide a means to get the device object from a DT means w/o a string. I want to phase out label in DT, or at least using and requiring them the way we do. |
Note that we'll need "ascii device name" for POSIX subsystem (if we want to move it further along). I would be about ready to implement support for the following code:
|
Closing as labels are going to be deprecated, there are now alternative ways to obtain a device reference. |
To simplify OS API and allow cross platform application development it would be great if Zephyr defined a way in which device binding labels are set up.
At the moment there seem to be a mess with this. Let's take GPIO as an example.
Most SoCs have its label defined as
"GPIO_0"
the problem is that there is nothing in documentation that would say that using"GPIO_0"
for binding will work for every system. As such strings can be (and for some devices are) configurable which make them unreliable.On the other hand SoCs define dts fixups or specify labels that are macros pointing to the right name. This would be great solution but the name of label differs between SoC vendors. Zephyr does not define that to correctly bind to GPIO_0 you should use for example
MAGIC_MACRO_GPIO_0_LABEL
and on whatever platform you compile you will always get GPIO instance 0 as long as it is there.The text was updated successfully, but these errors were encountered: