Skip to content

Commit 270dfff

Browse files
mbolivar-nordicgalak
authored andcommitted
devicetree: add CONFIG_LEGACY_DEVICETREE_MACROS
This default-y option allows continued use of the legacy devicetree macros. There are no functional changes yet, but when this is default n, old-style DT code won't build. At that point, adding any of these will be a fix to keep old-style code working: - "CONFIG_LEGACY_DEVICETREE_MACROS=y" to prj.conf - "-- -DCONFIG_LEGACY_DEVICETREE_MACROS=y" to the west build command - "-DCONFIG_LEGACY_DEVICETREE_MACROS=y" to the cmake command This option can be changed to default n in time for the Zephyr 2.3 release. That will provide users of Zephyr 2.2 with a smooth migration path to the new devicetree.h API after 2.3 is released, which nonetheless will alert them immediately that something is wrong due to build errors. Unfortunately, __DEPRECATED_MACRO is not sufficient in all cases as a warning to users. This is because, at least in GCC, macros defined using __DEPRECATED_MACRO cannot be used in preprocessor lines like "#if DT_SOME_LEGACY_MACRO". Signed-off-by: Martí Bolívar <[email protected]>
1 parent 115d987 commit 270dfff

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

Kconfig.zephyr

+8
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,14 @@ config MAKEFILE_EXPORTS
348348
Generates a file with build information that can be read by
349349
third party Makefile-based build systems.
350350

351+
config LEGACY_DEVICETREE_MACROS
352+
bool "Allow use of legacy devicetree macros"
353+
default y
354+
help
355+
Allows use of legacy devicetree macros which were used in
356+
Zephyr 2.2 and previous versions, rather than the devicetree.h
357+
API introduced during the Zephyr 2.3 development cycle.
358+
351359
endmenu
352360
endmenu
353361

doc/releases/release-notes-2.3.rst

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ Deprecated in this release
7373
* nrf52_pca20020 has been renamed to thingy52_nrf52832
7474
* nrf5340_dk_nrf5340 has been renamed to nrf5340pdk_nrf5340
7575

76+
* Devicetree
77+
78+
* The C macros generated from devicetree. Use the new ``<devicetree.h>``
79+
accessor API instead; see :ref:`dt-guide` for details. Use of the legacy
80+
macros requires enabling :option:`CONFIG_LEGACY_DEVICETREE_MACROS`.
81+
7682
Removed APIs in this release
7783
============================
7884

include/devicetree.h

+12
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,20 @@
1616
#ifndef DEVICETREE_H
1717
#define DEVICETREE_H
1818

19+
#ifdef _LINKER
20+
/*
21+
* Linker scripts include this file too, and autoconf.h isn't
22+
* automatically included for those files the way it is for C source
23+
* files. Make sure we pull it in before using
24+
* CONFIG_LEGACY_DEVICETREE_MACROS in that case.
25+
*/
26+
#include <autoconf.h>
27+
#endif
28+
1929
#include <devicetree_unfixed.h>
30+
#ifdef CONFIG_LEGACY_DEVICETREE_MACROS
2031
#include <devicetree_legacy_unfixed.h>
32+
#endif
2133
#include <devicetree_fixups.h>
2234

2335
#include <sys/util.h>

0 commit comments

Comments
 (0)