forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
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
samples: subsys: ipc: basic: Basic cores communication #4
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
|
||
if(NOT CONFIG_BOARD_NRF54L15PDK_NRF54L15_CPUAPP) | ||
message(FATAL_ERROR "${BOARD} is not supported for this sample") | ||
endif() | ||
|
||
project(ipc_basic_host) | ||
|
||
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/common) | ||
|
||
target_sources(app PRIVATE src/main.c) | ||
|
||
include(ExternalProject) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
source "share/sysbuild/Kconfig" | ||
|
||
config REMOTE_BOARD | ||
string | ||
default "nrf54l15pdk/nrf54l15/cpuflpr" if $(BOARD) = "nrf54l15pdk" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,48 @@ | ||||||
.. zephyr:code-sample:: ipc-basic | ||||||
:name: IPC service: basic struct | ||||||
:relevant-api: ipc | ||||||
|
||||||
Send messages between two cores using mbox and shared data structure. | ||||||
|
||||||
Overview | ||||||
******** | ||||||
|
||||||
This application demonstrates how to communcate between cores without any backend in | ||||||
Zephyr. It is designed to demonstrate how to integrate it with Zephyr both | ||||||
from a build perspective and code. | ||||||
|
||||||
Building the application for nrf54l15pdk/nrf54l15/cpuapp | ||||||
***************************************************** | ||||||
|
||||||
.. zephyr-app-commands:: | ||||||
:zephyr-app: samples/subsys/ipc/basic | ||||||
:board: nrf54l15pdk/nrf54l15/cpuapp | ||||||
:goals: debug | ||||||
:west-args: --sysbuild | ||||||
|
||||||
Open a serial terminal (minicom, putty, etc.) and connect the board with the | ||||||
following settings: | ||||||
|
||||||
- Speed: 115200 | ||||||
- Data: 8 bits | ||||||
- Parity: None | ||||||
- Stop bits: 1 | ||||||
|
||||||
Reset the board and the following message will appear on the corresponding | ||||||
serial port, one is host another is remote: | ||||||
|
||||||
.. code-block:: console | ||||||
|
||||||
*** Booting Zephyr OS build v3.7.0-rc1-427-g7f891a6a40e8 *** | ||||||
I: No data from remote | ||||||
I: Sent 14 bytes to host | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I guess it should be remote, as it is the host's log. |
||||||
I: Read 14 bytes from remote, received 14 | ||||||
I: Basic core-communication HOST demo ended | ||||||
|
||||||
.. code-block:: console | ||||||
|
||||||
*** Booting Zephyr OS build v3.7.0-rc1-427-g7f891a6a40e8 *** | ||||||
I: No data from host | ||||||
I: Read 14 bytes from host, received 14 | ||||||
I: Sent 14 bytes to host | ||||||
I: Basic core-communication REMOTE demo ended |
36 changes: 36 additions & 0 deletions
36
samples/subsys/ipc/basic/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
soc { | ||
reserved-memory { | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
sram_rx: memory@20018000 { | ||
reg = <0x20018000 0x0800>; | ||
}; | ||
|
||
sram_tx: memory@20020000 { | ||
reg = <0x20020000 0x0800>; | ||
}; | ||
}; | ||
}; | ||
|
||
mbox_consumer { | ||
compatible = "vnd,mbox-consumer"; | ||
mboxes = <&cpuapp_vevif_rx 15>, <&cpuapp_vevif_tx 16>; | ||
mbox-names = "rx", "tx"; | ||
}; | ||
}; | ||
|
||
&cpuapp_vevif_rx { | ||
status = "okay"; | ||
}; | ||
|
||
&cpuapp_vevif_tx { | ||
status = "okay"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef __COMMON_H__ | ||
#define __COMMON_H__ | ||
|
||
#include <stdatomic.h> | ||
|
||
#define PACKET_SIZE_START (40) | ||
#define DATA_SIZE (128) | ||
#define SENDING_TIME_MS (1000) | ||
|
||
typedef struct __attribute__((packed)) { | ||
uint8_t some; | ||
uint16_t data; | ||
uint32_t to; | ||
uint32_t send; | ||
uint16_t trough; | ||
uint8_t ipc; | ||
} data_packet_t; | ||
|
||
typedef struct { | ||
atomic_bool lock; | ||
unsigned long size; | ||
unsigned char buffer[DATA_SIZE]; | ||
} shared_t; | ||
|
||
#endif /* __COMMON_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CONFIG_MBOX=y | ||
|
||
CONFIG_LOG=y | ||
CONFIG_LOG_MODE_MINIMAL=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# | ||
# Copyright (c) 2022 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(ipc_basic_remote) | ||
|
||
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common) | ||
|
||
target_sources(app PRIVATE src/main.c) |
36 changes: 36 additions & 0 deletions
36
samples/subsys/ipc/basic/remote/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
soc { | ||
reserved-memory { | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
sram_tx: memory@20018000 { | ||
reg = <0x20018000 0x0800>; | ||
}; | ||
|
||
sram_rx: memory@20020000 { | ||
reg = <0x20020000 0x0800>; | ||
}; | ||
}; | ||
}; | ||
|
||
mbox_consumer { | ||
compatible = "vnd,mbox-consumer"; | ||
mboxes = <&cpuflpr_vevif_rx 16>, <&cpuflpr_vevif_tx 15>; | ||
mbox-names = "rx", "tx"; | ||
}; | ||
}; | ||
|
||
&cpuflpr_vevif_rx { | ||
status = "okay"; | ||
}; | ||
|
||
&cpuflpr_vevif_tx { | ||
status = "okay"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CONFIG_MBOX=y | ||
|
||
CONFIG_LOG=y | ||
CONFIG_LOG_MODE_MINIMAL=y | ||
|
||
CONFIG_MULTITHREADING=n |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.