Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ We welcome and encourage the community to submit patches directly to the eRPC pr
- [Examples](#examples)
- [References](#references)
- [Directories](#directories)
- [RT-Thread integration](#rt-thread-integration)
- [Building and installing](#building-and-installing)
- [Requirements](#requirements)
- [Windows](#windows)
Expand Down Expand Up @@ -297,10 +298,18 @@ This section provides links to interesting erpc-based projects, articles, blogs

[mk](/mk) - Contains common makefiles for building eRPC components.

[rtthread](/rtthread) - Contains RT-Thread Kconfig, SCons integration, and usage notes.

[test](/test) - Client/server tests. These tests verify the entire communications path from client to server and back.

[utilities](/utilities) - Holds utilities which bring additional benefit to eRPC apps developers.

## RT-Thread integration

The eRPC C runtime provides an RT-Thread threading backend and an RT-Thread UART transport.
RT-Thread package integration files are provided under [rtthread](/rtthread).
See [rtthread/README.md](/rtthread/README.md) for `menuconfig` and SCons integration steps.

## Building and installing

These build instructions apply to host PCs and embedded Linux. For bare metal or RTOS embedded environments, you should copy the [erpc_c](/erpc_c) directory into your application sources.
Expand Down
1 change: 1 addition & 0 deletions erpc_c/config/erpc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define ERPC_THREADS_MBED (4U) //!< Mbed OS
#define ERPC_THREADS_WIN32 (5U) //!< WIN32
#define ERPC_THREADS_THREADX (6U) //!< THREADX
#define ERPC_THREADS_RTTHREAD (7U) //!< RT-Thread.

#define ERPC_NOEXCEPT_DISABLED (0U) //!< Disabling noexcept feature.
#define ERPC_NOEXCEPT_ENABLED (1U) //!< Enabling noexcept feature.
Expand Down
3 changes: 3 additions & 0 deletions erpc_c/port/erpc_config_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@
#elif defined(ERPC_THREADS) && (ERPC_THREADS == ERPC_THREADS_MBED)
#include "platform/mbed_assert.h"
#define erpc_assert(condition) MBED_ASSERT(condition)
#elif defined(ERPC_THREADS) && (ERPC_THREADS == ERPC_THREADS_RTTHREAD)
#include <rtthread.h>
#define erpc_assert(condition) RT_ASSERT(condition)
#else
#ifdef __cplusplus
#include <cassert>
Expand Down
17 changes: 17 additions & 0 deletions erpc_c/port/erpc_port_rtthread.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* SPDX-License-Identifier: BSD-3-Clause
*/

#include "erpc_port.h"

#include <rtthread.h>

void *erpc_malloc(size_t size)
{
return rt_malloc(size);
}

void erpc_free(void *ptr)
{
rt_free(ptr);
}
30 changes: 25 additions & 5 deletions erpc_c/port/erpc_threading.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include "windows.h"
#elif ERPC_THREADS_IS(THREADX)
#include "tx_api.h"
#elif ERPC_THREADS_IS(RTTHREAD)
#include <rtthread.h>

#endif // ERPC_THREADS

Expand Down Expand Up @@ -164,6 +166,8 @@ class Thread
return reinterpret_cast<thread_id_t>(m_thread);
#elif ERPC_THREADS_IS(THREADX)
return reinterpret_cast<thread_id_t>(m_thread.tx_thread_id);
#elif ERPC_THREADS_IS(RTTHREAD)
return reinterpret_cast<thread_id_t>(m_thread);
#endif
}

Expand All @@ -186,6 +190,8 @@ class Thread
return reinterpret_cast<thread_id_t>(GetCurrentThread());
#elif ERPC_THREADS_IS(THREADX)
return reinterpret_cast<thread_id_t>(tx_thread_identify());
#elif ERPC_THREADS_IS(RTTHREAD)
return reinterpret_cast<thread_id_t>(rt_thread_self());
#endif
}

Expand Down Expand Up @@ -232,9 +238,9 @@ class Thread
static pthread_key_t s_threadObjectKey; /*!< Thread key. */
pthread_t m_thread; /*!< Current thread. */
#elif ERPC_THREADS_IS(FREERTOS)
TaskHandle_t m_task; /*!< Current task. */
Thread *m_next; /*!< Pointer to next Thread. */
static Thread *s_first; /*!< Pointer to first Thread. */
TaskHandle_t m_task; /*!< Current task. */
Thread *m_next; /*!< Pointer to next Thread. */
static Thread *s_first; /*!< Pointer to first Thread. */
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
StaticTask_t m_staticTask; /*!< Hold static task data. */
#endif
Expand All @@ -257,6 +263,8 @@ class Thread
TX_THREAD m_thread; /*!< Underlying Thread instance */
Thread *m_next; /*!< Pointer to next Thread. */
static Thread *s_first; /*!< Pointer to first Thread. */
#elif ERPC_THREADS_IS(RTTHREAD)
rt_thread_t m_thread; /*!< Current thread. */
#endif

#if ERPC_THREADS_IS(PTHREADS)
Expand Down Expand Up @@ -312,6 +320,14 @@ class Thread
* @param[in] arg Thread to execute.
*/
static void threadEntryPointStub(ULONG arg);
#elif ERPC_THREADS_IS(RTTHREAD)

/*!
* @brief This function execute threadEntryPoint function.
*
* @param[in] arg Thread to execute.
*/
static void threadEntryPointStub(void *arg);
#endif

private:
Expand Down Expand Up @@ -413,11 +429,13 @@ class Mutex
#elif ERPC_THREADS_IS(ZEPHYR)
struct k_mutex m_mutex; /*!< Mutex.*/
#elif ERPC_THREADS_IS(MBED)
rtos::Mutex *m_mutex; /*!< Mutex. */
rtos::Mutex *m_mutex; /*!< Mutex. */
#elif ERPC_THREADS_IS(WIN32)
HANDLE m_mutex;
#elif ERPC_THREADS_IS(THREADX)
TX_MUTEX m_mutex;
#elif ERPC_THREADS_IS(RTTHREAD)
struct rt_mutex m_mutex; /*!< Mutex. */
#endif

private:
Expand Down Expand Up @@ -499,7 +517,7 @@ class Semaphore
SemaphoreHandle_t m_sem; /*!< Semaphore. */
StaticSemaphore_t m_staticQueue; /*!< Static queue. */
#elif ERPC_THREADS_IS(ZEPHYR)
struct k_sem m_sem; /*!< Semaphore. */
struct k_sem m_sem; /*!< Semaphore. */
#elif ERPC_THREADS_IS(MBED)
rtos::Semaphore *m_sem; /*!< Semaphore. */
int m_count; /*!< Semaphore count number. */
Expand All @@ -509,6 +527,8 @@ class Semaphore
HANDLE m_sem;
#elif ERPC_THREADS_IS(THREADX)
TX_SEMAPHORE m_sem; /*!< Semaphore. */
#elif ERPC_THREADS_IS(RTTHREAD)
struct rt_semaphore m_sem; /*!< Semaphore. */
#endif

private:
Expand Down
Loading