Skip to content

Commit

Permalink
eRPC updates 01/2021
Browse files Browse the repository at this point in the history
-- Update/correct erpc README.md.
-- Several MISRA C-2012 violations addressed.
-- Add missing GPIO-less support into the erpc DSPI transport layer to be aligned with the SPI transport.
  • Loading branch information
MichalPrincNXP committed Jan 5, 2021
1 parent 99afd49 commit 6a571ca
Show file tree
Hide file tree
Showing 38 changed files with 294 additions and 121 deletions.
44 changes: 32 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Client side usage:
void example_client(void) {
// Initialize client running over UART.
erpc_client_init(
erpc_transport_cmsis_uart_init(Driver_USART0);
erpc_transport_cmsis_uart_init(Driver_USART0),
erpc_mbf_dynamic_init());
// Now we can call the remote function to turn on the green LED.
set_led(kGreen, true);
Expand All @@ -43,7 +44,8 @@ void set_led(LEDName whichLed, bool onOrOff) {
void example_server(void) {
// Initialize server running over UART.
erpc_server_init(
erpc_transport_cmsis_uart_init(Driver_USART0);
erpc_transport_cmsis_uart_init(Driver_USART0),
erpc_mbf_dynamic_init());
// Add the IO service.
erpc_add_service_to_server(create_IO_service());
Expand All @@ -61,20 +63,32 @@ Supported transports:
* NXP Kinetis SPI and DSPI
* POSIX and Windows serial port
* TCP/IP (mostly for testing)
* [NXP RPMsg-Lite](https://github.com/NXPmicro/rpmsg-lite)
* [NXP RPMsg-Lite / RPMsg TTY](https://github.com/NXPmicro/rpmsg-lite)
* SPIdev Linux
* USB CDC
* NXP Messaging Unit

eRPC is available with an unrestrictive BSD 3-clause license. See the LICENSE file for the full license text.
eRPC is available with an unrestrictive BSD 3-clause license. See the [LICENSE file](https://github.com/EmbeddedRPC/erpc/blob/develop/LICENSE) for the full license text.

## Releases

[eRPC releases](https://github.com/EmbeddedRPC/erpc/releases)

## Documentation

[Documentation](https://github.com/EmbeddedRPC/erpc/wiki) is in the `wiki` section. Commit sha in wiki repository: 431cba8.
[Documentation](https://github.com/EmbeddedRPC/erpc/wiki) is in the `wiki` section.

[eRPC Infrastructure documentation](https://embeddedrpc.github.io/)

## Examples

[Example IDL](examples/README.md) is available in the `examples/` folder.

Plenty of eRPC multicore and multiprocessor examples can be also found in NXP MCUXpressoSDK packages. Visit [https://mcuxpresso.nxp.com](https://mcuxpresso.nxp.com) to configure, build and download these packages.<br>
To get the board list with multicore support (eRPC included) use filtering based on Middleware and search for 'multicore' string. Once the selected package with the multicore middleware is downloaded, see<br>
<MCUXpressoSDK_install_dir>/boards/<board_name>/multicore_examples for eRPC multicore examples (RPMsg_Lite or Messaging Unit transports used) or<br>
<MCUXpressoSDK_install_dir>/boards/<board_name>/multiprocessor_examples for eRPC multiprocessor examples (UART or SPI transports used).<br>
eRPC examples use 'erpc_' name prefix.

## Directories

Expand All @@ -88,12 +102,16 @@ eRPC is available with an unrestrictive BSD 3-clause license. See the LICENSE fi

`erpcgen` - Holds source code for erpcgen and makefiles or project files to build erpcgen on Windows, Linux, and OS X.

`erpcsniffer` - Holds source code for erpcsniffer application.

`examples` - Several example IDL files.

`mk` - Contains common makefiles for building eRPC components.

`test` - Client/server tests. These tests verify the entire communications path from client to server and back.

`utilities` - Holds utilities which bring additional benefit to eRPC apps developers.


## Building and installing

Expand All @@ -117,11 +135,11 @@ Steps are described in [`erpcgen/VisualStudio_v14/readme_erpcgen.txt`](erpcgen/V
Install these packages:
* bison: GNU yacc-compatible parser generator
* flex: A fast lexical analyzer generator
* libboost-dev, libboost-filesystem-dev, libboost-system-dev: Boost C++ libraries (Linux needs to use libboost version 1.67.0)
* libboost-dev, libboost-filesystem-dev, libboost-system-dev: Boost C++ libraries (Linux needs to use libboost version 1.65.0)
* make: the GNU version of the 'make' utility
* python: Python language interpreter (either 2.7 or 3.5+ work)
* gcc-core: GNU Compiler Collection (C, OpenMP)
* gcc-g++: GNU Compiler Collection (C++)
* gcc-7: GNU C compiler (recommended version)
* g++-7: GNU C++ compiler (recommended version)

Mandatory for case, when build for different architecture is needed
* gcc-multilib, g++-multilib
Expand All @@ -130,9 +148,9 @@ Mandatory for case, when build for different architecture is needed
#### Mac OS X

Install these packages with [homebrew](http://brew.sh/):
* bison: GNU yacc-compatible parser generator
* flex: A fast lexical analyzer generator
* boost: Boost C++ libraries
* bison: GNU yacc-compatible parser generator (version 3.7.3 is recommended)
* flex: A fast lexical analyzer generator (version 2.6.4 is recommended)
* boost: Boost C++ libraries (version 1.74 is recommended)

### Building

Expand All @@ -157,6 +175,8 @@ List of top level Makefile targets:
- `all`: build all of the above
- `install`: install liberpc.a, erpcgen, and include files

eRPC code is validated with respect to the C++ 11 standard.

### Installing for Python

To install the Python infrastructure for eRPC, first change to the `erpc_python/` directory. Then run the setup.py script like this:
Expand All @@ -165,7 +185,7 @@ To install the Python infrastructure for eRPC, first change to the `erpc_python/

After installation, the `erpc` package is available via normal import statements. See the [erpc_python folder readme](erpc_python/readme.md) for more.

## Code providing:
## Code providing

Repository on Github contains two main branches. __Master__ and __develop__. Code is developed on __develop__ branch. Release version is created via merging __develop__ branch into __master__ branch.

Expand Down
4 changes: 2 additions & 2 deletions erpc_c/config/erpc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@
//! Uncomment to change the size of buffers allocated by one of MessageBufferFactory.
//! (@ref client_setup and @ref server_setup). The default size is set to 256.
//! For RPMsg transport layer, ERPC_DEFAULT_BUFFER_SIZE must be 2^n - 16.
//#define ERPC_DEFAULT_BUFFER_SIZE (256)
//#define ERPC_DEFAULT_BUFFER_SIZE (256U)

//! @def ERPC_DEFAULT_BUFFERS_COUNT
//!
//! Uncomment to change the count of buffers allocated by one of statically allocated messages.
//! Default value is set to 2.
//#define ERPC_DEFAULT_BUFFERS_COUNT (2)
//#define ERPC_DEFAULT_BUFFERS_COUNT (2U)

//! @def ERPC_NOEXCEPT
//!
Expand Down
4 changes: 2 additions & 2 deletions erpc_c/infra/erpc_client_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ class ClientManager : public ClientServerCommon
Codec *createBufferAndCodec(void);

private:
ClientManager(const ClientManager &); //!< Disable copy ctor.
ClientManager &operator=(const ClientManager &); //!< Disable copy ctor.
ClientManager(const ClientManager &other); //!< Disable copy ctor.
ClientManager &operator=(const ClientManager &other); //!< Disable copy ctor.
};

/*!
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/infra/erpc_client_server_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ClientServerCommon
#define ERPC_OTHER_INHERITANCE 1
:
#endif
PrePostAction()
PrePostAction(void)
#endif
{};

Expand Down
8 changes: 4 additions & 4 deletions erpc_c/infra/erpc_framed_transport.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* Copyright 2016-2020 NXP
* All rights reserved.
*
*
Expand All @@ -22,7 +22,7 @@ using namespace erpc;
FramedTransport::FramedTransport(void)
: Transport()
, m_crcImpl(NULL)
#if ERPC_THREADS
#if !ERPC_THREADS_IS(NONE)
, m_sendLock()
, m_receiveLock()
#endif
Expand All @@ -43,7 +43,7 @@ erpc_status_t FramedTransport::receive(MessageBuffer *message)
Header h;

{
#if ERPC_THREADS
#if !ERPC_THREADS_IS(NONE)
Mutex::Guard lock(m_receiveLock);
#endif

Expand Down Expand Up @@ -88,7 +88,7 @@ erpc_status_t FramedTransport::receive(MessageBuffer *message)
erpc_status_t FramedTransport::send(MessageBuffer *message)
{
assert(m_crcImpl && "Uninitialized Crc16 object.");
#if ERPC_THREADS
#if !ERPC_THREADS_IS(NONE)
Mutex::Guard lock(m_sendLock);
#endif

Expand Down
6 changes: 3 additions & 3 deletions erpc_c/infra/erpc_framed_transport.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* Copyright 2016-2020 NXP
* All rights reserved.
*
*
Expand All @@ -16,7 +16,7 @@

#include <cstring>

#if ERPC_THREADS
#if !ERPC_THREADS_IS(NONE)
#include "erpc_threading.h"
#endif

Expand Down Expand Up @@ -111,7 +111,7 @@ class FramedTransport : public Transport
protected:
Crc16 *m_crcImpl; /*!< CRC object. */

#if ERPC_THREADS
#if !ERPC_THREADS_IS(NONE)
Mutex m_sendLock; //!< Mutex protecting send.
Mutex m_receiveLock; //!< Mutex protecting receive.
#endif
Expand Down
6 changes: 3 additions & 3 deletions erpc_c/infra/erpc_pre_post_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PrePostAction
/*!
* @brief PrePostAction constructor.
*/
PrePostAction()
PrePostAction(void)
: m_preCB(NULL)
, m_postCB(NULL){};

Expand All @@ -67,14 +67,14 @@ class PrePostAction
*
* @return preCB Pointer for callback function.
*/
pre_post_action_cb getPreCB() { return m_preCB; }
pre_post_action_cb getPreCB(void) { return m_preCB; }

/*!
* @brief This function returns "after eRPC call finish" callback function.
*
* @return postCB Pointer for callback function.
*/
pre_post_action_cb getPostCB() { return m_postCB; }
pre_post_action_cb getPostCB(void) { return m_postCB; }

/*!
* @brief PrePostAction destructor
Expand Down
1 change: 1 addition & 0 deletions erpc_c/infra/erpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ using namespace erpc;
////////////////////////////////////////////////////////////////////////////////

#if ERPC_NESTED_CALLS_DETECTION
extern bool nestingDetection;
bool nestingDetection = false;
#endif

Expand Down
4 changes: 2 additions & 2 deletions erpc_c/infra/erpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ class Server : public ClientServerCommon

private:
// Disable copy ctor.
Server(const Server &); /*!< Disable copy ctor. */
Server &operator=(const Server &); /*!< Disable copy ctor. */
Server(const Server &other); /*!< Disable copy ctor. */
Server &operator=(const Server &other); /*!< Disable copy ctor. */
};

} // namespace erpc
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/infra/erpc_simple_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ erpc_status_t SimpleServer::runInternalBegin(Codec **codec, MessageBuffer &buff,
erpc_status_t err = m_transport->receive(&buff);

#if ERPC_PRE_POST_ACTION
pre_post_action_cb preCB = this->getPreCB();
pre_post_action_cb preCB = this->getPreCB(void);
if (preCB)
{
preCB();
Expand Down
4 changes: 2 additions & 2 deletions erpc_c/port/erpc_config_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
// Set default buffer size.
#if !defined(ERPC_DEFAULT_BUFFER_SIZE)
//! @brief Size of buffers allocated by BasicMessageBufferFactory in setup functions.
#define ERPC_DEFAULT_BUFFER_SIZE (256)
#define ERPC_DEFAULT_BUFFER_SIZE (256U)
#endif

// Set default buffers count.
#if !defined(ERPC_DEFAULT_BUFFERS_COUNT)
//! @brief Count of buffers allocated by StaticMessageBufferFactory.
#define ERPC_DEFAULT_BUFFERS_COUNT (2)
#define ERPC_DEFAULT_BUFFERS_COUNT (2U)
#endif

// Disable/enable noexcept.
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/port/erpc_port_freertos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void erpc_free(void *ptr)

/* Provide function for pure virtual call to avoid huge demangling code being linked in ARM GCC */
#if ((defined(__GNUC__)) && (defined(__arm__)))
extern "C" void __cxa_pure_virtual()
extern "C" void __cxa_pure_virtual(void)
{
while (1)
;
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/port/erpc_port_memmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void erpc_free(void *ptr)

/* Provide function for pure virtual call to avoid huge demangling code being linked in ARM GCC */
#if ((defined(__GNUC__)) && (defined(__arm__)))
extern "C" void __cxa_pure_virtual()
extern "C" void __cxa_pure_virtual(void)
{
while (1)
;
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/port/erpc_port_mqx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void erpc_free(void *ptr)

/* Provide function for pure virtual call to avoid huge demangling code being linked in ARM GCC */
#if ((defined(__GNUC__)) && (defined(__arm__)))
extern "C" void __cxa_pure_virtual()
extern "C" void __cxa_pure_virtual(void)
{
while (1)
;
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/port/erpc_port_stdlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void erpc_free(void *ptr)

/* Provide function for pure virtual call to avoid huge demangling code being linked in ARM GCC */
#if ((defined(__GNUC__)) && (defined(__arm__)))
extern "C" void __cxa_pure_virtual()
extern "C" void __cxa_pure_virtual(void)
{
while (1)
;
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/port/erpc_port_zephyr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void erpc_free(void *ptr)

/* Provide function for pure virtual call to avoid huge demangling code being linked in ARM GCC */
#if ((defined(__GNUC__)) && (defined(__arm__)))
extern "C" void __cxa_pure_virtual()
extern "C" void __cxa_pure_virtual(void)
{
while (1)
;
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/port/erpc_setup_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <stdint.h>

#if ERPC_THREADS
#if !ERPC_THREADS_IS(NONE)

#if ERPC_THREADS_IS(FREERTOS)
#include "FreeRTOS.h"
Expand Down
12 changes: 6 additions & 6 deletions erpc_c/port/erpc_setup_extensions_freertos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using namespace erpc;
static Semaphore *s_erpc_call_in_progress = NULL;
static TimerHandle_t s_erpc_call_timer_cb = NULL;

void erpc::erpc_pre_cb_default()
void erpc::erpc_pre_cb_default(void)
{
assert(s_erpc_call_in_progress &&
"If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default.");
Expand All @@ -27,13 +27,13 @@ void erpc::erpc_pre_cb_default()
xTimerStart(s_erpc_call_timer_cb, 0);
}

void erpc::erpc_post_cb_default()
void erpc::erpc_post_cb_default(void)
{
xTimerStop(s_erpc_call_timer_cb, 0);
s_erpc_call_in_progress->put();
}

void erpc_call_timer_cb_default(TimerHandle_t xTimer)
static void erpc_call_timer_cb_default(TimerHandle_t xTimer)
{
assert(1 != 1 && "eRPC task freezed.");
}
Expand All @@ -49,7 +49,7 @@ void erpc_init_call_progress_detection_default(
assert(s_erpc_call_timer_cb && "Creating eRPC timer failed.");
}

void erpc_deinit_call_progress_detection_default()
void erpc_deinit_call_progress_detection_default(void)
{
if (s_erpc_call_in_progress)
{
Expand All @@ -64,7 +64,7 @@ void erpc_deinit_call_progress_detection_default()
}
}

bool erpc_is_call_in_progress_default()
bool erpc_is_call_in_progress_default(void)
{
assert(s_erpc_call_in_progress &&
"If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default.");
Expand All @@ -76,7 +76,7 @@ bool erpc_is_call_in_progress_default()
return true;
}

void erpc_reset_in_progress_state_default()
void erpc_reset_in_progress_state_default(void)
{

assert(s_erpc_call_in_progress &&
Expand Down
Loading

0 comments on commit 6a571ca

Please sign in to comment.