Skip to content

Commit a1499c8

Browse files
[RPSDK-1387] Update eRPC for Zephyr 4.4
This commit update eRPC Zephyr port for Zephyr 4.4 version. Update: - Align to new MBOX API - Align to HW model v2 Signed-off-by: Tomas Galbicka <tomas.galbicka@nxp.com>
1 parent c1f7eb0 commit a1499c8

46 files changed

Lines changed: 69 additions & 227 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
### Updated
13+
14+
- eRPC Zephyr module port updated for Zephyr version 4.4
15+
1216
### Fixed
1317
- Python code of the eRPC infrastructure was updated to match the proper python code style, add type annotations and improve readability.
1418
- eRPC: Several MISRA violations addressed.

erpc_c/setup/erpc_setup_mbox_zephyr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 NXP
2+
* Copyright 2023-2026 NXP
33
*
44
*
55
* SPDX-License-Identifier: BSD-3-Clause
@@ -33,14 +33,14 @@ erpc_transport_t erpc_transport_zephyr_mbox_init(void *dev, void *tx_channel, vo
3333
}
3434
else
3535
{
36-
s_transport.construct((struct device *)dev, (struct mbox_channel *)tx_channel,
37-
(struct mbox_channel *)rx_channel);
36+
s_transport.construct((struct device *)dev, (struct mbox_dt_spec *)tx_channel,
37+
(struct mbox_dt_spec *)rx_channel);
3838
mboxTransport = s_transport.get();
3939
}
4040

4141
#elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
4242
mboxTransport =
43-
new MBOXTransport((struct device *)dev, (struct mbox_channel *)tx_channel, (struct mbox_channel *)rx_channel);
43+
new MBOXTransport((struct device *)dev, (struct mbox_dt_spec *)tx_channel, (struct mbox_dt_spec *)rx_channel);
4444
#else
4545
#error "Unknown eRPC allocation policy!"
4646
#endif

erpc_c/transports/erpc_mbox_zephyr_transport.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 NXP
2+
* Copyright 2023-2026 NXP
33
*
44
*
55
* SPDX-License-Identifier: BSD-3-Clause
@@ -23,7 +23,7 @@ RING_BUF_DECLARE(s_rxRingBuffer, MBOX_BUFFER_SIZE);
2323
// Code
2424
////////////////////////////////////////////////////////////////////////////////
2525

26-
MBOXTransport::MBOXTransport(struct device *dev, struct mbox_channel *tx_channel, struct mbox_channel *rx_channel) :
26+
MBOXTransport::MBOXTransport(struct device *dev, struct mbox_dt_spec *tx_channel, struct mbox_dt_spec *rx_channel) :
2727
m_dev(dev), m_tx_channel(tx_channel), m_rx_channel(rx_channel)
2828
#if !ERPC_THREADS_IS(NONE)
2929
,
@@ -60,13 +60,13 @@ static void mbox_callback(const struct device *dev, uint32_t channel, void *user
6060

6161
erpc_status_t MBOXTransport::init(void)
6262
{
63-
if (mbox_register_callback(m_rx_channel, mbox_callback, NULL))
63+
if (mbox_register_callback_dt(m_rx_channel, mbox_callback, NULL))
6464
{
6565
printk("mbox_register_callback() error\n");
6666
return kErpcStatus_InitFailed;
6767
}
6868

69-
if (mbox_set_enabled(m_rx_channel, 1))
69+
if (mbox_set_enabled_dt(m_rx_channel, true))
7070
{
7171
printk("mbox_set_enable() error\n");
7272
return kErpcStatus_InitFailed;
@@ -156,14 +156,14 @@ erpc_status_t MBOXTransport::send(MessageBuffer *message)
156156
txMsg.data = &txMsgSize;
157157
txMsg.size = sizeof(uint32_t);
158158

159-
mbox_send(m_tx_channel, &txMsg);
159+
mbox_send_dt(m_tx_channel, &txMsg);
160160

161161
while (txCntBytes < txMsgSize)
162162
{
163163
txMsg.data = &txBuffer[txCntBytes];
164164
txMsg.size = sizeof(uint32_t);
165165

166-
int mboxStatus = mbox_send(m_tx_channel, &txMsg);
166+
int mboxStatus = mbox_send_dt(m_tx_channel, &txMsg);
167167

168168
if (mboxStatus == -EBUSY)
169169
{

erpc_c/transports/erpc_mbox_zephyr_transport.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 NXP
2+
* Copyright 2023-2026 NXP
33
*
44
*
55
* SPDX-License-Identifier: BSD-3-Clause
@@ -48,7 +48,7 @@ class MBOXTransport : public Transport
4848
* @param[in] tx_channel Zephyr MBOX tx channel.
4949
* @param[in] rx_channel Zephyr MBOX rx channel.
5050
*/
51-
MBOXTransport(struct device *dev, struct mbox_channel *tx_channel, struct mbox_channel *rx_channel);
51+
MBOXTransport(struct device *dev, struct mbox_dt_spec *tx_channel, struct mbox_dt_spec *rx_channel);
5252

5353
/*!
5454
* @brief Destructor.
@@ -103,8 +103,8 @@ class MBOXTransport : public Transport
103103

104104
protected:
105105
struct device *m_dev; /*!< Access structure of the MBOX device */
106-
struct mbox_channel *m_tx_channel;
107-
struct mbox_channel *m_rx_channel;
106+
struct mbox_dt_spec *m_tx_channel;
107+
struct mbox_dt_spec *m_rx_channel;
108108

109109
volatile bool m_isTransferReceiveCompleted = false;
110110
volatile uint32_t m_transferReceiveRequireBytes = 0;

examples/zephyr/matrix_multiply_mbox/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2023-2024 NXP
2+
# Copyright 2023-2026 NXP
33
#
44
# SPDX-License-Identifier: BSD-3-Clause
55
#
@@ -10,9 +10,9 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1010

1111
set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr)
1212

13-
if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR
14-
("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR
15-
("${BOARD}" STREQUAL "mimxrt1160_evk_cm7"))
13+
if(("${BOARD}" STREQUAL "mimxrt1170_evkb") OR
14+
("${BOARD}" STREQUAL "mimxrt1170_evk") OR
15+
("${BOARD}" STREQUAL "mimxrt1160_evk"))
1616
message(STATUS "${BOARD} compile as Main in this sample")
1717
else()
1818
message(FATAL_ERROR "${BOARD} is not supported for this sample")
@@ -33,10 +33,10 @@ target_include_directories(app PRIVATE
3333
${PROJECT_SOURCE_DIR}/src/service
3434
)
3535

36-
target_sources(app PRIVATE
36+
target_sources(app PRIVATE
3737
${PROJECT_SOURCE_DIR}/src/main.cpp
3838
${PROJECT_SOURCE_DIR}/src/erpc_error_handler.cpp
39-
39+
4040
# Generated shim code
4141
${PROJECT_SOURCE_DIR}/src/service/c_erpc_matrix_multiply_client.cpp
4242
${PROJECT_SOURCE_DIR}/src/service/erpc_matrix_multiply_client.cpp
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2023-2024 NXP
2+
# Copyright 2023-2026 NXP
33
#
44
# SPDX-License-Identifier: BSD-3-Clause
55
#
@@ -8,6 +8,6 @@ source "share/sysbuild/Kconfig"
88

99
config REMOTE_BOARD
1010
string
11-
default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7"
12-
default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7"
13-
default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7"
11+
default "mimxrt1170_evk/mimxrt1176/cm4" if $(BOARD) = "mimxrt1170_evk"
12+
default "mimxrt1160_evk/mimxrt1166/cm4" if $(BOARD) = "mimxrt1160_evk"
13+
default "mimxrt1170_evkb/mimxrt1176/cm4" if $(BOARD) = "mimxrt1170_evkb"

examples/zephyr/matrix_multiply_mbox/boards/mimxrt1160_evk_cm7.conf renamed to examples/zephyr/matrix_multiply_mbox/boards/mimxrt1160_evk_mimxrt1166_cm7.conf

File renamed without changes.

examples/zephyr/matrix_multiply_mbox/boards/mimxrt1160_evk_cm7.overlay renamed to examples/zephyr/matrix_multiply_mbox/boards/mimxrt1160_evk_mimxrt1166_cm7.overlay

File renamed without changes.

examples/zephyr/matrix_multiply_mbox/boards/mimxrt1170_evk_cm7.conf

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/zephyr/matrix_multiply_mbox/boards/mimxrt1170_evkb_cm7.conf renamed to examples/zephyr/matrix_multiply_mbox/boards/mimxrt1170_evk_mimxrt1176_cm7.conf

File renamed without changes.

0 commit comments

Comments
 (0)