'Is it possible to have arbitrary data in a zephyr device tree node?
I'd like to use the device tree to store some system level constants.
Is it possible to store and retrieve arbitrary values from the device tree?
Attempting to load these values fails to compile as build/zephyr/include/generated/devicetree_unfixed.h lacks the values for 'custom-num' or 'another-value'.
...
int custom_num = DT_PROP(DT_PATH(settings), custom_num);
printf("custom_num %d\n", custom_num);
...
...
zephyr/include/devicetree.h:81:17: error: 'DT_N_S_settings_P_custom_num' undeclared (first use in this function)
81 | #define DT_ROOT DT_N
| ^~~~
...
The devicetree overlay file:
/* SPDX-License-Identifier: Apache-2.0 */
/ {
aliases {
someuart-uart = &uart7;
};
settings {
custom-num = < 29992 >;
another-value = "some string";
};
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
