Skip to content

Commit

Permalink
eRPC updates 05/2022
Browse files Browse the repository at this point in the history
-- Several MISRA violations addressed.
-- Avoid build warnings in test projects.
-- Updated minor version
-- Apply workaround for Compiler redefinition errors in arm_compat.h after updating to CMSIS 5.8.0 in unit tests. (ensure the arm_compat.h is included before the CMSIS compliant device-specific header file, in our case the rpmsg_compiler.h needs to be included as first where needed, Article ID: KA004795 on developer.arm.com)
  • Loading branch information
MichalPrincNXP committed May 27, 2022
1 parent 340dd88 commit 932a8aa
Show file tree
Hide file tree
Showing 42 changed files with 128 additions and 121 deletions.
2 changes: 1 addition & 1 deletion doxygen/Doxyfile.erpc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "eRPC API Reference"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "Rev. 1.9.0"
PROJECT_NUMBER = "Rev. 1.9.1"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion doxygen/Doxyfile.erpcgen
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "eRPC Generator (erpcgen)"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "Rev. 1.9.0"
PROJECT_NUMBER = "Rev. 1.9.1"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
4 changes: 2 additions & 2 deletions erpc_c/infra/erpc_arbitrated_client_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void ArbitratedClientManager::performClientRequest(RequestContext &request)
erpc_status_t err;
TransportArbitrator::client_token_t token = 0;

erpc_assert(m_arbitrator && "arbitrator not set");
erpc_assert((m_arbitrator != NULL) && ("arbitrator not set" != NULL));

// Set up the client receive before we send the request, so if the reply is sent
// before we get to the clientReceive() call below the arbitrator already has the buffer.
Expand All @@ -55,7 +55,7 @@ void ArbitratedClientManager::performClientRequest(RequestContext &request)
if (request.getCodec()->isStatusOk() == true)
{
token = m_arbitrator->prepareClientReceive(request);
if (!token)
if (token == 0U)
{
request.getCodec()->updateStatus(kErpcStatus_Fail);
}
Expand Down
6 changes: 3 additions & 3 deletions erpc_c/infra/erpc_client_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void ClientManager::performRequest(RequestContext &request)
#if ERPC_NESTED_CALLS
if (performRequest)
{
erpc_assert(m_serverThreadId && "server thread id was not set");
erpc_assert((m_serverThreadId != NULL) && ("server thread id was not set" != NULL));
if (Thread::getCurrentThreadId() == m_serverThreadId)
{
performNestedClientRequest(request);
Expand Down Expand Up @@ -118,7 +118,7 @@ void ClientManager::performNestedClientRequest(RequestContext &request)
{
erpc_status_t err;

erpc_assert(m_transport && "transport/arbitrator not set");
erpc_assert((m_transport != NULL) && ("transport/arbitrator not set" != NULL));

#if ERPC_MESSAGE_LOGGING
if (request.getCodec()->isStatusOk() == true)
Expand All @@ -141,7 +141,7 @@ void ClientManager::performNestedClientRequest(RequestContext &request)
// Receive reply.
if (request.getCodec()->isStatusOk() == true)
{
erpc_assert(m_server && "server for nesting calls was not set");
erpc_assert((m_server != NULL) && ("server for nesting calls was not set" != NULL));
err = m_server->run(request);
request.getCodec()->updateStatus(err);
}
Expand Down
4 changes: 2 additions & 2 deletions erpc_c/infra/erpc_framed_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ erpc_status_t FramedTransport::receive(MessageBuffer *message)
erpc_status_t retVal;
uint16_t computedCrc;

erpc_assert(m_crcImpl && "Uninitialized Crc16 object.");
erpc_assert((m_crcImpl != NULL) && ("Uninitialized Crc16 object." != NULL));

{
#if !ERPC_THREADS_IS(NONE)
Expand Down Expand Up @@ -101,7 +101,7 @@ erpc_status_t FramedTransport::send(MessageBuffer *message)
uint16_t messageLength;
Header h;

erpc_assert(m_crcImpl && "Uninitialized Crc16 object.");
erpc_assert((m_crcImpl != NULL) && ("Uninitialized Crc16 object." != NULL));

#if !ERPC_THREADS_IS(NONE)
Mutex::Guard lock(m_sendLock);
Expand Down
8 changes: 4 additions & 4 deletions erpc_c/infra/erpc_message_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ void MessageBuffer::Cursor::set(MessageBuffer *buffer)

erpc_status_t MessageBuffer::Cursor::read(void *data, uint32_t length)
{
erpc_assert(m_pos && "Data buffer wasn't set to MessageBuffer.");
erpc_assert((m_pos != NULL) && ("Data buffer wasn't set to MessageBuffer." != NULL));

erpc_status_t err = kErpcStatus_Success;

if (length > 0)
if (length > 0U)
{
if (data == NULL)
{
Expand All @@ -134,11 +134,11 @@ erpc_status_t MessageBuffer::Cursor::read(void *data, uint32_t length)

erpc_status_t MessageBuffer::Cursor::write(const void *data, uint32_t length)
{
erpc_assert(m_pos && "Data buffer wasn't set to MessageBuffer.");
erpc_assert((m_pos != NULL) && ("Data buffer wasn't set to MessageBuffer." != NULL));

erpc_status_t err = kErpcStatus_Success;

if (length > 0)
if (length > 0U)
{
if (data == NULL)
{
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/infra/erpc_message_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class MessageBufferFactory
MessageBufferFactory(void) {}

/*!
* @brief ClientManager destructor
* @brief MessageBufferFactory destructor
*/
virtual ~MessageBufferFactory(void) {}

Expand Down
2 changes: 1 addition & 1 deletion erpc_c/infra/erpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Server : public ClientServerCommon
}

/*!
* @brief ClientManager destructor
* @brief Server destructor
*/
virtual ~Server(void) {}

Expand Down
12 changes: 6 additions & 6 deletions erpc_c/infra/erpc_transport_arbitrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ TransportArbitrator::~TransportArbitrator(void)

void TransportArbitrator::setCrc16(Crc16 *crcImpl)
{
erpc_assert(crcImpl);
erpc_assert(m_sharedTransport);
erpc_assert(crcImpl != NULL);
erpc_assert(m_sharedTransport != NULL);
m_sharedTransport->setCrc16(crcImpl);
}

bool TransportArbitrator::hasMessage(void)
{
erpc_assert(m_sharedTransport && "shared transport is not set");
erpc_assert((m_sharedTransport != NULL) && ("shared transport is not set" != NULL));

return m_sharedTransport->hasMessage();
}

erpc_status_t TransportArbitrator::receive(MessageBuffer *message)
{
erpc_assert(m_sharedTransport && "shared transport is not set");
erpc_assert((m_sharedTransport != NULL) && ("shared transport is not set" != NULL));

erpc_status_t err;
message_type_t msgType;
Expand Down Expand Up @@ -141,7 +141,7 @@ erpc_status_t TransportArbitrator::receive(MessageBuffer *message)

erpc_status_t TransportArbitrator::send(MessageBuffer *message)
{
erpc_assert(m_sharedTransport && "shared transport is not set");
erpc_assert((m_sharedTransport != NULL) && ("shared transport is not set" != NULL));
return m_sharedTransport->send(message);
}

Expand All @@ -158,7 +158,7 @@ TransportArbitrator::client_token_t TransportArbitrator::prepareClientReceive(Re

erpc_status_t TransportArbitrator::clientReceive(client_token_t token)
{
erpc_assert((token != 0) && "invalid client token");
erpc_assert((token != 0) && ("invalid client token" != NULL));

// Convert token to pointer to info struct for this client receive request.
PendingClientInfo *info = reinterpret_cast<PendingClientInfo *>(token);
Expand Down
6 changes: 3 additions & 3 deletions erpc_c/infra/erpc_version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, Freescale Semiconductor, Inc.
* Copyright 2016-2021 NXP
* Copyright 2016-2022 NXP
* All rights reserved.
*
*
Expand All @@ -20,9 +20,9 @@
////////////////////////////////////////////////////////////////////////////////

//! @brief String version of eRPC.
#define ERPC_VERSION "1.9.0"
#define ERPC_VERSION "1.9.1"
//! @brief Integer version of eRPC.
#define ERPC_VERSION_NUMBER 10900
#define ERPC_VERSION_NUMBER 10901

/*! @} */

Expand Down
26 changes: 13 additions & 13 deletions erpc_c/port/erpc_setup_extensions_freertos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ ERPC_MANUALLY_CONSTRUCTED_STATIC(Semaphore, s_semaphore);

void erpc::erpc_pre_cb_default(void)
{
erpc_assert(s_erpc_call_in_progress &&
"If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default.");
erpc_assert((s_erpc_call_in_progress != NULL) &&
("If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default." != NULL));
(void)s_erpc_call_in_progress->get(s_erpc_call_in_progress->kWaitForever);
erpc_assert(s_erpc_call_timer_cb &&
"If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default.");
erpc_assert((s_erpc_call_timer_cb != NULL) &&
("If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default." != NULL));
(void)xTimerStart(s_erpc_call_timer_cb, 0);
}

Expand All @@ -40,7 +40,7 @@ void erpc::erpc_post_cb_default(void)
static void erpc_call_timer_cb_default(TimerHandle_t xTimer)
{
(void)xTimer;
erpc_assert(1 && "eRPC task freezed.");
erpc_assert(true && ("eRPC task freezed." != NULL));
}

void erpc_init_call_progress_detection_default(
Expand All @@ -54,7 +54,7 @@ void erpc_init_call_progress_detection_default(
s_semaphore.construct(semaphoreCount);
s_erpc_call_in_progress = s_semaphore.get();
#endif
erpc_assert(s_erpc_call_in_progress && "Creating eRPC semaphore failed.");
erpc_assert((s_erpc_call_in_progress != NULL) && ("Creating eRPC semaphore failed." != NULL));

#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
s_erpc_call_timer_cb = xTimerCreateStatic("Erpc client call timer", waitTimeMs / portTICK_PERIOD_MS, pdFALSE, NULL,
Expand All @@ -63,7 +63,7 @@ void erpc_init_call_progress_detection_default(
s_erpc_call_timer_cb =
xTimerCreate("Erpc client call timer", waitTimeMs / portTICK_PERIOD_MS, pdFALSE, NULL, erpc_call_timer_cb);
#endif
erpc_assert(s_erpc_call_timer_cb && "Creating eRPC timer failed.");
erpc_assert((s_erpc_call_timer_cb != NULL) && ("Creating eRPC timer failed." != NULL));
}

void erpc_deinit_call_progress_detection_default(void)
Expand All @@ -85,8 +85,8 @@ void erpc_deinit_call_progress_detection_default(void)

bool erpc_is_call_in_progress_default(void)
{
erpc_assert(s_erpc_call_in_progress &&
"If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default.");
erpc_assert((s_erpc_call_in_progress != NULL) &&
("If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default." != NULL));
if (s_erpc_call_in_progress->get(0))
{
s_erpc_call_in_progress->put();
Expand All @@ -98,12 +98,12 @@ bool erpc_is_call_in_progress_default(void)
void erpc_reset_in_progress_state_default(void)
{

erpc_assert(s_erpc_call_in_progress &&
"If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default.");
erpc_assert((s_erpc_call_in_progress != NULL) &&
("If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default." != NULL));
s_erpc_call_in_progress->get(0);
s_erpc_call_in_progress->put();

erpc_assert(s_erpc_call_timer_cb &&
"If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default.");
erpc_assert((s_erpc_call_timer_cb != NULL) &&
("If you want use default pre cb action, do not forget call erpc_init_call_progress_detection_default." != NULL));
(void)xTimerStop(s_erpc_call_timer_cb, 0);
}
2 changes: 1 addition & 1 deletion erpc_c/port/erpc_threading_freertos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void Thread::threadEntryPoint(void)
void Thread::threadEntryPointStub(void *arg)
{
Thread *_this = reinterpret_cast<Thread *>(arg);
erpc_assert(_this && "Reinterpreting 'void *arg' to 'Thread *' failed.");
erpc_assert((_this != NULL) && ("Reinterpreting 'void *arg' to 'Thread *' failed." != NULL));
_this->threadEntryPoint();

// Remove this thread from the linked list.
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/port/erpc_threading_mbed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void Thread::threadEntryPoint(void)
void Thread::threadEntryPointStub(void *arg)
{
Thread *_this = reinterpret_cast<Thread *>(arg);
erpc_assert(_this); // Reinterpreting 'void *arg' to 'Thread *' failed.
erpc_assert(_this != NULL); // Reinterpreting 'void *arg' to 'Thread *' failed.
_this->threadEntryPoint();

// Remove this thread from the linked list.
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/port/erpc_threading_threadx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void Thread::threadEntryPoint(void)
void Thread::threadEntryPointStub(ULONG arg)
{
Thread *_this = reinterpret_cast<Thread *>(arg);
erpc_assert(_this && "Reinterpreting 'void *arg' to 'Thread *' failed.");
erpc_assert((_this != NULL) && ("Reinterpreting 'void *arg' to 'Thread *' failed." != NULL));
_this->threadEntryPoint();

// Remove this thread from the linked list.
Expand Down
4 changes: 2 additions & 2 deletions erpc_c/port/erpc_threading_zephyr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void Thread::start(void *arg)
{
m_arg = arg;

erpc_assert(m_stack && "Set stack address");
erpc_assert((m_stack != NULL) && ("Set stack address" != NULL));
k_thread_create(&m_thread, m_stack, m_stackSize, threadEntryPointStub, this, NULL, NULL, m_priority, 0, K_NO_WAIT);
}

Expand Down Expand Up @@ -84,7 +84,7 @@ void Thread::threadEntryPoint(void)
void *Thread::threadEntryPointStub(void *arg1, void *arg2, void *arg3)
{
Thread *_this = reinterpret_cast<Thread *>(arg1);
erpc_assert(_this && "Reinterpreting 'void *arg1' to 'Thread *' failed.");
erpc_assert((_this != NULL) && ("Reinterpreting 'void *arg1' to 'Thread *' failed." != NULL));
k_thread_custom_data_set(arg1);
_this->threadEntryPoint();

Expand Down
6 changes: 3 additions & 3 deletions erpc_c/setup/erpc_arbitrated_client_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ERPC_MANUALLY_CONSTRUCTED(Crc16, s_crc16);

erpc_transport_t erpc_arbitrated_client_init(erpc_transport_t transport, erpc_mbf_t message_buffer_factory)
{
erpc_assert(transport);
erpc_assert(transport != NULL);

Transport *castedTransport;

Expand Down Expand Up @@ -125,14 +125,14 @@ bool erpc_arbitrated_client_add_message_logger(erpc_transport_t transport)
#if ERPC_PRE_POST_ACTION
void erpc_arbitrated_client_add_pre_cb_action(pre_post_action_cb preCB)
{
erpc_assert(g_client);
erpc_assert(g_client != NULL);

g_client->addPreCB(preCB);
}

void erpc_arbitrated_client_add_post_cb_action(pre_post_action_cb postCB)
{
erpc_assert(g_client);
erpc_assert(g_client != NULL);

g_client->addPostCB(postCB);
}
Expand Down
6 changes: 3 additions & 3 deletions erpc_c/setup/erpc_client_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ERPC_MANUALLY_CONSTRUCTED(Crc16, s_crc16);

void erpc_client_init(erpc_transport_t transport, erpc_mbf_t message_buffer_factory)
{
erpc_assert(transport);
erpc_assert(transport != NULL);

Transport *castedTransport;

Expand Down Expand Up @@ -109,14 +109,14 @@ bool erpc_client_add_message_logger(erpc_transport_t transport)
#if ERPC_PRE_POST_ACTION
void erpc_client_add_pre_cb_action(pre_post_action_cb preCB)
{
erpc_assert(g_client);
erpc_assert(g_client != NULL);

g_client->addPreCB(preCB);
}

void erpc_client_add_post_cb_action(pre_post_action_cb postCB)
{
erpc_assert(g_client);
erpc_assert(g_client != NULL);

g_client->addPostCB(postCB);
}
Expand Down
6 changes: 3 additions & 3 deletions erpc_c/setup/erpc_server_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ERPC_MANUALLY_CONSTRUCTED(Crc16, s_crc16);

erpc_server_t erpc_server_init(erpc_transport_t transport, erpc_mbf_t message_buffer_factory)
{
erpc_assert(transport);
erpc_assert(transport != NULL);

Transport *castedTransport;

Expand Down Expand Up @@ -144,14 +144,14 @@ bool erpc_server_add_message_logger(erpc_transport_t transport)
#if ERPC_PRE_POST_ACTION
void erpc_client_add_pre_cb_action(pre_post_action_cb preCB)
{
erpc_assert(g_server);
erpc_assert(g_server != NULL);

g_server->addPreCB(preCB);
}

void erpc_client_add_post_cb_action(pre_post_action_cb postCB)
{
erpc_assert(g_server);
erpc_assert(g_server) != NULL;

g_server->addPostCB(postCB);
}
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/setup/erpc_setup_mbf_dynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DynamicMessageBufferFactory : public MessageBufferFactory

virtual void dispose(MessageBuffer *buf)
{
erpc_assert(buf);
erpc_assert(buf != NULL);
if (buf->get() != NULL)
{
delete[] buf->get();
Expand Down
Loading

0 comments on commit 932a8aa

Please sign in to comment.