From 7447c5dada68fc6ecd419d619f4acf8eee0e72c6 Mon Sep 17 00:00:00 2001 From: Michael D Starch Date: Thu, 6 Feb 2025 10:59:03 -0800 Subject: [PATCH] Removing error console and restoring assert functionality --- Fw/Port/PortBase.cpp | 4 ++-- Fw/Types/Assert.cpp | 5 +++-- Os/Posix/CMakeLists.txt | 7 ------- Os/Posix/DefaultErrorConsole.cpp | 16 ---------------- Os/Stub/test/CMakeLists.txt | 2 -- cmake/API.cmake | 2 +- 6 files changed, 6 insertions(+), 30 deletions(-) delete mode 100644 Os/Posix/DefaultErrorConsole.cpp diff --git a/Fw/Port/PortBase.cpp b/Fw/Port/PortBase.cpp index 25da27c715..10621269b9 100644 --- a/Fw/Port/PortBase.cpp +++ b/Fw/Port/PortBase.cpp @@ -85,7 +85,7 @@ namespace Fw { FW_ASSERT(size > 0); // Get the port-custom format string const char* formatString = this->getToStringFormatString(); - // Determine this port object name (or use "UNKOWN") + // Determine this port object name (or use "UNKNOWN") const char* object_name = #if FW_OBJECT_NAMES == 1 this->m_objName.toChar(); @@ -95,7 +95,7 @@ namespace Fw { // Get the C/NC for connected or not const char* this_is_connected = this->isConnected() ? "C" : "NC"; - // Get the name of the connectioned object, "UNKNNOWN" or "NONE" + // Get the name of the connection object, "UNKNOWN" or "NONE" const char* connected_to = this->isConnected() ? #if FW_OBJECT_NAMES == 1 this->m_connObj->getObjName() diff --git a/Fw/Types/Assert.cpp b/Fw/Types/Assert.cpp index 6a014cb877..a05280f274 100644 --- a/Fw/Types/Assert.cpp +++ b/Fw/Types/Assert.cpp @@ -1,8 +1,9 @@ #include #include #include -#include +#include #include +#include #if FW_ASSERT_LEVEL == FW_FILEID_ASSERT #define fileIdFs "Assert: 0x%08" PRIx32 ":%" PRI_PlatformUIntType @@ -13,7 +14,7 @@ namespace Fw { void defaultPrintAssert(const CHAR* msg) { - Fw::Logger::log("%s", msg); + (void) fwrite(msg, sizeof(CHAR), static_cast(Fw::StringUtils::string_length(msg, FW_ASSERT_TEXT_SIZE)), stderr); } void defaultReportAssert(FILE_NAME_ARG file, diff --git a/Os/Posix/CMakeLists.txt b/Os/Posix/CMakeLists.txt index 950cf4e7e2..9d6e594310 100644 --- a/Os/Posix/CMakeLists.txt +++ b/Os/Posix/CMakeLists.txt @@ -25,13 +25,6 @@ register_fprime_module(Os_Posix_Shared) register_os_implementation("File;FileSystem;Directory" Posix Os_Posix_Shared) register_os_implementation("Console" Posix) -# Special error console -set(MOD_DEPS "Os_Console_Common") -add_library("Os_Console_PosixError" INTERFACE) -add_dependencies("Os_Console_PosixError" "Os_Console_Common" "Os_Console_Posix") -target_link_libraries("Os_Console_PosixError" INTERFACE "Os_Console_Common" "Os_Console_Posix") -register_fprime_implementation("Os_Console" "Os_Console_PosixError" "${CMAKE_CURRENT_LIST_DIR}/DefaultErrorConsole.cpp") - register_os_implementation("Task" Posix Os_Posix_Shared Fw_Time) register_os_implementation("Mutex;ConditionVariable" Posix Os_Posix_Shared) register_os_implementation("RawTime" Posix Os_Posix_Shared) diff --git a/Os/Posix/DefaultErrorConsole.cpp b/Os/Posix/DefaultErrorConsole.cpp deleted file mode 100644 index 317c06a09a..0000000000 --- a/Os/Posix/DefaultErrorConsole.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// ====================================================================== -// \title Os/Posix/DefaultErrorConsole.cpp -// \brief sets default Os::Console to posix implementation via linker -// ====================================================================== -#include "Os/Console.hpp" -#include "Os/Posix/Console.hpp" -#include "Os/Delegate.hpp" - -namespace Os { -ConsoleInterface* ConsoleInterface::getDelegate(ConsoleHandleStorage& aligned_new_memory, const ConsoleInterface* to_copy) { - auto console = Os::Delegate::makeDelegate(aligned_new_memory, to_copy); - // Override the output file - reinterpret_cast(console->getHandle())->m_file_descriptor = stderr; - return console; -} -} diff --git a/Os/Stub/test/CMakeLists.txt b/Os/Stub/test/CMakeLists.txt index ae5f64e5ec..a160004ee7 100644 --- a/Os/Stub/test/CMakeLists.txt +++ b/Os/Stub/test/CMakeLists.txt @@ -19,8 +19,6 @@ register_os_implementation(Memory Test_Stub) register_os_implementation(Queue Test_Stub) register_os_implementation(RawTime Test_Stub) # add Fw_Buffer here? -# Use the error console for this -choose_fprime_implementation(Os_Console Os_Console_PosixError) #### File Stub Testing #### set(UT_SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/ut/StubFileTests.cpp" diff --git a/cmake/API.cmake b/cmake/API.cmake index 1bda4fdc03..b090c1fbca 100644 --- a/cmake/API.cmake +++ b/cmake/API.cmake @@ -669,7 +669,7 @@ endfunction() # Designates that the given implementor is the selected implementor for the needed implementation. Platforms must call # this function once for each defined IMPLEMENTATION. An executable/deployment/unit-test may call this function to set # a specific implementor for any needed implementation. FRAMEWORK_DEFAULT may be supplied to indicate a default choice -# set by the framework, which can be overriden by the platform and module selections. +# set by the framework, which can be overridden by the platform and module selections. # # **IMPLEMENTATION:** implementation module name that is implemented by IMPLEMENTOR # **IMPLEMENTOR:** implementor of IMPLEMENTATION