From 932a8aa2ef603ca52a4c37d62bb3f59a60e17c05 Mon Sep 17 00:00:00 2001 From: "Michal Princ (nxa17570)" Date: Fri, 27 May 2022 10:59:02 +0200 Subject: [PATCH] eRPC updates 05/2022 -- 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) --- doxygen/Doxyfile.erpc | 2 +- doxygen/Doxyfile.erpcgen | 2 +- .../infra/erpc_arbitrated_client_manager.cpp | 4 +-- erpc_c/infra/erpc_client_manager.cpp | 6 ++-- erpc_c/infra/erpc_framed_transport.cpp | 4 +-- erpc_c/infra/erpc_message_buffer.cpp | 8 ++--- erpc_c/infra/erpc_message_buffer.h | 2 +- erpc_c/infra/erpc_server.h | 2 +- erpc_c/infra/erpc_transport_arbitrator.cpp | 12 ++++---- erpc_c/infra/erpc_version.h | 6 ++-- .../port/erpc_setup_extensions_freertos.cpp | 26 ++++++++-------- erpc_c/port/erpc_threading_freertos.cpp | 2 +- erpc_c/port/erpc_threading_mbed.cpp | 2 +- erpc_c/port/erpc_threading_threadx.cpp | 2 +- erpc_c/port/erpc_threading_zephyr.cpp | 4 +-- erpc_c/setup/erpc_arbitrated_client_setup.cpp | 6 ++-- erpc_c/setup/erpc_client_setup.cpp | 6 ++-- erpc_c/setup/erpc_server_setup.cpp | 6 ++-- erpc_c/setup/erpc_setup_mbf_dynamic.cpp | 2 +- erpc_c/setup/erpc_setup_mbf_rpmsg.cpp | 2 +- erpc_c/setup/erpc_setup_mbf_rpmsg_tty.cpp | 2 +- erpc_c/setup/erpc_setup_mbf_static.cpp | 2 +- .../erpc_inter_thread_buffer_transport.cpp | 4 +-- .../erpc_rpmsg_lite_rtos_transport.cpp | 4 +-- .../transports/erpc_rpmsg_lite_transport.cpp | 2 +- .../erpc_rpmsg_tty_rtos_transport.cpp | 10 +++---- erpc_python/erpc/erpc_version.py | 4 +-- .../service/__init__.py | 2 +- .../service/erpc_matrix_multiply/__init__.py | 6 ++-- .../service/erpc_matrix_multiply/client.py | 3 +- .../service/erpc_matrix_multiply/common.py | 2 +- .../service/erpc_matrix_multiply/interface.py | 2 +- .../service/erpc_matrix_multiply/server.py | 4 +-- test/common/gtest/gtest.cpp | 5 ++++ test/common/retarget_cpp_streamed_io.c | 30 ++++++++++--------- test/common/unit_test_arbitrator_app0.cpp | 12 ++++---- test/common/unit_test_arbitrator_app1.cpp | 6 ++-- test/common/unit_test_client.cpp | 19 ++++++------ test/common/unit_test_server.cpp | 12 ++++---- test/test_arrays/test_arrays_client_impl.cpp | 4 +-- test/test_arrays/test_arrays_server_impl.cpp | 4 +-- test/test_lists/test_lists_client_impl.cpp | 4 +-- 42 files changed, 128 insertions(+), 121 deletions(-) diff --git a/doxygen/Doxyfile.erpc b/doxygen/Doxyfile.erpc index 0970ab70..7016d0cf 100644 --- a/doxygen/Doxyfile.erpc +++ b/doxygen/Doxyfile.erpc @@ -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 diff --git a/doxygen/Doxyfile.erpcgen b/doxygen/Doxyfile.erpcgen index 0b942882..7fa3934c 100644 --- a/doxygen/Doxyfile.erpcgen +++ b/doxygen/Doxyfile.erpcgen @@ -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 diff --git a/erpc_c/infra/erpc_arbitrated_client_manager.cpp b/erpc_c/infra/erpc_arbitrated_client_manager.cpp index 961d55ac..653bdb14 100644 --- a/erpc_c/infra/erpc_arbitrated_client_manager.cpp +++ b/erpc_c/infra/erpc_arbitrated_client_manager.cpp @@ -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. @@ -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); } diff --git a/erpc_c/infra/erpc_client_manager.cpp b/erpc_c/infra/erpc_client_manager.cpp index 3fa3659d..25e6d3fe 100644 --- a/erpc_c/infra/erpc_client_manager.cpp +++ b/erpc_c/infra/erpc_client_manager.cpp @@ -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); @@ -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) @@ -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); } diff --git a/erpc_c/infra/erpc_framed_transport.cpp b/erpc_c/infra/erpc_framed_transport.cpp index 83ee8711..8af1f1c0 100644 --- a/erpc_c/infra/erpc_framed_transport.cpp +++ b/erpc_c/infra/erpc_framed_transport.cpp @@ -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) @@ -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); diff --git a/erpc_c/infra/erpc_message_buffer.cpp b/erpc_c/infra/erpc_message_buffer.cpp index 2614ed20..24fc6017 100644 --- a/erpc_c/infra/erpc_message_buffer.cpp +++ b/erpc_c/infra/erpc_message_buffer.cpp @@ -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) { @@ -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) { diff --git a/erpc_c/infra/erpc_message_buffer.h b/erpc_c/infra/erpc_message_buffer.h index f02f9044..3f694a7a 100644 --- a/erpc_c/infra/erpc_message_buffer.h +++ b/erpc_c/infra/erpc_message_buffer.h @@ -373,7 +373,7 @@ class MessageBufferFactory MessageBufferFactory(void) {} /*! - * @brief ClientManager destructor + * @brief MessageBufferFactory destructor */ virtual ~MessageBufferFactory(void) {} diff --git a/erpc_c/infra/erpc_server.h b/erpc_c/infra/erpc_server.h index 4bc2003a..a1ff56c9 100644 --- a/erpc_c/infra/erpc_server.h +++ b/erpc_c/infra/erpc_server.h @@ -118,7 +118,7 @@ class Server : public ClientServerCommon } /*! - * @brief ClientManager destructor + * @brief Server destructor */ virtual ~Server(void) {} diff --git a/erpc_c/infra/erpc_transport_arbitrator.cpp b/erpc_c/infra/erpc_transport_arbitrator.cpp index 43c1b3b4..933ff72b 100644 --- a/erpc_c/infra/erpc_transport_arbitrator.cpp +++ b/erpc_c/infra/erpc_transport_arbitrator.cpp @@ -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; @@ -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); } @@ -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(token); diff --git a/erpc_c/infra/erpc_version.h b/erpc_c/infra/erpc_version.h index f447f7a4..a4a95853 100644 --- a/erpc_c/infra/erpc_version.h +++ b/erpc_c/infra/erpc_version.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, Freescale Semiconductor, Inc. - * Copyright 2016-2021 NXP + * Copyright 2016-2022 NXP * All rights reserved. * * @@ -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 /*! @} */ diff --git a/erpc_c/port/erpc_setup_extensions_freertos.cpp b/erpc_c/port/erpc_setup_extensions_freertos.cpp index acdc7674..37fa0282 100644 --- a/erpc_c/port/erpc_setup_extensions_freertos.cpp +++ b/erpc_c/port/erpc_setup_extensions_freertos.cpp @@ -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); } @@ -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( @@ -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, @@ -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) @@ -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(); @@ -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); } diff --git a/erpc_c/port/erpc_threading_freertos.cpp b/erpc_c/port/erpc_threading_freertos.cpp index c99c9977..bb9eae46 100644 --- a/erpc_c/port/erpc_threading_freertos.cpp +++ b/erpc_c/port/erpc_threading_freertos.cpp @@ -149,7 +149,7 @@ void Thread::threadEntryPoint(void) void Thread::threadEntryPointStub(void *arg) { Thread *_this = reinterpret_cast(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. diff --git a/erpc_c/port/erpc_threading_mbed.cpp b/erpc_c/port/erpc_threading_mbed.cpp index 00441b36..9f537a9a 100644 --- a/erpc_c/port/erpc_threading_mbed.cpp +++ b/erpc_c/port/erpc_threading_mbed.cpp @@ -134,7 +134,7 @@ void Thread::threadEntryPoint(void) void Thread::threadEntryPointStub(void *arg) { Thread *_this = reinterpret_cast(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. diff --git a/erpc_c/port/erpc_threading_threadx.cpp b/erpc_c/port/erpc_threading_threadx.cpp index 4599800a..2c4939ff 100644 --- a/erpc_c/port/erpc_threading_threadx.cpp +++ b/erpc_c/port/erpc_threading_threadx.cpp @@ -170,7 +170,7 @@ void Thread::threadEntryPoint(void) void Thread::threadEntryPointStub(ULONG arg) { Thread *_this = reinterpret_cast(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. diff --git a/erpc_c/port/erpc_threading_zephyr.cpp b/erpc_c/port/erpc_threading_zephyr.cpp index b18c65bf..24928cc3 100644 --- a/erpc_c/port/erpc_threading_zephyr.cpp +++ b/erpc_c/port/erpc_threading_zephyr.cpp @@ -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); } @@ -84,7 +84,7 @@ void Thread::threadEntryPoint(void) void *Thread::threadEntryPointStub(void *arg1, void *arg2, void *arg3) { Thread *_this = reinterpret_cast(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(); diff --git a/erpc_c/setup/erpc_arbitrated_client_setup.cpp b/erpc_c/setup/erpc_arbitrated_client_setup.cpp index c3c96244..bd27544a 100644 --- a/erpc_c/setup/erpc_arbitrated_client_setup.cpp +++ b/erpc_c/setup/erpc_arbitrated_client_setup.cpp @@ -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; @@ -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); } diff --git a/erpc_c/setup/erpc_client_setup.cpp b/erpc_c/setup/erpc_client_setup.cpp index 4dd5e5f1..308fe34d 100644 --- a/erpc_c/setup/erpc_client_setup.cpp +++ b/erpc_c/setup/erpc_client_setup.cpp @@ -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; @@ -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); } diff --git a/erpc_c/setup/erpc_server_setup.cpp b/erpc_c/setup/erpc_server_setup.cpp index ee161d3c..1a457b84 100644 --- a/erpc_c/setup/erpc_server_setup.cpp +++ b/erpc_c/setup/erpc_server_setup.cpp @@ -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; @@ -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); } diff --git a/erpc_c/setup/erpc_setup_mbf_dynamic.cpp b/erpc_c/setup/erpc_setup_mbf_dynamic.cpp index 0fbfe9b4..28cfc649 100644 --- a/erpc_c/setup/erpc_setup_mbf_dynamic.cpp +++ b/erpc_c/setup/erpc_setup_mbf_dynamic.cpp @@ -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(); diff --git a/erpc_c/setup/erpc_setup_mbf_rpmsg.cpp b/erpc_c/setup/erpc_setup_mbf_rpmsg.cpp index e7bc453a..f0d1d8d7 100644 --- a/erpc_c/setup/erpc_setup_mbf_rpmsg.cpp +++ b/erpc_c/setup/erpc_setup_mbf_rpmsg.cpp @@ -62,7 +62,7 @@ class RPMsgMessageBufferFactory : public MessageBufferFactory */ virtual void dispose(MessageBuffer *buf) { - erpc_assert(buf); + erpc_assert(buf != NULL); void *tmp = (void *)buf->get(); if (tmp != NULL) { diff --git a/erpc_c/setup/erpc_setup_mbf_rpmsg_tty.cpp b/erpc_c/setup/erpc_setup_mbf_rpmsg_tty.cpp index 9dd716e6..360a737f 100644 --- a/erpc_c/setup/erpc_setup_mbf_rpmsg_tty.cpp +++ b/erpc_c/setup/erpc_setup_mbf_rpmsg_tty.cpp @@ -66,7 +66,7 @@ class RPMsgTTYMessageBufferFactory : public MessageBufferFactory */ virtual void dispose(MessageBuffer *buf) { - erpc_assert(buf); + erpc_assert(buf != NULL); void *tmp = (void *)buf->get(); if (tmp != NULL) { diff --git a/erpc_c/setup/erpc_setup_mbf_static.cpp b/erpc_c/setup/erpc_setup_mbf_static.cpp index 2b66dc86..4e3e0fbb 100644 --- a/erpc_c/setup/erpc_setup_mbf_static.cpp +++ b/erpc_c/setup/erpc_setup_mbf_static.cpp @@ -87,7 +87,7 @@ class StaticMessageBufferFactory : public MessageBufferFactory */ virtual void dispose(MessageBuffer *buf) { - erpc_assert(buf); + erpc_assert(buf != NULL); uint8_t *tmp = buf->get(); if (tmp != NULL) { diff --git a/erpc_c/transports/erpc_inter_thread_buffer_transport.cpp b/erpc_c/transports/erpc_inter_thread_buffer_transport.cpp index 2ee34667..26d70b4e 100644 --- a/erpc_c/transports/erpc_inter_thread_buffer_transport.cpp +++ b/erpc_c/transports/erpc_inter_thread_buffer_transport.cpp @@ -45,7 +45,7 @@ erpc_status_t InterThreadBufferTransport::receive(MessageBuffer *message) m_state->m_mutex.lock(); - erpc_assert(m_inBuffer); + erpc_assert(m_inBuffer != NULL); message->copy(m_inBuffer); m_inBuffer = NULL; @@ -58,7 +58,7 @@ erpc_status_t InterThreadBufferTransport::receive(MessageBuffer *message) erpc_status_t InterThreadBufferTransport::send(MessageBuffer *message) { - erpc_assert(m_state && m_peer); + erpc_assert((m_state != NULL) && (m_peer != NULL)); m_peer->m_outSem.get(); diff --git a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp index fe239a3c..3f1af619 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp +++ b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2015, Freescale Semiconductor, Inc. - * Copyright 2016-2021 NXP + * Copyright 2016-2022 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -244,7 +244,7 @@ erpc_status_t RPMsgRTOSTransport::receive(MessageBuffer *message) int32_t ret_val; ret_val = rpmsg_queue_recv_nocopy(s_rpmsg, m_rpmsg_queue, &m_dst_addr, &buf, &length, RL_BLOCK); - erpc_assert(buf); + erpc_assert(buf != NULL); message->set((uint8_t *)buf, length); message->setUsed(length); diff --git a/erpc_c/transports/erpc_rpmsg_lite_transport.cpp b/erpc_c/transports/erpc_rpmsg_lite_transport.cpp index 47d138ae..41904f69 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_transport.cpp +++ b/erpc_c/transports/erpc_rpmsg_lite_transport.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2021, Freescale Semiconductor, Inc. - * Copyright 2016-2021 NXP + * Copyright 2016-2022 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * diff --git a/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp b/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp index fec1d370..ca5c4c70 100644 --- a/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp +++ b/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, Freescale Semiconductor, Inc. - * Copyright 2017-2021 NXP + * Copyright 2017-2022 NXP * Copyright 2019-2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -71,7 +71,7 @@ RPMsgTTYRTOSTransport::~RPMsgTTYRTOSTransport(void) void RPMsgTTYRTOSTransport::setCrc16(Crc16 *crcImpl) { - erpc_assert(crcImpl); + erpc_assert(crcImpl != NULL); m_crcImpl = crcImpl; } @@ -253,8 +253,8 @@ erpc_status_t RPMsgTTYRTOSTransport::receive(MessageBuffer *message) int32_t ret_val = rpmsg_queue_recv_nocopy(s_rpmsg, m_rpmsg_queue, &m_dst_addr, &buf, &length, RL_BLOCK); uint16_t computedCrc; - erpc_assert(m_crcImpl && "Uninitialized Crc16 object."); - erpc_assert(buf); + erpc_assert((m_crcImpl != NULL) && ("Uninitialized Crc16 object." != NULL)); + erpc_assert(buf != NULL); if (ret_val == RL_SUCCESS) { @@ -289,7 +289,7 @@ erpc_status_t RPMsgTTYRTOSTransport::send(MessageBuffer *message) uint32_t used = message->getUsed(); int32_t ret_val; - erpc_assert(m_crcImpl && "Uninitialized Crc16 object."); + erpc_assert((m_crcImpl != NULL) && ("Uninitialized Crc16 object." != NULL)); message->set(NULL, 0); h.m_crc = m_crcImpl->computeCRC16(buf, used); diff --git a/erpc_python/erpc/erpc_version.py b/erpc_python/erpc/erpc_version.py index 47906439..f6600d12 100644 --- a/erpc_python/erpc/erpc_version.py +++ b/erpc_python/erpc/erpc_version.py @@ -1,9 +1,9 @@ #!/usr/bin/env python -# Copyright 2017-2021 NXP +# Copyright 2017-2022 NXP # All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause #Should be same as in erpc_version.h -ERPC_VERSION = "1.9.0" +ERPC_VERSION = "1.9.1" diff --git a/examples/matrix_multiply_tcp_python/service/__init__.py b/examples/matrix_multiply_tcp_python/service/__init__.py index ddf99e96..d1c9ed72 100644 --- a/examples/matrix_multiply_tcp_python/service/__init__.py +++ b/examples/matrix_multiply_tcp_python/service/__init__.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.0 on Thu Sep 23 10:39:09 2021. +# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. # # AUTOGENERATED - DO NOT EDIT # diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/__init__.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/__init__.py index 7586b935..cb6a3109 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/__init__.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/__init__.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.0 on Thu Sep 23 10:39:09 2021. +# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. # # AUTOGENERATED - DO NOT EDIT # @@ -15,8 +15,8 @@ version = erpc_version.ERPC_VERSION except ImportError: version = "unknown" -if version != "1.9.0": - raise ValueError("The generated shim code version (1.9.0) is different to the rest of eRPC code (%s). \ +if version != "1.9.1": + raise ValueError("The generated shim code version (1.9.1) is different to the rest of eRPC code (%s). \ Install newer version by running \"python setup.py install\" in folder erpc/erpc_python/." % repr(version)) from . import common diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/client.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/client.py index 33084b89..1f7dfd67 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/client.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/client.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.0 on Thu Sep 23 10:39:09 2021. +# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. # # AUTOGENERATED - DO NOT EDIT # @@ -58,4 +58,3 @@ def erpcMatrixMultiply(self, matrix1, matrix2, result_matrix): - diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/common.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/common.py index aeb227d4..0ee0524e 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/common.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/common.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.0 on Thu Sep 23 10:39:09 2021. +# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. # # AUTOGENERATED - DO NOT EDIT # diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/interface.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/interface.py index 61e303a2..81c19590 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/interface.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/interface.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.0 on Thu Sep 23 10:39:09 2021. +# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. # # AUTOGENERATED - DO NOT EDIT # diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/server.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/server.py index 4d4c7507..7e961917 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/server.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/server.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.0 on Thu Sep 23 10:39:09 2021. +# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. # # AUTOGENERATED - DO NOT EDIT # @@ -59,7 +59,7 @@ def _handle_erpcMatrixMultiply(self, sequence, codec): request=interface.IMatrixMultiplyService.ERPCMATRIXMULTIPLY_ID, sequence=sequence)) if result_matrix.value is None: - raise ValueError("result_matrix is None") + raise ValueError("result_matrix.value is None") for _i0 in result_matrix.value: for _i1 in _i0: codec.write_int32(_i1) diff --git a/test/common/gtest/gtest.cpp b/test/common/gtest/gtest.cpp index 3ac4413e..e2626e9a 100644 --- a/test/common/gtest/gtest.cpp +++ b/test/common/gtest/gtest.cpp @@ -1863,10 +1863,15 @@ void AssertHelper::operator=(const Message& message) const { } // Mutex for linked pointers. +#if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif /* defined(__GNUC__) */ + GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex); +#if defined(__GNUC__) #pragma GCC diagnostic pop +#endif /* defined(__GNUC__) */ // Application pathname gotten in InitGoogleTest. std::string g_executable_path; diff --git a/test/common/retarget_cpp_streamed_io.c b/test/common/retarget_cpp_streamed_io.c index 6cb1e31c..69fa28a9 100644 --- a/test/common/retarget_cpp_streamed_io.c +++ b/test/common/retarget_cpp_streamed_io.c @@ -1,5 +1,5 @@ /* - * Copyright 2017 NXP + * Copyright 2017-2022 NXP * Copyright (C) ARM Limited, 2006. * All rights reserved. * @@ -72,14 +72,15 @@ int _sys_close(FILEHANDLE fh) */ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode) { - // int i; - // for (i = 0; i < len; i++) - //{ - // // UART_write(buf[i]); - // LOG_Push((uint8_t *)(&buf[i]), 1); - //} + int i; + for (i = 0; i < len; i++) + { + // UART_write(buf[i]); + // LOG_Push((uint8_t *)(&buf[i]), 1); + DbgConsole_Putchar(buf[i]); + } - DbgConsole_SendData((uint8_t *)buf, len); + //DbgConsole_SendData((uint8_t *)buf, len); return 0; } @@ -104,7 +105,8 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode) // buf[pos]=UART_read(); // LOG_ReadCharacter((uint8_t *)&buf[pos]); - DbgConsole_ReadCharacter((uint8_t *)&buf[pos]); + // DbgConsole_ReadCharacter((uint8_t *)&buf[pos]); + buf[pos] = DbgConsole_Getchar(); // Advance position in buffer pos++; @@ -128,10 +130,9 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode) } // else UART_write(buf[pos-1]); // Echo normal char to terminal else - // LOG_Push((uint8_t *)(&buf[pos - 1]), 1); // Echo normal char to - // terminal - DbgConsole_SendData((uint8_t *)(&buf[pos - 1]), - 1); // Echo normal char to terminal + // LOG_Push((uint8_t *)(&buf[pos - 1]), 1); // Echo normal char to terminal + // DbgConsole_SendData((uint8_t *)(&buf[pos - 1]), 1); // Echo normal char to terminal + DbgConsole_Putchar(buf[pos-1]); // Echo normal char to terminal } while (buf[pos - 1] != '\r'); @@ -151,7 +152,8 @@ void _ttywrch(int ch) // UART_write(ench); // LOG_Push((uint8_t *)(&ench), 1); - DbgConsole_SendData((uint8_t *)(&ench), 1); + // DbgConsole_SendData((uint8_t *)(&ench), 1); + DbgConsole_Putchar(ench); } /* * Return non-zero if the argument file is connected to a terminal. diff --git a/test/common/unit_test_arbitrator_app0.cpp b/test/common/unit_test_arbitrator_app0.cpp index 249c6d78..0fbe9920 100644 --- a/test/common/unit_test_arbitrator_app0.cpp +++ b/test/common/unit_test_arbitrator_app0.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, Freescale Semiconductor, Inc. - * Copyright 2016 - 2020 NXP + * Copyright 2016 - 2022 NXP * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -22,13 +22,13 @@ #ifdef __cplusplus extern "C" { #endif +#if defined(RPMSG) +#include "rpmsg_lite.h" +#endif #include "app_core0.h" #include "board.h" #include "fsl_debug_console.h" #include "mcmgr.h" -#if defined(RPMSG) -#include "rpmsg_lite.h" -#endif #if defined(__CC_ARM) || defined(__ARMCC_VERSION) int main(int argc, char **argv); #endif @@ -93,7 +93,9 @@ void runClient(void *arg) // send to ERPC second (server) app message that this app is ready. whenReady(); - RUN_ALL_TESTS(); + __attribute__((unused)) + int i; + i = RUN_ALL_TESTS(); // wait until ERPC second (server) app will announce ready to quit state. while (true) diff --git a/test/common/unit_test_arbitrator_app1.cpp b/test/common/unit_test_arbitrator_app1.cpp index 31131df8..c99b5842 100644 --- a/test/common/unit_test_arbitrator_app1.cpp +++ b/test/common/unit_test_arbitrator_app1.cpp @@ -21,12 +21,12 @@ #ifdef __cplusplus extern "C" { #endif -#include "app_core1.h" -#include "board.h" -#include "mcmgr.h" #if defined(RPMSG) #include "rpmsg_lite.h" #endif +#include "app_core1.h" +#include "board.h" +#include "mcmgr.h" #if defined(__CC_ARM) || defined(__ARMCC_VERSION) int main(int argc, char **argv); #endif diff --git a/test/common/unit_test_client.cpp b/test/common/unit_test_client.cpp index 9a070ab5..952b0983 100644 --- a/test/common/unit_test_client.cpp +++ b/test/common/unit_test_client.cpp @@ -10,28 +10,27 @@ #include "erpc_mbf_setup.h" #include "erpc_transport_setup.h" -#include "board.h" -#include "gtest.h" -#include "gtestListener.h" -#include "myAlloc.h" -#include "test_unit_test_common.h" - #if (defined(RPMSG) || defined(UART) || defined(MU)) extern "C" { -#include "app_core0.h" -#include "board.h" -#include "fsl_debug_console.h" -#include "mcmgr.h" #if defined(RPMSG) #include "rpmsg_lite.h" #elif defined(UART) #include "fsl_usart_cmsis.h" #endif +#include "app_core0.h" +#include "fsl_debug_console.h" +#include "mcmgr.h" #if defined(__CC_ARM) || defined(__ARMCC_VERSION) int main(int argc, char **argv); #endif } +#include "board.h" +#include "gtest.h" +#include "gtestListener.h" +#include "myAlloc.h" +#include "test_unit_test_common.h" + #ifdef UNITY_DUMP_RESULTS #include "corn_g_test.h" #endif diff --git a/test/common/unit_test_server.cpp b/test/common/unit_test_server.cpp index bb15903d..43860f69 100644 --- a/test/common/unit_test_server.cpp +++ b/test/common/unit_test_server.cpp @@ -11,14 +11,8 @@ #include "erpc_simple_server.h" #include "erpc_transport_setup.h" -#include "board.h" -#include "myAlloc.h" -#include "test_unit_test_common_server.h" -#include "unit_test_wrapped.h" - #if (defined(RPMSG) || defined(UART) || defined(MU)) extern "C" { -#include "app_core1.h" #if defined(RPMSG) #define APP_ERPC_READY_EVENT_DATA (1) #include "mcmgr.h" @@ -29,12 +23,18 @@ extern "C" { #define APP_ERPC_READY_EVENT_DATA (1) #include "mcmgr.h" #endif +#include "app_core1.h" #if defined(__CC_ARM) || defined(__ARMCC_VERSION) int main(int argc, const char *argv[]); #endif } #endif +#include "board.h" +#include "myAlloc.h" +#include "test_unit_test_common_server.h" +#include "unit_test_wrapped.h" + //////////////////////////////////////////////////////////////////////////////// // Variables //////////////////////////////////////////////////////////////////////////////// diff --git a/test/test_arrays/test_arrays_client_impl.cpp b/test/test_arrays/test_arrays_client_impl.cpp index 1db0d3a6..a416dc60 100644 --- a/test/test_arrays/test_arrays_client_impl.cpp +++ b/test/test_arrays/test_arrays_client_impl.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2015, Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016 - 2022 NXP * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -61,7 +61,7 @@ TEST(test_arrays, sendReceived2Int32) TEST(test_arrays, sendReceivedString) { - char *(send_array[12]); + char *send_array[12]; char *(*received_array)[12]; char text[] = "Hello"; diff --git a/test/test_arrays/test_arrays_server_impl.cpp b/test/test_arrays/test_arrays_server_impl.cpp index 4e661297..8caba7ae 100644 --- a/test/test_arrays/test_arrays_server_impl.cpp +++ b/test/test_arrays/test_arrays_server_impl.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2016, Freescale Semiconductor, Inc. - * Copyright 2016 - 2021 NXP + * Copyright 2016 - 2022 NXP * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -279,7 +279,7 @@ Array2ListType *sendReceived2ListType(Array2ListType arrayLists) AllTypes (*sendReceiveStruct(const AllTypes all_types[2]))[2] { - const AllTypes(**received_struct) = &all_types; + const AllTypes **received_struct = &all_types; AllTypes(*send_struct)[2] = (AllTypes(*)[2])erpc_malloc(sizeof(AllTypes[2])); for (uint32_t k = 0; k < 2; ++k) diff --git a/test/test_lists/test_lists_client_impl.cpp b/test/test_lists/test_lists_client_impl.cpp index 0e59f62c..e5f207c2 100644 --- a/test/test_lists/test_lists_client_impl.cpp +++ b/test/test_lists/test_lists_client_impl.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2016, Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016 - 2022 NXP * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -460,7 +460,7 @@ TEST(test_list, testLengthAnnotation) uint32_t length = 5; int32_t *list = (int32_t *)erpc_malloc(length * sizeof(int32_t)); int32_t *list_ptr = list; - for (int i = 0; i < length; ++i) + for (unsigned int i = 0; i < length; ++i) { *list_ptr = i + 1; ++list_ptr;