updated user folder
This commit is contained in:
parent
e1f92b3da4
commit
0b207b2b1a
@ -1,7 +1,7 @@
|
|||||||
#ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_
|
#ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_
|
||||||
#define FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_
|
#define FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_
|
||||||
|
|
||||||
#include <FSFWConfig.h>
|
#include "fsfw/FSFW.h"
|
||||||
#include "serviceInterfaceDefintions.h"
|
#include "serviceInterfaceDefintions.h"
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
# set(CMAKE_VERBOSE TRUE)
|
# set(CMAKE_VERBOSE TRUE)
|
||||||
|
# set(CODE_COVERAGE_VERBOSE TRUE)
|
||||||
|
|
||||||
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
@ -21,6 +22,8 @@ option(GENERATE_COVERAGE
|
|||||||
TRUE
|
TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(FSFW_ADD_UNITTESTS ON)
|
||||||
|
|
||||||
if(TMTC_TEST)
|
if(TMTC_TEST)
|
||||||
set(LINK_CATCH2 FALSE)
|
set(LINK_CATCH2 FALSE)
|
||||||
else()
|
else()
|
||||||
@ -28,8 +31,8 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Tests can be built with the Host OSAL or with the Linux OSAL.
|
# Tests can be built with the Host OSAL or with the Linux OSAL.
|
||||||
if(NOT OS_FSFW)
|
if(NOT FSFW_OSAL)
|
||||||
set(OS_FSFW host CACHE STRING "OS for the FSFW.")
|
set(FSFW_OSAL host CACHE STRING "OS for the FSFW.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(CUSTOM_UNITTEST_RUNNER
|
option(CUSTOM_UNITTEST_RUNNER
|
||||||
@ -41,7 +44,7 @@ option(CUSTOM_UNITTEST_RUNNER
|
|||||||
#pre_project_config()
|
#pre_project_config()
|
||||||
|
|
||||||
# Project Name
|
# Project Name
|
||||||
project(fsfw_tests C CXX)
|
project(fsfw-tests C CXX)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Pre-Sources preparation
|
# Pre-Sources preparation
|
||||||
@ -71,7 +74,7 @@ set(TMTC_TEST_PATH tests)
|
|||||||
# determine BSP_PATH
|
# determine BSP_PATH
|
||||||
|
|
||||||
# FreeRTOS
|
# FreeRTOS
|
||||||
if(${OS_FSFW} STREQUAL linux)
|
if(FSFW_OSAL STREQUAL linux)
|
||||||
add_definitions(-DUNIX -DLINUX)
|
add_definitions(-DUNIX -DLINUX)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
# Hosted
|
# Hosted
|
||||||
@ -94,6 +97,11 @@ if(GENERATE_COVERAGE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(FSFW_CONFIG_PATH testcfg)
|
set(FSFW_CONFIG_PATH testcfg)
|
||||||
|
set(FSFW_ADDITIONAL_INC_PATHS ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
||||||
|
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
||||||
|
configure_file(${FSFW_CONFIG_PATH}/TestsConfig.h.in TestsConfig.h)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Executable and Sources
|
# Executable and Sources
|
||||||
@ -108,10 +116,16 @@ add_subdirectory(${FSFW_CONFIG_PATH})
|
|||||||
|
|
||||||
if(LINK_CATCH2)
|
if(LINK_CATCH2)
|
||||||
add_subdirectory(${CATCH2_PATH})
|
add_subdirectory(${CATCH2_PATH})
|
||||||
add_subdirectory(${FSFW_TESTS_PATH})
|
|
||||||
add_subdirectory(${TEST_SETUP_PATH})
|
add_subdirectory(${TEST_SETUP_PATH})
|
||||||
else()
|
else()
|
||||||
|
target_compile_definitions(${TARGET_NAME} PRIVATE
|
||||||
|
FSFW_DISABLE_PRINTOUT=0
|
||||||
|
)
|
||||||
|
target_compile_definitions(${LIB_FSFW_NAME} PRIVATE
|
||||||
|
FSFW_DISABLE_PRINTOUT=0
|
||||||
|
)
|
||||||
add_subdirectory(${TMTC_TEST_PATH})
|
add_subdirectory(${TMTC_TEST_PATH})
|
||||||
|
add_subdirectory(${FSFW_TESTS_PATH})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@ -132,7 +146,7 @@ endif()
|
|||||||
|
|
||||||
if(GENERATE_COVERAGE)
|
if(GENERATE_COVERAGE)
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(CODE_COVERAGE_VERBOSE TRUE)
|
# set(CODE_COVERAGE_VERBOSE TRUE)
|
||||||
include(CodeCoverage)
|
include(CodeCoverage)
|
||||||
|
|
||||||
# Remove quotes.
|
# Remove quotes.
|
||||||
@ -194,6 +208,7 @@ endif()
|
|||||||
target_include_directories(${TARGET_NAME} PRIVATE
|
target_include_directories(${TARGET_NAME} PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${FSFW_CONFIG_PATH}
|
${FSFW_CONFIG_PATH}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
@ -225,12 +240,9 @@ if(CMAKE_VERBOSE)
|
|||||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Compile options for all sources.
|
# Compile options for all sources.
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
target_compile_options(${TARGET_NAME} PRIVATE
|
||||||
$<$<COMPILE_LANGUAGE:C>:${WARNING_FLAGS} ${COMPILER_FLAGS}>
|
${WARNING_FLAGS}
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${WARNING_FLAGS} ${COMPILER_FLAGS}>
|
|
||||||
${ABI_FLAGS}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT CMAKE_SIZE)
|
if(NOT CMAKE_SIZE)
|
||||||
@ -240,12 +252,16 @@ if(NOT CMAKE_SIZE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
string(CONCAT POST_BUILD_COMMENT
|
||||||
|
"Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||||
|
"Target OSAL: ${FSFW_OSAL}\n"
|
||||||
|
"Target Build Type: ${CMAKE_BUILD_TYPE}"
|
||||||
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET ${TARGET_NAME}
|
add_custom_command(TARGET ${TARGET_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND echo "Build directory: ${CMAKE_BINARY_DIR}"
|
|
||||||
COMMAND echo "Target OSAL: ${OS_FSFW}"
|
|
||||||
COMMAND echo "Target Build Type: ${CMAKE_BUILD_TYPE}"
|
|
||||||
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX}
|
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX}
|
||||||
|
COMMENT ${POST_BUILD_COMMENT}
|
||||||
)
|
)
|
||||||
|
|
||||||
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
||||||
|
@ -7,18 +7,24 @@
|
|||||||
//! Used to determine whether C++ ostreams are used which can increase
|
//! Used to determine whether C++ ostreams are used which can increase
|
||||||
//! the binary size significantly. If this is disabled,
|
//! the binary size significantly. If this is disabled,
|
||||||
//! the C stdio functions can be used alternatively
|
//! the C stdio functions can be used alternatively
|
||||||
#define FSFW_CPP_OSTREAM_ENABLED 1
|
#define FSFW_CPP_OSTREAM_ENABLED 0
|
||||||
|
|
||||||
//! More FSFW related printouts depending on level. Useful for development.
|
//! More FSFW related printouts. Useful for development.
|
||||||
#define FSFW_VERBOSE_LEVEL 1
|
#define FSFW_ENHANCED_PRINTOUT 0
|
||||||
|
|
||||||
//! Can be used to completely disable printouts, even the C stdio ones.
|
//! Can be used to completely disable printouts, even the C stdio ones.
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0
|
//! By default, printouts will be disabled for the unit tests.
|
||||||
#define FSFW_DISABLE_PRINTOUT 0
|
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_ENHANCED_PRINTOUT == 0
|
||||||
|
#ifndef FSFW_DISABLE_PRINTOUT
|
||||||
|
#define FSFW_DISABLE_PRINTOUT 1
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//! Can be used to enable additional debugging printouts for developing the FSFW
|
||||||
|
#define FSFW_PRINT_VERBOSITY_LEVEL 0
|
||||||
|
|
||||||
//! Can be used to disable the ANSI color sequences for C stdio.
|
//! Can be used to disable the ANSI color sequences for C stdio.
|
||||||
#define FSFW_COLORED_OUTPUT 1
|
#define FSFW_COLORED_OUTPUT 0
|
||||||
|
|
||||||
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
|
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
|
||||||
//! additional output which requires the translation files translateObjects
|
//! additional output which requires the translation files translateObjects
|
||||||
@ -40,6 +46,13 @@
|
|||||||
//! Specify whether a special mode store is used for Subsystem components.
|
//! Specify whether a special mode store is used for Subsystem components.
|
||||||
#define FSFW_USE_MODESTORE 0
|
#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 {
|
namespace fsfwconfig {
|
||||||
//! Default timestamp size. The default timestamp will be an eight byte CDC
|
//! Default timestamp size. The default timestamp will be an eight byte CDC
|
||||||
//! short timestamp.
|
//! short timestamp.
|
||||||
@ -57,6 +70,9 @@ static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
|
|||||||
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
|
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
|
||||||
|
|
||||||
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
|
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
|
||||||
|
|
||||||
|
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 1500;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_FSFWCONFIG_H_ */
|
#endif /* CONFIG_FSFWCONFIG_H_ */
|
@ -1,416 +0,0 @@
|
|||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Makefile for FSFW Test
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# User-modifiable options
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Fundamentals on the build process of C/C++ Software:
|
|
||||||
# https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html
|
|
||||||
|
|
||||||
# Make documentation: https://www.gnu.org/software/make/manual/make.pdf
|
|
||||||
# Online: https://www.gnu.org/software/make/manual/make.html
|
|
||||||
# General rules: http://make.mad-scientist.net/papers/rules-of-makefiles/#rule3
|
|
||||||
SHELL = /bin/sh
|
|
||||||
|
|
||||||
# Chip & board used for compilation
|
|
||||||
# (can be overriden by adding CHIP=chip and BOARD=board to the command-line)
|
|
||||||
# Unit Test can only be run on host machine for now (Linux)
|
|
||||||
FRAMEWORK_PATH = fsfw
|
|
||||||
TEST_FILE_ROOT = $(FRAMEWORK_PATH)/unittest
|
|
||||||
BOARD = unittest
|
|
||||||
LINUX = 1
|
|
||||||
OS_FSFW = linux
|
|
||||||
CUSTOM_DEFINES += -D$(OS_FSFW)
|
|
||||||
|
|
||||||
# Copied from stackoverflow, can be used to differentiate between Windows
|
|
||||||
# and Linux
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
CUSTOM_DEFINES += -DWIN32
|
|
||||||
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
|
|
||||||
CUSTOM_DEFINES += -DAMD64
|
|
||||||
else
|
|
||||||
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
|
|
||||||
CUSTOM_DEFINES += -DAMD64
|
|
||||||
endif
|
|
||||||
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
|
|
||||||
CUSTOM_DEFINES += -DIA32
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
UNAME_S := $(shell uname -s)
|
|
||||||
ifeq ($(UNAME_S),Linux)
|
|
||||||
DETECTED_OS = LINUX
|
|
||||||
CUSTOM_DEFINES += -DLINUX
|
|
||||||
endif
|
|
||||||
ifeq ($(UNAME_S),Darwin)
|
|
||||||
CUSTOM_DEFINES += -DOSX
|
|
||||||
endif
|
|
||||||
UNAME_P := $(shell uname -p)
|
|
||||||
ifeq ($(UNAME_P),x86_64)
|
|
||||||
CUSTOM_DEFINES += -DAMD64
|
|
||||||
endif
|
|
||||||
ifneq ($(filter %86,$(UNAME_P)),)
|
|
||||||
CUSTOM_DEFINES += -DIA32
|
|
||||||
endif
|
|
||||||
ifneq ($(filter arm%,$(UNAME_P)),)
|
|
||||||
CUSTOM_DEFINES += -DARM
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
UNIT_TEST = 1
|
|
||||||
# General folder paths
|
|
||||||
CONFIG_PATH = testcfg
|
|
||||||
# Core copy has to be copied as well.
|
|
||||||
CORE_PATH = core
|
|
||||||
UNIT_TEST_PATH = $(TEST_FILE_ROOT)/tests
|
|
||||||
|
|
||||||
# Output file basename
|
|
||||||
BASENAME = fsfw
|
|
||||||
BINARY_NAME := $(BASENAME)-$(BOARD)
|
|
||||||
# Output files will be put in this directory inside
|
|
||||||
OUTPUT_FOLDER = $(OS)
|
|
||||||
|
|
||||||
# Optimization level. Optimized for debugging.
|
|
||||||
OPTIMIZATION = -O0
|
|
||||||
|
|
||||||
# Default debug output. Optimized for debugging.
|
|
||||||
DEBUG_LEVEL = -g3
|
|
||||||
|
|
||||||
ifdef GCOV
|
|
||||||
CUSTOM_DEFINES += -DGCOV
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# Output directories
|
|
||||||
BUILDPATH = _bin
|
|
||||||
DEPENDPATH = _dep
|
|
||||||
OBJECTPATH = _obj
|
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),mission)
|
|
||||||
BUILD_FOLDER = mission
|
|
||||||
else
|
|
||||||
BUILD_FOLDER = devel
|
|
||||||
endif
|
|
||||||
|
|
||||||
DEPENDDIR = $(DEPENDPATH)/$(OUTPUT_FOLDER)/$(BUILD_FOLDER)
|
|
||||||
OBJDIR = $(OBJECTPATH)/$(OUTPUT_FOLDER)/$(BUILD_FOLDER)
|
|
||||||
BINDIR = $(BUILDPATH)
|
|
||||||
|
|
||||||
CLEANDEP = $(DEPENDPATH)/$(OUTPUT_FOLDER)
|
|
||||||
CLEANOBJ = $(OBJECTPATH)/$(OUTPUT_FOLDER)
|
|
||||||
CLEANBIN = $(BUILDPATH)
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Tools and Includes
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Tool suffix when cross-compiling
|
|
||||||
CROSS_COMPILE =
|
|
||||||
|
|
||||||
# C Compiler
|
|
||||||
CC = $(CROSS_COMPILE)gcc
|
|
||||||
|
|
||||||
# C++ compiler
|
|
||||||
CXX = $(CROSS_COMPILE)g++
|
|
||||||
|
|
||||||
# Additional Tools
|
|
||||||
SIZE = $(CROSS_COMPILE)size
|
|
||||||
STRIP = $(CROSS_COMPILE)strip
|
|
||||||
CP = $(CROSS_COMPILE)objcopy
|
|
||||||
|
|
||||||
HEXCOPY = $(CP) -O ihex
|
|
||||||
BINCOPY = $(CP) -O binary
|
|
||||||
# files to be compiled, will be filled in by include makefiles
|
|
||||||
# := assignment is neccessary so we get all paths right
|
|
||||||
# https://www.gnu.org/software/make/manual/html_node/Flavors.html
|
|
||||||
CSRC :=
|
|
||||||
CXXSRC :=
|
|
||||||
ASRC :=
|
|
||||||
INCLUDES :=
|
|
||||||
|
|
||||||
# Directories where $(directoryname).mk files should be included from
|
|
||||||
SUBDIRS := $(FRAMEWORK_PATH) $(TEST_PATH) $(UNIT_TEST_PATH) $(CONFIG_PATH) \
|
|
||||||
$(CORE_PATH)
|
|
||||||
|
|
||||||
|
|
||||||
I_INCLUDES += $(addprefix -I, $(INCLUDES))
|
|
||||||
|
|
||||||
# This is a hack from http://make.mad-scientist.net/the-eval-function/
|
|
||||||
#
|
|
||||||
# The problem is, that included makefiles should be aware of their relative path
|
|
||||||
# but not need to guess or hardcode it. So we set $(CURRENTPATH) for them. If
|
|
||||||
# we do this globally and the included makefiles want to include other makefiles as
|
|
||||||
# well, they would overwrite $(CURRENTPATH), screwing the include after them.
|
|
||||||
#
|
|
||||||
# By using a for-loop with an eval'd macro, we can generate the code to include all
|
|
||||||
# sub-makefiles (with the correct $(CURRENTPATH) set) before actually evaluating
|
|
||||||
# (and by this possibly changing $(CURRENTPATH)) them.
|
|
||||||
#
|
|
||||||
# This works recursively, if an included makefile wants to include, it can safely set
|
|
||||||
# $(SUBDIRS) (which has already been evaluated here) and do
|
|
||||||
# "$(foreach S,$(SUBDIRS),$(eval $(INCLUDE_FILE)))"
|
|
||||||
# $(SUBDIRS) must be relative to the project root, so to include subdir foo, set
|
|
||||||
# $(SUBDIRS) = $(CURRENTPATH)/foo.
|
|
||||||
define INCLUDE_FILE
|
|
||||||
CURRENTPATH := $S
|
|
||||||
include $(S)/$(notdir $S).mk
|
|
||||||
endef
|
|
||||||
$(foreach S,$(SUBDIRS),$(eval $(INCLUDE_FILE)))
|
|
||||||
|
|
||||||
INCLUDES += $(TEST_FILE_ROOT)
|
|
||||||
INCLUDES += $(TEST_FILE_ROOT)/catch2/
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Source Files
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# All source files which are not includes by the .mk files are added here
|
|
||||||
# Please ensure that no files are included by both .mk file and here !
|
|
||||||
|
|
||||||
# if a target is not listed in the current directory,
|
|
||||||
# make searches in the directories specified with VPATH
|
|
||||||
|
|
||||||
# All C Sources included by .mk files are assigned here
|
|
||||||
# Add the objects to sources so dependency handling works
|
|
||||||
C_OBJECTS += $(CSRC:.c=.o)
|
|
||||||
|
|
||||||
# Objects built from Assembly source files
|
|
||||||
ASM_OBJECTS = $(ASRC:.S=.o)
|
|
||||||
|
|
||||||
# Objects built from C++ source files
|
|
||||||
CXX_OBJECTS += $(CXXSRC:.cpp=.o)
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Build Configuration + Output
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
TARGET = Debug build.
|
|
||||||
DEBUG_MESSAGE = Off
|
|
||||||
OPTIMIZATION_MESSAGE = Off
|
|
||||||
|
|
||||||
# Define Messages
|
|
||||||
MSG_INFO = Software: Hosted unittest \(Catch2\) for the FSFW.
|
|
||||||
MSG_OPTIMIZATION = Optimization: $(OPTIMIZATION), $(OPTIMIZATION_MESSAGE)
|
|
||||||
MSG_TARGET = Target Build: $(TARGET)
|
|
||||||
MSG_DEBUG = Debug level: $(DEBUG_LEVEL), FSFW Debugging: $(DEBUG_MESSAGE)
|
|
||||||
|
|
||||||
MSG_LINKING = Linking:
|
|
||||||
MSG_COMPILING = Compiling:
|
|
||||||
MSG_ASSEMBLING = Assembling:
|
|
||||||
MSG_DEPENDENCY = Collecting dependencies for:
|
|
||||||
MSG_BINARY = Generate binary:
|
|
||||||
|
|
||||||
# See https://stackoverflow.com/questions/6687630/how-to-remove-unused-c-c-symbols-with-gcc-and-ld
|
|
||||||
# Used to throw away unused code. Reduces code size significantly !
|
|
||||||
# -Wl,--gc-sections: needs to be passed to the linker to throw aways unused code
|
|
||||||
ifdef KEEP_UNUSED_CODE
|
|
||||||
PROTOTYPE_OPTIMIZATION =
|
|
||||||
UNUSED_CODE_REMOVAL =
|
|
||||||
else
|
|
||||||
PROTOTYPE_OPTIMIZATION = -ffunction-sections -fdata-sections
|
|
||||||
UNUSED_CODE_REMOVAL = -Wl,--gc-sections
|
|
||||||
# Link time optimization
|
|
||||||
# See https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html for reference
|
|
||||||
# Link time is larger and size of object files can not be retrieved
|
|
||||||
# but resulting binary is smaller. Could be used in mission/deployment build
|
|
||||||
# Requires -ffunction-section in linker call
|
|
||||||
LINK_TIME_OPTIMIZATION = -flto
|
|
||||||
OPTIMIZATION += $(PROTOTYPE_OPTIMIZATION)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Dependency Flags
|
|
||||||
# These flags tell the compiler to build dependencies
|
|
||||||
# See: https://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html
|
|
||||||
# Using following guide: http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#combine
|
|
||||||
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPENDDIR)/$*.d
|
|
||||||
|
|
||||||
# Flags for the compiler call
|
|
||||||
# - std: Which C++ version to use. Common versions: c++11, c++14 and c++17
|
|
||||||
# - Wall: enable all warnings
|
|
||||||
# - Wextra: enable extra warnings
|
|
||||||
# - g: defines debug level
|
|
||||||
# - fmessage-length: to control the formatting algorithm for diagnostic messages;
|
|
||||||
# =0 means no line-wrapping is done; each error message appears on a single line
|
|
||||||
# - fno-exceptions: stops generating extra code needed to propagate exceptions,
|
|
||||||
# which can produce significant data size overhead
|
|
||||||
CUSTOM_DEFINES += -DUNIT_TEST
|
|
||||||
WARNING_FLAGS = -Wall -Wshadow=local -Wextra -Wimplicit-fallthrough=1 \
|
|
||||||
-Wno-unused-parameter
|
|
||||||
|
|
||||||
CXXDEFINES := $(CUSTOM_DEFINES)
|
|
||||||
CFLAGS +=
|
|
||||||
CXXFLAGS += -I. $(DEBUG_LEVEL) $(WARNING_FLAGS) $(DEPFLAGS) -fmessage-length=0 $(OPTIMIZATION)\
|
|
||||||
$(I_INCLUDES) $(CXXDEFINES)
|
|
||||||
CPPFLAGS += -std=c++11
|
|
||||||
|
|
||||||
# Flags for the linker call
|
|
||||||
# LINK_INCLUDES specify the path to used libraries and the linker script
|
|
||||||
# LINK_LIBRARIES: Link real time support
|
|
||||||
LDFLAGS := $(DEBUG_LEVEL) $(UNUSED_CODE_REMOVAL) $(OPTIMIZATION) -pthread
|
|
||||||
LINK_INCLUDES :=
|
|
||||||
LINK_LIBRARIES :=
|
|
||||||
|
|
||||||
ifdef LINUX
|
|
||||||
LINK_LIBRARIES += -lrt
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
LINK_LIBRARIES += -lwsock32 -lws2_32
|
|
||||||
LDFLASGS += -fuse-ld=lld
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Gnu Coverage Tools Flags
|
|
||||||
ifdef GCOV
|
|
||||||
GCOV_CXXFLAGS = -fprofile-arcs -ftest-coverage --coverage -fno-inline \
|
|
||||||
-fno-inline-small-functions -fno-default-inline
|
|
||||||
CXXFLAGS += $(GCOV_CXXFLAGS)
|
|
||||||
GCOV_LINKER_LIBS = -lgcov -fprofile-arcs -ftest-coverage
|
|
||||||
LINK_LIBRARIES += $(GCOV_LINKER_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# $(info $${CXXFLAGS} is [${CXXFLAGS}])
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Rules
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# the call function assigns parameters to temporary variables
|
|
||||||
# https://www.gnu.org/software/make/manual/make.html#Call-Function
|
|
||||||
# $(1) = Memory names
|
|
||||||
# Rules are called for each memory type
|
|
||||||
# Two Expansion Symbols $$ are to escape the dollar sign for eval.
|
|
||||||
# See: http://make.mad-scientist.net/the-eval-function/
|
|
||||||
|
|
||||||
default: all
|
|
||||||
|
|
||||||
# Cleans all files
|
|
||||||
hardclean:
|
|
||||||
-rm -rf $(BUILDPATH)
|
|
||||||
-rm -rf $(OBJECTPATH)
|
|
||||||
-rm -rf $(DEPENDPATH)
|
|
||||||
|
|
||||||
# Only clean files for current build
|
|
||||||
clean:
|
|
||||||
-rm -rf $(CLEANOBJ)
|
|
||||||
-rm -rf $(CLEANBIN)
|
|
||||||
-rm -rf $(CLEANDEP)
|
|
||||||
|
|
||||||
# Only clean binaries. Useful for changing the binary type when object files
|
|
||||||
# are already compiled so complete rebuild is not necessary
|
|
||||||
cleanbin:
|
|
||||||
-rm -rf $(CLEANBIN)
|
|
||||||
|
|
||||||
# In this section, the binaries are built for all selected memories
|
|
||||||
# notestfw: all
|
|
||||||
all: executable
|
|
||||||
|
|
||||||
# Build target configuration
|
|
||||||
release: OPTIMIZATION = -Os $(PROTOTYPE_OPTIMIZATION) $(LINK_TIME_OPTIMIZATION)
|
|
||||||
release: LINK_TIME_OPTIMIZATION = -flto
|
|
||||||
release: TARGET = Mission build.
|
|
||||||
release: OPTIMIZATION_MESSAGE = On with Link Time Optimization
|
|
||||||
|
|
||||||
debug: CXXDEFINES += -DDEBUG
|
|
||||||
debug: TARGET = Debug
|
|
||||||
debug: DEBUG_MESSAGE = On
|
|
||||||
|
|
||||||
ifndef KEEP_UNUSED_CODE
|
|
||||||
debug release: OPTIMIZATION_MESSAGE += , no unused code removal
|
|
||||||
endif
|
|
||||||
|
|
||||||
debug release notestfw: executable
|
|
||||||
|
|
||||||
executable: $(BINDIR)/$(BINARY_NAME).elf
|
|
||||||
@echo
|
|
||||||
@echo $(MSG_INFO)
|
|
||||||
@echo $(MSG_TARGET)
|
|
||||||
@echo $(MSG_OPTIMIZATION)
|
|
||||||
@echo $(MSG_DEBUG)
|
|
||||||
|
|
||||||
C_OBJECTS_PREFIXED = $(addprefix $(OBJDIR)/, $(C_OBJECTS))
|
|
||||||
CXX_OBJECTS_PREFIXED = $(addprefix $(OBJDIR)/, $(CXX_OBJECTS))
|
|
||||||
ASM_OBJECTS_PREFIXED = $(addprefix $(OBJDIR)/, $(ASM_OBJECTS))
|
|
||||||
ALL_OBJECTS = $(ASM_OBJECTS_PREFIXED) $(C_OBJECTS_PREFIXED) \
|
|
||||||
$(CXX_OBJECTS_PREFIXED)
|
|
||||||
|
|
||||||
# Useful for debugging the Makefile
|
|
||||||
# Also see: https://www.oreilly.com/openbook/make3/book/ch12.pdf
|
|
||||||
# $(info $${ALL_OBJECTS} is [${ALL_OBJECTS}])
|
|
||||||
# $(info $${CXXSRC} is [${CXXSRC}])
|
|
||||||
|
|
||||||
# Automatic variables are used here extensively. Some of them
|
|
||||||
# are escaped($$) to suppress immediate evaluation. The most important ones are:
|
|
||||||
# $@: Name of Target (left side of rule)
|
|
||||||
# $<: Name of the first prerequisite (right side of rule)
|
|
||||||
# @^: List of all prerequisite, omitting duplicates
|
|
||||||
# @D: Directory and file-within-directory part of $@
|
|
||||||
|
|
||||||
# Generates binary and displays all build properties
|
|
||||||
# -p with mkdir ignores error and creates directory when needed.
|
|
||||||
|
|
||||||
# SHOW_DETAILS = 1
|
|
||||||
|
|
||||||
|
|
||||||
# Link with required libraries: HAL (Hardware Abstraction Layer) and
|
|
||||||
# HCC (File System Library)
|
|
||||||
$(BINDIR)/$(BINARY_NAME).elf: $(ALL_OBJECTS)
|
|
||||||
@echo
|
|
||||||
@echo $(MSG_LINKING) Target $@
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
ifdef SHOW_DETAILS
|
|
||||||
$(CXX) $(LDFLAGS) $(LINK_INCLUDES) -o $@ $^ $(LINK_LIBRARIES)
|
|
||||||
else
|
|
||||||
@$(CXX) $(LDFLAGS) $(LINK_INCLUDES) -o $@ $^ $(LINK_LIBRARIES)
|
|
||||||
endif
|
|
||||||
ifeq ($(BUILD_FOLDER), mission)
|
|
||||||
# With Link Time Optimization, section size is not available
|
|
||||||
$(SIZE) $@
|
|
||||||
else
|
|
||||||
$(SIZE) $^ $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(BINDIR)/$(BINARY_NAME).hex: $(BINDIR)/$(BINARY_NAME).elf
|
|
||||||
@echo
|
|
||||||
@echo $(MSG_BINARY)
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
$(HEXCOPY) $< $@
|
|
||||||
|
|
||||||
# Build new objects for changed dependencies.
|
|
||||||
$(OBJDIR)/%.o: %.cpp
|
|
||||||
$(OBJDIR)/%.o: %.cpp $(DEPENDDIR)/%.d | $(DEPENDDIR)
|
|
||||||
@echo
|
|
||||||
@echo $(MSG_COMPILING) $<
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
ifdef SHOW_DETAILS
|
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
|
||||||
else
|
|
||||||
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.c
|
|
||||||
$(OBJDIR)/%.o: %.c $(DEPENDDIR)/%.d | $(DEPENDDIR)
|
|
||||||
@echo
|
|
||||||
@echo $(MSG_COMPILING) $<
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
ifdef SHOW_DETAILS
|
|
||||||
$(CC) $(CXXFLAGS) $(CFLAGS) -c -o $@ $<
|
|
||||||
else
|
|
||||||
@$(CC) $(CXXFLAGS) $(CFLAGS) -c -o $@ $<
|
|
||||||
endif
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Dependency Handling
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Dependency Handling according to following guide:
|
|
||||||
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
|
|
||||||
$(DEPENDDIR):
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
DEPENDENCY_RELATIVE = $(CSRC:.c=.d) $(CXXSRC:.cpp=.d)
|
|
||||||
# This is the list of all dependencies
|
|
||||||
DEPFILES = $(addprefix $(DEPENDDIR)/, $(DEPENDENCY_RELATIVE))
|
|
||||||
# Create subdirectories for dependencies
|
|
||||||
$(DEPFILES):
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
# Include all dependencies
|
|
||||||
include $(wildcard $(DEPFILES))
|
|
||||||
|
|
||||||
# .PHONY tells make that these targets aren't files
|
|
||||||
.PHONY: clean release debug all hardclean cleanbin
|
|
8
tests/user/testcfg/OBSWConfig.h.in
Normal file
8
tests/user/testcfg/OBSWConfig.h.in
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef TESTCFG_OBSWCONFIG_H_
|
||||||
|
#define TESTCFG_OBSWCONFIG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* TESTCFG_OBSWCONFIG_H_ */
|
@ -1,8 +0,0 @@
|
|||||||
#ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
|
|
||||||
#define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
|
|
||||||
|
|
||||||
|
|
||||||
#define CUSTOM_UNITTEST_RUNNER 0
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ */
|
|
19
tests/user/testcfg/TestsConfig.h.in
Normal file
19
tests/user/testcfg/TestsConfig.h.in
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
|
||||||
|
#define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "events/subsystemIdRanges.h"
|
||||||
|
#include "returnvalues/classIds.h"
|
||||||
|
|
||||||
|
namespace config {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Add mission configuration flags here */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ */
|
@ -1,5 +0,0 @@
|
|||||||
#include "dataPoolInit.h"
|
|
||||||
|
|
||||||
void datapool::dataPoolInit(std::map<uint32_t, PoolEntryIF*> * poolMap) {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
#ifndef HOSTED_CONFIG_CDATAPOOL_DATAPOOLINIT_H_
|
|
||||||
#define HOSTED_CONFIG_CDATAPOOL_DATAPOOLINIT_H_
|
|
||||||
|
|
||||||
#include <fsfw/datapool/DataPool.h>
|
|
||||||
#include <fsfw/datapool/PoolEntryIF.h>
|
|
||||||
#include <map>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
|
|
||||||
namespace datapool {
|
|
||||||
void dataPoolInit(std::map<uint32_t, PoolEntryIF*> * poolMap);
|
|
||||||
|
|
||||||
enum datapoolvariables {
|
|
||||||
NO_PARAMETER = 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_CDATAPOOL_DATAPOOLINIT_H_ */
|
|
@ -15,14 +15,17 @@ namespace objects {
|
|||||||
PUS_DISTRIBUTOR = 11,
|
PUS_DISTRIBUTOR = 11,
|
||||||
TM_FUNNEL = 12,
|
TM_FUNNEL = 12,
|
||||||
|
|
||||||
TCPIP_BRIDGE = 15,
|
UDP_BRIDGE = 15,
|
||||||
TCPIP_HELPER = 16,
|
UDP_POLLING_TASK = 16,
|
||||||
|
|
||||||
TEST_ECHO_COM_IF = 20,
|
TEST_ECHO_COM_IF = 20,
|
||||||
TEST_DEVICE = 21,
|
TEST_DEVICE = 21,
|
||||||
|
|
||||||
HK_RECEIVER_MOCK = 22,
|
HK_RECEIVER_MOCK = 22,
|
||||||
TEST_LOCAL_POOL_OWNER_BASE = 25
|
TEST_LOCAL_POOL_OWNER_BASE = 25,
|
||||||
|
|
||||||
|
SHARED_SET_ID = 26
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "PollingSequenceFactory.h"
|
#include "PollingSequenceFactory.h"
|
||||||
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <TestsConfig.h>
|
||||||
|
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
|
|
||||||
@ -10,14 +12,26 @@ ReturnValue_t pst::pollingSequenceInitDefault(
|
|||||||
uint32_t length = thisSequence->getPeriodMs();
|
uint32_t length = thisSequence->getPeriodMs();
|
||||||
|
|
||||||
/* Add polling sequence table here */
|
/* Add polling sequence table here */
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.3,
|
||||||
|
DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.45 * length,
|
||||||
|
DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.6 * length,
|
||||||
|
DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.8 * length,
|
||||||
|
DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED
|
||||||
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!"
|
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("pst::pollingSequenceInitDefault: Sequence invalid!");
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp)
|
|
||||||
|
|
||||||
INCLUDES += $(CURRENTPATH)
|
|
Loading…
x
Reference in New Issue
Block a user