zephyr/subsys/zbus/CMakeLists.txt

12 lines
234 B
CMake
Raw Normal View History

# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(zbus.c)
zbus: improve the way of storing observers ZBus stores observers in two ways: statically using a list and dynamically using a memory slab. Both present limitations. Static observers work only for channel definition. The dynamic observers rely on a memory slab that forces the user to manage its size to avoid issues with adding observers. This commit fixes the static allocation problem by using the iterable sections for allocating observation data and replacing the VDED execution sequence since now it is possible to prioritize static observer execution. All the runtime observers are dynamically allocated on the heap instead of a specific memory pool. BREAK changes (only internal, not APIs): * ZBus channel metadata changed. Remove the observers' static array pointer. Rename the `runtime_observers` pointer to `observers`. Add `observer_start_idx` and `observer_end_idx`; * Change the VDED execution sequence. The position (on definition time), the priority in conjunction with the lexical order, is considered for static post-definition time observers. At last, the runtime observer follows the adding sequence; * Replace the `CONFIG_ZBUS_RUNTIME_OBSERVERS_POOL_SIZE` with `CONFIG_ZBUS_RUNTIME_OBSERVERS`. New APIs: * New iterable section iterators (for channels and observers) can now receive a user_data pointer to keep context between the function calls; * New `ZBUS_LISTENER_DEFINE_WITH_ENABLE(_name, _cb, _enable)` and `ZBUS_SUBSCRIBER_DEFINE_WITH_ENABLE(_name, _queue_size, enable)` that enable developers define disabled observers. They need to be enabled during runtime to receive notifications from the bus; * `ZBUS_CHAN_ADD_OBS` macro for adding post-definition static observers of a channel. Important changes: * Move the ZBus LD file content to the `common-ram.ld` LD file. That was necessary to make ZBus compatible with some Xtensa and RISCV boards. Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2023-07-22 23:55:48 +08:00
if(CONFIG_ZBUS_RUNTIME_OBSERVERS)
zephyr_library_sources(zbus_runtime_observers.c)
endif()
zbus: improve the way of storing observers ZBus stores observers in two ways: statically using a list and dynamically using a memory slab. Both present limitations. Static observers work only for channel definition. The dynamic observers rely on a memory slab that forces the user to manage its size to avoid issues with adding observers. This commit fixes the static allocation problem by using the iterable sections for allocating observation data and replacing the VDED execution sequence since now it is possible to prioritize static observer execution. All the runtime observers are dynamically allocated on the heap instead of a specific memory pool. BREAK changes (only internal, not APIs): * ZBus channel metadata changed. Remove the observers' static array pointer. Rename the `runtime_observers` pointer to `observers`. Add `observer_start_idx` and `observer_end_idx`; * Change the VDED execution sequence. The position (on definition time), the priority in conjunction with the lexical order, is considered for static post-definition time observers. At last, the runtime observer follows the adding sequence; * Replace the `CONFIG_ZBUS_RUNTIME_OBSERVERS_POOL_SIZE` with `CONFIG_ZBUS_RUNTIME_OBSERVERS`. New APIs: * New iterable section iterators (for channels and observers) can now receive a user_data pointer to keep context between the function calls; * New `ZBUS_LISTENER_DEFINE_WITH_ENABLE(_name, _cb, _enable)` and `ZBUS_SUBSCRIBER_DEFINE_WITH_ENABLE(_name, _queue_size, enable)` that enable developers define disabled observers. They need to be enabled during runtime to receive notifications from the bus; * `ZBUS_CHAN_ADD_OBS` macro for adding post-definition static observers of a channel. Important changes: * Move the ZBus LD file content to the `common-ram.ld` LD file. That was necessary to make ZBus compatible with some Xtensa and RISCV boards. Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2023-07-22 23:55:48 +08:00
zephyr_library_sources(zbus_iterable_sections.c)