diff --git a/CMakeLists.txt b/CMakeLists.txt index dc98952..d2d7116 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,10 @@ project(foo VERSION 0.1.0) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# This adds a library target called "foo" -add_executable(fsfw-from-zero) -target_sources(fsfw-from-zero PRIVATE main.cpp) +add_subdirectory(start) -# target_link_libraries(fsfw-from-zero PRIVATE fsfw) +set(FSFW_OSAL host) +set(FSFW_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/start) + +add_subdirectory(fsfw) +target_link_libraries(fsfw-from-zero PRIVATE fsfw) diff --git a/fsfw b/fsfw index eb8e236..715d5ac 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit eb8e236cd4f5aec692aba89eb004a8e3dd3d53fb +Subproject commit 715d5ac39f0ea23e5edc28c653fac8b4561f5526 diff --git a/main.cpp b/main.cpp deleted file mode 100644 index a79aad7..0000000 --- a/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -using namespace std; - -int main() { - cout << "hello world!" << endl; -} \ No newline at end of file diff --git a/start/CMakeLists.txt b/start/CMakeLists.txt new file mode 100644 index 0000000..b53e048 --- /dev/null +++ b/start/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(fsfw-from-zero) +target_sources(fsfw-from-zero PRIVATE main.cpp) +target_include_directories(fsfw-from-zero PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/start/FSFWConfig.h b/start/FSFWConfig.h new file mode 100644 index 0000000..adf9912 --- /dev/null +++ b/start/FSFWConfig.h @@ -0,0 +1,75 @@ +#ifndef CONFIG_FSFWCONFIG_H_ +#define CONFIG_FSFWCONFIG_H_ + +#include +#include + +//! Used to determine whether C++ ostreams are used which can increase +//! the binary size significantly. If this is disabled, +//! the C stdio functions can be used alternatively +#define FSFW_CPP_OSTREAM_ENABLED 1 + +//! More FSFW related printouts depending on level. Useful for development. +#define FSFW_VERBOSE_LEVEL 1 + +//! Can be used to completely disable printouts, even the C stdio ones. +#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 + #define FSFW_DISABLE_PRINTOUT 0 +#endif + +#define FSFW_USE_PUS_C_TELEMETRY 1 +#define FSFW_USE_PUS_C_TELECOMMANDS 1 + +//! Can be used to disable the ANSI color sequences for C stdio. +#define FSFW_COLORED_OUTPUT 1 + +//! If FSFW_OBJ_EVENT_TRANSLATION is set to one, +//! additional output which requires the translation files translateObjects +//! and translateEvents (and their compiled source files) +#define FSFW_OBJ_EVENT_TRANSLATION 0 + +#if FSFW_OBJ_EVENT_TRANSLATION == 1 +//! Specify whether info events are printed too. +#define FSFW_DEBUG_INFO 1 +#include "objects/translateObjects.h" +#include "events/translateEvents.h" +#else +#endif + +//! When using the newlib nano library, C99 support for stdio facilities +//! will not be provided. This define should be set to 1 if this is the case. +#define FSFW_NO_C99_IO 1 + +//! Specify whether a special mode store is used for Subsystem components. +#define FSFW_USE_MODESTORE 0 + +//! Defines if the real time scheduler for linux should be used. +//! If set to 0, this will also disable priority settings for linux +//! as most systems will not allow to set nice values without privileges +//! For embedded linux system set this to 1. +//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run +#define FSFW_USE_REALTIME_FOR_LINUX 1 + +namespace fsfwconfig { + +//! Default timestamp size. The default timestamp will be an seven byte CDC short timestamp. +static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7; + +//! Configure the allocated pool sizes for the event manager. +static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240; +static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120; +static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; + +//! Defines the FIFO depth of each commanding service base which +//! also determines how many commands a CSB service can handle in one cycle +//! simultaneously. This will increase the required RAM for +//! each CSB service ! +static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6; + +static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124; + +static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; + +} + +#endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/start/main.cpp b/start/main.cpp new file mode 100644 index 0000000..0dd5eed --- /dev/null +++ b/start/main.cpp @@ -0,0 +1,19 @@ +#include + +#include "fsfw/serviceinterface.h" +#include "FSFWConfig.h" + +using namespace std; + + +#if FSFW_CPP_OSTREAM_ENABLED == 1 +ServiceInterfaceStream sif::debug("DEBUG", false); +ServiceInterfaceStream sif::info("INFO", false); +ServiceInterfaceStream sif::warning("WARNING", false); +ServiceInterfaceStream sif::error("ERROR", false, true, true); +#endif + + +int main() { + cout << "hello world!" << endl; +} \ No newline at end of file