-
Notifications
You must be signed in to change notification settings - Fork 8k
ZBus: Multi-domain support #96086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
ZBus: Multi-domain support #96086
Conversation
Hello @Trond-F-Christiansen, and thank you very much for your first pull request to the Zephyr project! |
3bf34bd
to
eea4c3f
Compare
eea4c3f
to
e75325d
Compare
ab3bc41
to
1f20007
Compare
5f866d1
to
36e4902
Compare
Add a new API function zbus_chan_from_name() that allows retrieving a zbus channel by its name string. This complements the existing zbus_chan_from_id() function and provides more flexibility for channel lookup operations. The function performs a linear search through all channels using STRUCT_SECTION_FOREACH and compares channel names using strcmp(). It returns NULL if no matching channel is found, maintaining consistency with the existing zbus_chan_from_id() API. The implementation is conditionally compiled when CONFIG_ZBUS_CHANNEL_NAME is enabled, ensuring it's only available when channel names are configured in the system. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add core multidomain support to ZBus, enabling communication between separate domains. This includes: - New shadow channel concept with is_shadow_channel flag - ZBUS_SHADOW_CHAN_DEFINE macros for defining shadow channels - ZBUS_MULTIDOMAIN_CHAN_DEFINE for conditional channel definitions - ZBUS_CHANNEL_IS_SHADOW macro for checking shadow status - ZBUS_CHANNEL_IS_MASTER macro for checking master status - zbus_chan_pub_shadow() for internal shadow channel publishing - Protection against publishing to shadow channels from application code - Configuration options for multidomain support Shadow channels represent channels defined in other domains, allowing observation without direct publishing. The multidomain macros enable shared channel definitions that create master channels in one domain and shadow channels in others. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add the type definitions and API framework for ZBus multidomain proxy agents. This provides the foundation for backend-agnostic communication between domains. - Define zbus_multidomain_type enum for different backends - Add zbus_proxy_agent_msg structure for inter-domain messages - Create zbus_proxy_agent_api for backend abstraction - Add zbus_proxy_agent_config for agent configuration - Implement core proxy agent functions (init, send, thread) - Add retransmission logic - Add macro system for backend-specific configuration generation The proxy agent framework allows different communication backends (UART, IPC, etc.) to be plugged in using a common API interface. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Implement UART backend for ZBus multidomain communication, enabling message forwarding between domains over UART connections. - UART-specific configuration structure with async buffers - Error handling and UART recovery mechanisms - Integration with proxy agent framework via API structure - Configurable buffer count for UART operations - Schedule ACK sending as work to avoid blocking RX callback The UART backend uses async UART APIs for non-blocking communication and implements proper buffer cycling for continuous reception. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add sample application demonstrating ZBus multidomain communication over UART between two devices. Shows practical usage of shadow channels and proxy agents for inter-domain message forwarding. The sample consists of two devices: - Device A: Acts as request publisher with master request_channel - Device B: Acts as request listener/responder with shadow request_channel Device A publishes periodic requests which are automatically forwarded via UART to Device B. Device B processes requests and sends responses back through the response_channel, demonstrating bidirectional multidomain zbus communication. Key features demonstrated: - ZBUS_MULTIDOMAIN_CHAN_DEFINE for shared conditional channel definitions - ZBUS_PROXY_AGENT_DEFINE for UART backend configuration - Shadow vs master channel behavior - Automatic message forwarding via proxy agents Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Implement IPC backend for ZBus multidomain communication, enabling message forwarding between domains over IPC connections. - IPC-spesific configuration structures - Integration with proxy agent framework via API structure and macros - Schedule ACK sending as work to avoid blocking in interrupt context The IPC backend uses Zephyr's IPC service for inter-core communication with async operation and proper endpoint binding using semaphore synchronization for reliable zbus message forwarding. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add sample application demonstrating ZBus multidomain communication over IPC between CPU cores. Shows practical usage of shadow channels and proxy agents for inter-core message forwarding. The sample consists of two applications: - CPUAPP: Acts as request publisher with master request_channel - CPURAD: Acts as request listener/responder with shadow request_channel CPUAPP publishes periodic requests which are automatically forwarded via IPC to CPURAD. CPURAD processes requests and sends responses back through the response_channel, demonstrating bidirectional multidomain zbus communication. Key features demonstrated: - ZBUS_MULTIDOMAIN_CHAN_DEFINE for shared conditional channel definitions - ZBUS_PROXY_AGENT_DEFINE for IPC backend configuration - Shadow vs master channel behavior across CPU cores - Automatic message forwarding via proxy agents - Sysbuild configuration for multi-core applications Supports nRF5340DK and nRF54H20DK platforms with appropriate device tree overlays for IPC configuration. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add tests to verify the zbus_chan_from_name() functionality when CONFIG_ZBUS_CHANNEL_NAME is enabled. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add test suite to verify the shadow channel functionality when CONFIG_ZBUS_MULTIDOMAIN is enabled. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add comprehensive test suite for the zbus multidomain proxy agent functionality. Implements a mock backend to enable isolated testing without requiring actual hardware communication. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add comprehensive test suite for the zbus multidomain IPC backend. The implementation includes a mock IPC backend to enable isolated testing without requiring actual hardware communication between cores. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add comprehensive test suite for the zbus multidomain UART backend. The implementation uses UART emulator devices to enable testing without requiring physical UART hardware. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Adds support for running the Zbus IPC forwarder sample on the nrf5340bsim simulation platform to enable development and CI without physical hardware. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Adds sample.yaml with test definitions for the IPC forwarder sample, enabling testing using console harness with output validation. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
Add documentation for the multi-domain zbus feature, and multi-domain zbus samples. Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
36e4902
to
5fb5bc8
Compare
|
This PR introduces multi-domain support for ZBus, enabling message forwarding between domains.
A reserved channel type used for observing channels originating in other domains.
Background processes that forward messages between domains. Handles message forwarding, receiving, acknowledgments, and publishing to shadow channels.
Fixes #94857