我想使用设备树来存储一些系统级常量。
是否可以从设备树中存储和检索任意值?
尝试加载这些值无法编译,因为 build/zephyr/include/generated/devicetree_unfixed.h 缺少“custom-num”或“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
| ^~~~
...
设备树覆盖文件:
/* SPDX-License-Identifier: Apache-2.0 */
/ {
aliases {
someuart-uart = &uart7;
};
settings {
custom-num = < 29992 >;
another-value = "some string";
};
};