diff --git a/CHANGELOG.md b/CHANGELOG.md index cc29430..1ac1009 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ The git repository is hosted at the following site: * Changed gitignore to ignore the build folder. ### Added +* Added KERNEL_VERSION_MAJOR check in samples DTS overlay files to handle + changes in Zephyr OS version 4 * Added BACDL ZIGBEE and BSC datalink defines to Kconfig & CMakeLists.txt (#35) * Added baclog, you-are, who-am-i, create-object, delete-object, write-group, bramfs, bsramfs, and color-rgb modules to cmake. (#35) diff --git a/README.md b/README.md index e4ca9df..c0083ba 100644 --- a/README.md +++ b/README.md @@ -59,25 +59,36 @@ of the following ways: `west init -m https://github.com/bacnet-stack/bacnet-stack-zephyr --mr default $my_workspace` - - Note that as Zephyr OS versions change, their API often changes. - This library will use the following methods to accommodate the changes: - 1. Use defines from for API changes: - ``` - #if ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(4,2,0) - typedef uint64_t mgmt_event_t; - #else - typedef uint32_t mgmt_event_t; - #endif - ``` - 2. In CMakeLists.txt via trying to load specific versions of the Zephyr - package or checking using: - ``` - if ("${KERNEL_VERSION_STRING}" VERSION_GREATER_EQUAL "4.2.0") - # Do stuff... - endif() - ``` - 3. In Kconfig by using 2 above and trying to load specific versions - of the Zephyr plugin and updating CONF_FILE accordingly. +# Backward Compatible Samples and Applications + +Note that as Zephyr OS versions change, their API often changes. +This library will use the following methods to accommodate the changes: + +1. Use defines from for API changes: + ``` + #if ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(4,2,0) + typedef uint64_t mgmt_event_t; + #else + typedef uint32_t mgmt_event_t; + #endif + ``` +2. In CMakeLists.txt via trying to load specific versions of the Zephyr + package or checking using: + ``` + if ("${KERNEL_VERSION_STRING}" VERSION_GREATER_EQUAL "4.2.0") + # Do stuff... + endif() + ``` +3. In Kconfig by using 2 above and trying to load specific versions + of the Zephyr plugin and updating CONF_FILE accordingly. +4. In .dts, .dtsi or .overlay files, use KERNEL_VERSION_NUMBER or + KERNEL_VERSION_MAJOR defines. The C preprocessor is run on all + devicetree files to expand macro references. + ``` + #if KERNEL_VERSION_MAJOR < 4 + /delete-node/ &storage_partition; + #endif + ``` ## Hello BACnet Stack diff --git a/zephyr/samples/profiles/b-ld/boards/nucleo_f429zi.overlay b/zephyr/samples/profiles/b-ld/boards/nucleo_f429zi.overlay index f641893..9dddf9b 100644 --- a/zephyr/samples/profiles/b-ld/boards/nucleo_f429zi.overlay +++ b/zephyr/samples/profiles/b-ld/boards/nucleo_f429zi.overlay @@ -3,8 +3,9 @@ * * SPDX-License-Identifier: Apache-2.0 */ - +#if KERNEL_VERSION_MAJOR < 4 /delete-node/ &storage_partition; +#endif / { leds { diff --git a/zephyr/samples/profiles/b-ls/boards/nucleo_f429zi.overlay b/zephyr/samples/profiles/b-ls/boards/nucleo_f429zi.overlay index 518a5c1..6869691 100644 --- a/zephyr/samples/profiles/b-ls/boards/nucleo_f429zi.overlay +++ b/zephyr/samples/profiles/b-ls/boards/nucleo_f429zi.overlay @@ -3,8 +3,9 @@ * * SPDX-License-Identifier: Apache-2.0 */ - +#if KERNEL_VERSION_MAJOR < 4 /delete-node/ &storage_partition; +#endif &flash0 { partitions { diff --git a/zephyr/samples/profiles/b-sa/boards/nucleo_f429zi.overlay b/zephyr/samples/profiles/b-sa/boards/nucleo_f429zi.overlay index 518a5c1..6869691 100644 --- a/zephyr/samples/profiles/b-sa/boards/nucleo_f429zi.overlay +++ b/zephyr/samples/profiles/b-sa/boards/nucleo_f429zi.overlay @@ -3,8 +3,9 @@ * * SPDX-License-Identifier: Apache-2.0 */ - +#if KERNEL_VERSION_MAJOR < 4 /delete-node/ &storage_partition; +#endif &flash0 { partitions { diff --git a/zephyr/samples/profiles/b-ss/boards/nucleo_f429zi.overlay b/zephyr/samples/profiles/b-ss/boards/nucleo_f429zi.overlay index 4d93314..cc913ad 100644 --- a/zephyr/samples/profiles/b-ss/boards/nucleo_f429zi.overlay +++ b/zephyr/samples/profiles/b-ss/boards/nucleo_f429zi.overlay @@ -3,8 +3,9 @@ * * SPDX-License-Identifier: Apache-2.0 */ - +#if KERNEL_VERSION_MAJOR < 4 /delete-node/ &storage_partition; +#endif &flash0 { partitions {