From aa4cb0006fd6d8abae086d521fb5fa70d9ee7f66 Mon Sep 17 00:00:00 2001 From: Timothy Canham Date: Mon, 28 Jun 2021 19:20:37 -0700 Subject: [PATCH 1/8] Changed PrmBuffer m_data to m_bufferData for VxWorks --- Fw/Prm/PrmBuffer.cpp | 10 +++++----- Fw/Prm/PrmBuffer.hpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Fw/Prm/PrmBuffer.cpp b/Fw/Prm/PrmBuffer.cpp index 8e09ba1727..1dfe8f7aa7 100644 --- a/Fw/Prm/PrmBuffer.cpp +++ b/Fw/Prm/PrmBuffer.cpp @@ -15,26 +15,26 @@ namespace Fw { } ParamBuffer::ParamBuffer(const ParamBuffer& other) : Fw::SerializeBufferBase() { - SerializeStatus stat = SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); } const ParamBuffer& ParamBuffer::operator=(const ParamBuffer& other) { - SerializeStatus stat = SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); return *this; } NATIVE_UINT_TYPE ParamBuffer::getBuffCapacity(void) const { - return sizeof(this->m_data); + return sizeof(this->m_bufferData); } const U8* ParamBuffer::getBuffAddr(void) const { - return this->m_data; + return this->m_bufferData; } U8* ParamBuffer::getBuffAddr(void) { - return this->m_data; + return this->m_bufferData; } } diff --git a/Fw/Prm/PrmBuffer.hpp b/Fw/Prm/PrmBuffer.hpp index e1636bace5..2c819de4c3 100644 --- a/Fw/Prm/PrmBuffer.hpp +++ b/Fw/Prm/PrmBuffer.hpp @@ -38,7 +38,7 @@ namespace Fw { const U8* getBuffAddr(void) const; private: - U8 m_data[FW_PARAM_BUFFER_MAX_SIZE]; // command argument buffer + U8 m_bufferData[FW_PARAM_BUFFER_MAX_SIZE]; // command argument buffer }; } From dc483bb93eb2469396cefe1f27599ff60ab63d57 Mon Sep 17 00:00:00 2001 From: Timothy Canham Date: Mon, 28 Jun 2021 19:46:09 -0700 Subject: [PATCH 2/8] More m_data instances --- Fw/Buffer/Buffer.cpp | 36 ++++++++++++++++----------------- Fw/Buffer/Buffer.hpp | 2 +- Fw/Cmd/CmdArgBuffer.cpp | 10 ++++----- Fw/Cmd/CmdArgBuffer.hpp | 2 +- Fw/Com/ComBuffer.cpp | 10 ++++----- Fw/Com/ComBuffer.hpp | 2 +- Fw/Log/LogBuffer.cpp | 10 ++++----- Fw/Log/LogBuffer.hpp | 2 +- Fw/Tlm/TlmBuffer.cpp | 10 ++++----- Fw/Tlm/TlmBuffer.hpp | 2 +- Utils/Hash/HashBuffer.hpp | 2 +- Utils/Hash/HashBufferCommon.cpp | 10 ++++----- 12 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Fw/Buffer/Buffer.cpp b/Fw/Buffer/Buffer.cpp index a850d71cf3..16bc957d93 100644 --- a/Fw/Buffer/Buffer.cpp +++ b/Fw/Buffer/Buffer.cpp @@ -22,21 +22,21 @@ namespace Fw { Buffer::Buffer(): Serializable(), m_serialize_repr(), - m_data(NULL), + m_bufferData(NULL), m_size(0), m_context(0xFFFFFFFF) {} Buffer::Buffer(const Buffer& src) : Serializable(), - m_serialize_repr(src.m_data, src.m_size), - m_data(src.m_data), + m_serialize_repr(src.m_bufferData, src.m_size), + m_bufferData(src.m_bufferData), m_size(src.m_size), m_context(src.m_context) {} Buffer::Buffer(U8* data, U32 size, U32 context) : Serializable(), m_serialize_repr(data, size), - m_data(data), + m_bufferData(data), m_size(size), m_context(context) {} @@ -44,17 +44,17 @@ Buffer::Buffer(U8* data, U32 size, U32 context) : Serializable(), Buffer& Buffer::operator=(const Buffer& src) { // Ward against self-assignment if (this != &src) { - this->set(src.m_data, src.m_size, src.m_context); + this->set(src.m_bufferData, src.m_size, src.m_context); } return *this; } bool Buffer::operator==(const Buffer& src) const { - return (this->m_data == src.m_data) && (this->m_size == src.m_size) && (this->m_context == src.m_context); + return (this->m_bufferData == src.m_bufferData) && (this->m_size == src.m_size) && (this->m_context == src.m_context); } U8* Buffer::getData() const { - return this->m_data; + return this->m_bufferData; } U32 Buffer::getSize() const { @@ -66,16 +66,16 @@ U32 Buffer::getContext() const { } void Buffer::setData(U8* const data) { - this->m_data = data; - if (m_data != NULL) { - this->m_serialize_repr.setExtBuffer(m_data, m_size); + this->m_bufferData = data; + if (m_bufferData != NULL) { + this->m_serialize_repr.setExtBuffer(m_bufferData, m_size); } } void Buffer::setSize(const U32 size) { this->m_size = size; - if (m_data != NULL) { - this->m_serialize_repr.setExtBuffer(m_data, m_size); + if (m_bufferData != NULL) { + this->m_serialize_repr.setExtBuffer(m_bufferData, m_size); } } @@ -84,10 +84,10 @@ void Buffer::setContext(const U32 context) { } void Buffer::set(U8* const data, const U32 size, const U32 context) { - this->m_data = data; + this->m_bufferData = data; this->m_size = size; - if (m_data != NULL) { - this->m_serialize_repr.setExtBuffer(m_data, m_size); + if (m_bufferData != NULL) { + this->m_serialize_repr.setExtBuffer(m_bufferData, m_size); } this->m_context = context; } @@ -104,7 +104,7 @@ Fw::SerializeStatus Buffer::serialize(Fw::SerializeBufferBase& buffer) const { return stat; } #endif - stat = buffer.serialize(reinterpret_cast(this->m_data)); + stat = buffer.serialize(reinterpret_cast(this->m_bufferData)); if (stat != Fw::FW_SERIALIZE_OK) { return stat; } @@ -139,7 +139,7 @@ Fw::SerializeStatus Buffer::deserialize(Fw::SerializeBufferBase& buffer) { if (stat != Fw::FW_SERIALIZE_OK) { return stat; } - this->m_data = reinterpret_cast(pointer); + this->m_bufferData = reinterpret_cast(pointer); stat = buffer.deserialize(this->m_size); if (stat != Fw::FW_SERIALIZE_OK) { @@ -157,7 +157,7 @@ void Buffer::toString(Fw::StringBase& text) const { static const char * formatString = "(data = %p, size = %u,context = %u)"; char outputString[FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE]; - (void)snprintf(outputString, FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE, formatString, this->m_data, this->m_size, + (void)snprintf(outputString, FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE, formatString, this->m_bufferData, this->m_size, this->m_context); // Force NULL termination outputString[FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE-1] = 0; diff --git a/Fw/Buffer/Buffer.hpp b/Fw/Buffer/Buffer.hpp index f403a364d7..27cf014c5e 100644 --- a/Fw/Buffer/Buffer.hpp +++ b/Fw/Buffer/Buffer.hpp @@ -161,7 +161,7 @@ class Buffer : public Fw::Serializable { PRIVATE: Fw::ExternalSerializeBuffer m_serialize_repr; //setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = this->setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); } const CmdArgBuffer& CmdArgBuffer::operator=(const CmdArgBuffer& other) { - SerializeStatus stat = this->setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = this->setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); return *this; } NATIVE_UINT_TYPE CmdArgBuffer::getBuffCapacity(void) const { - return sizeof(this->m_data); + return sizeof(this->m_bufferData); } const U8* CmdArgBuffer::getBuffAddr(void) const { - return this->m_data; + return this->m_bufferData; } U8* CmdArgBuffer::getBuffAddr(void) { - return this->m_data; + return this->m_bufferData; } } diff --git a/Fw/Cmd/CmdArgBuffer.hpp b/Fw/Cmd/CmdArgBuffer.hpp index b96dab292c..2e90a12ec6 100644 --- a/Fw/Cmd/CmdArgBuffer.hpp +++ b/Fw/Cmd/CmdArgBuffer.hpp @@ -38,7 +38,7 @@ namespace Fw { const U8* getBuffAddr(void) const; //!< return address of buffer (const version) private: - U8 m_data[FW_CMD_ARG_BUFFER_MAX_SIZE]; //!< command argument buffer + U8 m_bufferData[FW_CMD_ARG_BUFFER_MAX_SIZE]; //!< command argument buffer }; } diff --git a/Fw/Com/ComBuffer.cpp b/Fw/Com/ComBuffer.cpp index 41d36c442a..e5a5716341 100644 --- a/Fw/Com/ComBuffer.cpp +++ b/Fw/Com/ComBuffer.cpp @@ -15,26 +15,26 @@ namespace Fw { } ComBuffer::ComBuffer(const ComBuffer& other) : Fw::SerializeBufferBase() { - SerializeStatus stat = SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); } const ComBuffer& ComBuffer::operator=(const ComBuffer& other) { - SerializeStatus stat = SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); return *this; } NATIVE_UINT_TYPE ComBuffer::getBuffCapacity(void) const { - return sizeof(this->m_data); + return sizeof(this->m_bufferData); } const U8* ComBuffer::getBuffAddr(void) const { - return this->m_data; + return this->m_bufferData; } U8* ComBuffer::getBuffAddr(void) { - return this->m_data; + return this->m_bufferData; } } diff --git a/Fw/Com/ComBuffer.hpp b/Fw/Com/ComBuffer.hpp index dfa7189778..309ce70216 100644 --- a/Fw/Com/ComBuffer.hpp +++ b/Fw/Com/ComBuffer.hpp @@ -37,7 +37,7 @@ namespace Fw { const U8* getBuffAddr(void) const; private: - U8 m_data[FW_COM_BUFFER_MAX_SIZE]; // packet data buffer + U8 m_bufferData[FW_COM_BUFFER_MAX_SIZE]; // packet data buffer }; } diff --git a/Fw/Log/LogBuffer.cpp b/Fw/Log/LogBuffer.cpp index e43c9e5ca2..7826eaa0bd 100644 --- a/Fw/Log/LogBuffer.cpp +++ b/Fw/Log/LogBuffer.cpp @@ -15,26 +15,26 @@ namespace Fw { } LogBuffer::LogBuffer(const LogBuffer& other) : Fw::SerializeBufferBase() { - SerializeStatus stat = SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); } const LogBuffer& LogBuffer::operator=(const LogBuffer& other) { - SerializeStatus stat = SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); return *this; } NATIVE_UINT_TYPE LogBuffer::getBuffCapacity(void) const { - return sizeof(this->m_data); + return sizeof(this->m_bufferData); } const U8* LogBuffer::getBuffAddr(void) const { - return this->m_data; + return this->m_bufferData; } U8* LogBuffer::getBuffAddr(void) { - return this->m_data; + return this->m_bufferData; } } diff --git a/Fw/Log/LogBuffer.hpp b/Fw/Log/LogBuffer.hpp index 1e2caaedb7..5ee4c5a7d3 100644 --- a/Fw/Log/LogBuffer.hpp +++ b/Fw/Log/LogBuffer.hpp @@ -38,7 +38,7 @@ namespace Fw { const U8* getBuffAddr(void) const; private: - U8 m_data[FW_LOG_BUFFER_MAX_SIZE]; // command argument buffer + U8 m_bufferData[FW_LOG_BUFFER_MAX_SIZE]; // command argument buffer }; } diff --git a/Fw/Tlm/TlmBuffer.cpp b/Fw/Tlm/TlmBuffer.cpp index 3f857d2d18..51dc444193 100644 --- a/Fw/Tlm/TlmBuffer.cpp +++ b/Fw/Tlm/TlmBuffer.cpp @@ -15,26 +15,26 @@ namespace Fw { } TlmBuffer::TlmBuffer(const TlmBuffer& other) : Fw::SerializeBufferBase() { - SerializeStatus stat = SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); } const TlmBuffer& TlmBuffer::operator=(const TlmBuffer& other) { - SerializeStatus stat = SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast(stat)); return *this; } NATIVE_UINT_TYPE TlmBuffer::getBuffCapacity(void) const { - return sizeof(this->m_data); + return sizeof(this->m_bufferData); } const U8* TlmBuffer::getBuffAddr(void) const { - return this->m_data; + return this->m_bufferData; } U8* TlmBuffer::getBuffAddr(void) { - return this->m_data; + return this->m_bufferData; } } diff --git a/Fw/Tlm/TlmBuffer.hpp b/Fw/Tlm/TlmBuffer.hpp index 63980f5eff..543e4af9b8 100644 --- a/Fw/Tlm/TlmBuffer.hpp +++ b/Fw/Tlm/TlmBuffer.hpp @@ -37,7 +37,7 @@ namespace Fw { const U8* getBuffAddr(void) const; PRIVATE: - U8 m_data[FW_TLM_BUFFER_MAX_SIZE]; // command argument buffer + U8 m_bufferData[FW_TLM_BUFFER_MAX_SIZE]; // command argument buffer }; } diff --git a/Utils/Hash/HashBuffer.hpp b/Utils/Hash/HashBuffer.hpp index cc8c49cfbd..b14c74faec 100644 --- a/Utils/Hash/HashBuffer.hpp +++ b/Utils/Hash/HashBuffer.hpp @@ -71,7 +71,7 @@ namespace Utils { //! The buffer which stores the hash digest //! - U8 m_data[HASH_DIGEST_LENGTH]; // packet data buffer + U8 m_bufferData[HASH_DIGEST_LENGTH]; // packet data buffer }; } diff --git a/Utils/Hash/HashBufferCommon.cpp b/Utils/Hash/HashBufferCommon.cpp index 7b038243d2..7a1daf0ba9 100644 --- a/Utils/Hash/HashBufferCommon.cpp +++ b/Utils/Hash/HashBufferCommon.cpp @@ -15,12 +15,12 @@ namespace Utils { } HashBuffer::HashBuffer(const HashBuffer& other) : Fw::SerializeBufferBase() { - Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(Fw::FW_SERIALIZE_OK == stat,static_cast(stat)); } const HashBuffer& HashBuffer::operator=(const HashBuffer& other) { - Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_data,other.getBuffLength()); + Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength()); FW_ASSERT(Fw::FW_SERIALIZE_OK == stat,static_cast(stat)); return *this; } @@ -38,14 +38,14 @@ namespace Utils { } const U8* HashBuffer::getBuffAddr(void) const { - return this->m_data; + return this->m_bufferData; } U8* HashBuffer::getBuffAddr(void) { - return this->m_data; + return this->m_bufferData; } NATIVE_UINT_TYPE HashBuffer::getBuffCapacity(void) const { - return sizeof(this->m_data); + return sizeof(this->m_bufferData); } } From 0ecaf14a9bba7bac18643b023486e4010b39ae19 Mon Sep 17 00:00:00 2001 From: Timothy Canham Date: Wed, 30 Jun 2021 07:46:20 -0700 Subject: [PATCH 3/8] VxWorks and virtual destructors --- Drv/Ip/IpSocket.cpp | 8 +++++--- Drv/Ip/IpSocket.hpp | 1 + Svc/FramingProtocol/DeframingProtocol.hpp | 1 + Svc/FramingProtocol/DeframingProtocolInterface.hpp | 1 + Svc/FramingProtocol/FramingProtocol.hpp | 1 + Svc/FramingProtocol/FramingProtocolInterface.hpp | 1 + 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Drv/Ip/IpSocket.cpp b/Drv/Ip/IpSocket.cpp index ed04a4329f..38da158724 100644 --- a/Drv/Ip/IpSocket.cpp +++ b/Drv/Ip/IpSocket.cpp @@ -72,8 +72,8 @@ SocketIpStatus IpSocket::setupTimeouts(NATIVE_INT_TYPE socketFd) { if (setsockopt(socketFd, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeout, sizeof(timeout)) < 0) { return SOCK_FAILED_TO_SET_SOCKET_OPTIONS; } - return SOCK_SUCCESS; #endif + return SOCK_SUCCESS; } SocketIpStatus IpSocket::addressToIp4(const char* address, void* ip4) { @@ -81,11 +81,13 @@ SocketIpStatus IpSocket::addressToIp4(const char* address, void* ip4) { FW_ASSERT(ip4 != NULL); // Get the IP address from host #ifdef TGT_OS_TYPE_VXWORKS - U32 ip = inet_addr(address); + NATIVE_INT_TYPE ip = inet_addr(address); if (ip == ERROR) { return SOCK_INVALID_IP_ADDRESS; } - *ip4 = ip; + // from sin_addr, which has one struct + // member s_addr, which is unsigned int + *reinterpret_cast(ip4) = ip; #else // First IP address to socket sin_addr if (not ::inet_pton(AF_INET, address, ip4)) { diff --git a/Drv/Ip/IpSocket.hpp b/Drv/Ip/IpSocket.hpp index 4d40a754e6..afb48c6d0a 100644 --- a/Drv/Ip/IpSocket.hpp +++ b/Drv/Ip/IpSocket.hpp @@ -45,6 +45,7 @@ enum SocketIpStatus { class IpSocket { public: IpSocket(); + virtual ~IpSocket(){}; /** * \brief configure the ip socket with host and transmission timeouts * diff --git a/Svc/FramingProtocol/DeframingProtocol.hpp b/Svc/FramingProtocol/DeframingProtocol.hpp index 352c18b660..890c65f074 100644 --- a/Svc/FramingProtocol/DeframingProtocol.hpp +++ b/Svc/FramingProtocol/DeframingProtocol.hpp @@ -32,6 +32,7 @@ namespace Svc { */ class DeframingProtocol { public: + virtual ~DeframingProtocol(){}; /** * \brief Status of the deframing call */ diff --git a/Svc/FramingProtocol/DeframingProtocolInterface.hpp b/Svc/FramingProtocol/DeframingProtocolInterface.hpp index cb4ef93e7c..0850788e8e 100644 --- a/Svc/FramingProtocol/DeframingProtocolInterface.hpp +++ b/Svc/FramingProtocol/DeframingProtocolInterface.hpp @@ -25,6 +25,7 @@ */ class DeframingProtocolInterface { public: + virtual ~DeframingProtocolInterface(){}; /** * \brief called to allocate memory, typically delegating to an allocate port call * \param size: size of the allocation request diff --git a/Svc/FramingProtocol/FramingProtocol.hpp b/Svc/FramingProtocol/FramingProtocol.hpp index 1a675a64e2..7a87290e03 100644 --- a/Svc/FramingProtocol/FramingProtocol.hpp +++ b/Svc/FramingProtocol/FramingProtocol.hpp @@ -33,6 +33,7 @@ class FramingProtocol { //! \brief constructor //! FramingProtocol(); + virtual ~FramingProtocol(){}; //! \brief setup function called to supply the interface used for allocation and sending //! \param interface: interface implementation, normally FramerComponentImpl diff --git a/Svc/FramingProtocol/FramingProtocolInterface.hpp b/Svc/FramingProtocol/FramingProtocolInterface.hpp index b768ebb657..b997228d88 100644 --- a/Svc/FramingProtocol/FramingProtocolInterface.hpp +++ b/Svc/FramingProtocol/FramingProtocolInterface.hpp @@ -25,6 +25,7 @@ */ class FramingProtocolInterface { public: + virtual ~FramingProtocolInterface(){}; //! \brief allocation callback to allocate memory when framing //! \param size: size of the allocation request //! \return buffer wrapping allocated memory From 707c857629e8c074a1ea7eec05a9cd4b3606e44c Mon Sep 17 00:00:00 2001 From: Timothy Canham Date: Wed, 30 Jun 2021 10:57:39 -0700 Subject: [PATCH 4/8] Added Vxworks fatal handler compile --- Svc/FatalHandler/CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Svc/FatalHandler/CMakeLists.txt b/Svc/FatalHandler/CMakeLists.txt index 7f9e3841ff..a1d608d5e8 100644 --- a/Svc/FatalHandler/CMakeLists.txt +++ b/Svc/FatalHandler/CMakeLists.txt @@ -6,11 +6,25 @@ # # Note: using PROJECT_NAME as EXECUTABLE_NAME #### + set(SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentAi.xml" "${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentCommonImpl.cpp" - "${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentLinuxImpl.cpp" ) + +message(STATUS "${CMAKE_SYSTEM_NAME} System}") + +if(CMAKE_SYSTEM_NAME STREQUAL "VxWorks") + list(APPEND SOURCE_FILES + "${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentVxWorksImpl.cpp" + ) +else() + list(APPEND SOURCE_FILES + "${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentLinuxImpl.cpp" + ) +endif() + + set(MOD_DEPS Os Fw/Logger From 4969c2f5afa0f96fd93c3d34af3f2e45af23d3ce Mon Sep 17 00:00:00 2001 From: Timothy Canham Date: Wed, 30 Jun 2021 14:23:35 -0700 Subject: [PATCH 5/8] Fixed active component schematron --- Autocoders/Python/schema/default/active_comp_schematron.rng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Autocoders/Python/schema/default/active_comp_schematron.rng b/Autocoders/Python/schema/default/active_comp_schematron.rng index 38df162309..8eaeb5bb74 100644 --- a/Autocoders/Python/schema/default/active_comp_schematron.rng +++ b/Autocoders/Python/schema/default/active_comp_schematron.rng @@ -3,7 +3,7 @@ xmlns="http://purl.oclc.org/dsdl/schematron"> - + Active components should have at least 1 port of kind async_input or internal_interface. From 3a47208467c69d989618787afad5038fa032a08d Mon Sep 17 00:00:00 2001 From: Timothy Canham Date: Wed, 30 Jun 2021 16:31:45 -0700 Subject: [PATCH 6/8] Changed ActiveTextLogger to use Fw::Logger to avoid VxWorks mushing of output --- Svc/ActiveTextLogger/ActiveTextLoggerImpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Svc/ActiveTextLogger/ActiveTextLoggerImpl.cpp b/Svc/ActiveTextLogger/ActiveTextLoggerImpl.cpp index 96b68955f9..a3f5f5d6f2 100644 --- a/Svc/ActiveTextLogger/ActiveTextLoggerImpl.cpp +++ b/Svc/ActiveTextLogger/ActiveTextLoggerImpl.cpp @@ -5,6 +5,7 @@ #include #include +#include #include namespace Svc { @@ -130,7 +131,7 @@ namespace Svc { { // Print to console: - (void) printf("%s",text.toChar()); + Fw::Logger::logMsg(text.toChar(),0,0,0,0,0,0,0,0,0); // Print to file if there is one: (void) this->m_log_file.write_to_log(text.toChar(), text.length()); // Ignoring return status From cd9c2c53c673af99e12bac49cb06132ca210b4ff Mon Sep 17 00:00:00 2001 From: Kyle Botteon Date: Tue, 20 Jul 2021 11:05:00 -0700 Subject: [PATCH 7/8] fix(BufferManager): size checking logic and assert cleanup --- Svc/BufferManager/BufferManagerComponentImpl.cpp | 9 ++++++--- Svc/BufferManager/test/ut/Tester.cpp | 16 ++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Svc/BufferManager/BufferManagerComponentImpl.cpp b/Svc/BufferManager/BufferManagerComponentImpl.cpp index 04cd604fe7..45d1b21c79 100644 --- a/Svc/BufferManager/BufferManagerComponentImpl.cpp +++ b/Svc/BufferManager/BufferManagerComponentImpl.cpp @@ -123,7 +123,7 @@ namespace Svc { FW_ASSERT(m_buffers); // find smallest buffer based on size. for (NATIVE_UINT_TYPE buff = 0; buff < this->m_numStructs; buff++) { - if ((not this->m_buffers[buff].allocated) and (size < this->m_buffers[buff].size)) { + if ((not this->m_buffers[buff].allocated) and (size <= this->m_buffers[buff].size)) { this->m_buffers[buff].allocated = true; this->m_currBuffs++; if (this->m_currBuffs > this->m_highWater) { @@ -203,8 +203,11 @@ namespace Svc { } } - // check some assertions - FW_ASSERT(bufferMem == (static_cast(memory) + memorySize)); + // check that the initiation pointer made it to the end of allocated space + U8* const CURR_PTR = bufferMem; + U8* const END_PTR = static_cast(memory) + memorySize; + FW_ASSERT(CURR_PTR == END_PTR, reinterpret_cast(CURR_PTR), reinterpret_cast(END_PTR)); + // secondary init verification FW_ASSERT(currStruct == this->m_numStructs,currStruct,this->m_numStructs); // indicate setup is done this->m_setup = true; diff --git a/Svc/BufferManager/test/ut/Tester.cpp b/Svc/BufferManager/test/ut/Tester.cpp index 3ab33965be..775bd058f7 100644 --- a/Svc/BufferManager/test/ut/Tester.cpp +++ b/Svc/BufferManager/test/ut/Tester.cpp @@ -206,7 +206,7 @@ namespace Svc { for (NATIVE_UINT_TYPE b=0; binvoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE-1); + buffs[b] = this->invoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE); // check allocation state ASSERT_TRUE(this->component.m_buffers[b].allocated); // check stats @@ -217,7 +217,7 @@ namespace Svc { // should send back empty buffer - Fw::Buffer noBuff = this->invoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE-1); + Fw::Buffer noBuff = this->invoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE); ASSERT_EQ(1,this->component.m_noBuffs); // check telemetry @@ -311,7 +311,7 @@ namespace Svc { for (NATIVE_UINT_TYPE b=0; binvoke_to_bufferGetCallee(0,BIN0_BUFFER_SIZE-1); + buffs[b] = this->invoke_to_bufferGetCallee(0,BIN0_BUFFER_SIZE); // check allocation state ASSERT_TRUE(this->component.m_buffers[b].allocated); // check stats @@ -323,7 +323,7 @@ namespace Svc { REQUIREMENT("FPRIME-BM-003"); // should send back empty buffer - Fw::Buffer noBuff = this->invoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE-1); + Fw::Buffer noBuff = this->invoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE); ASSERT_EQ(1,this->component.m_noBuffs); // check telemetry @@ -385,7 +385,7 @@ namespace Svc { for (NATIVE_UINT_TYPE b=0; binvoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE-1); + buffs[b] = this->invoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE); // check allocation state - should be allocating from bin 1 ASSERT_TRUE(this->component.m_buffers[b+BIN0_NUM_BUFFERS].allocated); // check stats @@ -393,7 +393,7 @@ namespace Svc { } // should send back empty buffer - noBuff = this->invoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE-1); + noBuff = this->invoke_to_bufferGetCallee(0,BIN1_BUFFER_SIZE); ASSERT_EQ(2,this->component.m_noBuffs); // check telemetry @@ -444,7 +444,7 @@ namespace Svc { for (NATIVE_UINT_TYPE b=0; binvoke_to_bufferGetCallee(0,BIN2_BUFFER_SIZE-1); + buffs[b] = this->invoke_to_bufferGetCallee(0,BIN2_BUFFER_SIZE); // check allocation state - should be allocating from bin 1 ASSERT_TRUE(this->component.m_buffers[b+BIN0_NUM_BUFFERS+BIN1_NUM_BUFFERS].allocated); // check stats @@ -452,7 +452,7 @@ namespace Svc { } // should send back empty buffer - noBuff = this->invoke_to_bufferGetCallee(0,BIN2_BUFFER_SIZE-1); + noBuff = this->invoke_to_bufferGetCallee(0,BIN2_BUFFER_SIZE); ASSERT_EQ(3,this->component.m_noBuffs); // check telemetry From 78995491f966820e47ea02ef723ed2a525727cff Mon Sep 17 00:00:00 2001 From: Kyle Botteon Date: Tue, 20 Jul 2021 13:53:05 -0700 Subject: [PATCH 8/8] fix: change U64 to POINTER_CAST --- Svc/BufferManager/BufferManagerComponentImpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Svc/BufferManager/BufferManagerComponentImpl.cpp b/Svc/BufferManager/BufferManagerComponentImpl.cpp index 45d1b21c79..b3c83765a1 100644 --- a/Svc/BufferManager/BufferManagerComponentImpl.cpp +++ b/Svc/BufferManager/BufferManagerComponentImpl.cpp @@ -206,7 +206,8 @@ namespace Svc { // check that the initiation pointer made it to the end of allocated space U8* const CURR_PTR = bufferMem; U8* const END_PTR = static_cast(memory) + memorySize; - FW_ASSERT(CURR_PTR == END_PTR, reinterpret_cast(CURR_PTR), reinterpret_cast(END_PTR)); + FW_ASSERT(CURR_PTR == END_PTR, + reinterpret_cast(CURR_PTR), reinterpret_cast(END_PTR)); // secondary init verification FW_ASSERT(currStruct == this->m_numStructs,currStruct,this->m_numStructs); // indicate setup is done