Date
1 - 4 of 4
override alias in test application
Bolivar, Marti
Hello,
toggle quoted messageShow quoted text
There's no need to open an issue. The alias should be named eeprom-0 in a DTS file, aliases { eeprom-0 = ...; }; but needs to be eeprom_0 (i.e. "lowercase-and-underscores" form) in C, because "-" is not part of a valid C identifier. For details, please see the DT_ALIAS documentation: https://docs.zephyrproject.org/latest/reference/devicetree/index.html#c.DT_ALIAS In particular, "Convert non-alphanumeric characters in the alias property to underscores to form valid C tokens, and lowercase all letters." Please see also this section in the troubleshooting section in the deviceetree HOWTOs: https://docs.zephyrproject.org/latest/guides/dts/howtos.html#make-sure-you-re-using-the-right-names Thanks, Marti Stefano Manni <stefano.manni@...> writes:
Hi Carles,
|
|
Stefano Manni
Hi Carles,
thanks, I managed like this: / { aliases { eeprom_0 = &eeprom0; }; }; but eeprom_0 is not a valid alias: dtlib.DTError: /aliases: alias property name 'eeprom_0' should include only characters from [0-9a-z-] may I open an issue? Stefano Il giorno mar 9 giu 2020 alle ore 10:27 Cufi, Carles <Carles.Cufi@...> ha scritto:
|
|
Carles Cufi
For properties there is /delete-property/ to delete one and then be able to override it.
In the case of an alias I am not sure, have you tried to override it directly? Carles On 08/06/2020, 19:31, "devel@... on behalf of Stefano Manni via lists.zephyrproject.org" <devel@... on behalf of stefano.manni=gmail.com@...> wrote: Hi there, I'm trying to compile test/drivers/eeprom for my board. I see that the code requires the alias 'eeprom_0' defined, but my board does not have it natively. I managed to compile changing in the test app some lines like below: - eeprom = device_get_binding(DT_LABEL(DT_ALIAS(eeprom_0))); + eeprom = device_get_binding(DT_LABEL(DT_NODELABEL(eeprom0))); where eeprom0 is defined in an overlay for my boards. But I'd prefer to use the alias and not change the app. What is the right way to override an alias in an overlay file? Sorry if my question is already addressed somewhere in documentation. Another consideration: is 'eeprom_0' a valid name? Alias properties should include only characters from [0-9a-z-]. May we need to fix it? Thanks, Stefano
|
|
Stefano Manni
Hi there,
I'm trying to compile test/drivers/eeprom for my board. I see that the code requires the alias 'eeprom_0' defined, but my board does not have it natively. I managed to compile changing in the test app some lines like below: - eeprom = device_get_binding(DT_LABEL(DT_ALIAS(eeprom_0))); + eeprom = device_get_binding(DT_LABEL(DT_NODELABEL(eeprom0))); where eeprom0 is defined in an overlay for my boards. But I'd prefer to use the alias and not change the app. What is the right way to override an alias in an overlay file? Sorry if my question is already addressed somewhere in documentation. Another consideration: is 'eeprom_0' a valid name? Alias properties should include only characters from [0-9a-z-]. May we need to fix it? Thanks, Stefano
|
|