Replace FpConfig.h header with FPP model elements (#4393)

* Update FpConfig.h

* Update AcConstants.fpp

* Update FPrimeBasicTypes.hpp

* Update BasicTypes.h

* Update FpySequencer.hpp

* Update FpConfig.h

* Update FPrimeBasicTypes.hpp

* Update BasicTypes.h

* Update BasicTypes.h

* Update BasicTypes.h

* Update BasicTypes.h

* Update BasicTypes.h

* Update BasicTypes.h

* Update BasicTypes.h

* Update FPrimeBasicTypes.hpp

* Update FPrimeBasicTypes.hpp

* Update FpConfig.h

* Update AcConstants.fpp

* Revert casts

* Add static_cast in asserts, reorganize files per feature

* Fix static_assert after merging devel

* Add assert to static cast

* clean up comments and TODOs

* formatting

* Fix formatting

* Fix RHEL8 error

* Other UT cast fix

* cast one side only

* fix spelling and move assert count to FpConstants

* Reorder and comments

* rob test

* re-add double cast

* Revert testing static_cast

* Update docs

* use SIZE_OF variables instead of hardcoding value

* Update FpConfig in CMake tests

---------

Co-authored-by: ekswang <eric.k.wang@jpl.nasa.gov>
This commit is contained in:
Thomas Boyer-Chammard 2025-11-06 16:29:15 -08:00 committed by GitHub
parent 48e4720419
commit d669ea2c5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 188 additions and 216 deletions

View File

@ -35,24 +35,28 @@ extern "C" {
// Check that Fw::String is big enough to hold any string that can be given a // Check that Fw::String is big enough to hold any string that can be given a
// default value in FPP. // default value in FPP.
static_assert(FW_FIXED_LENGTH_STRING_SIZE >= FW_CMD_STRING_MAX_SIZE, static_assert(FW_FIXED_LENGTH_STRING_SIZE >= static_cast<FwSizeType>(FW_CMD_STRING_MAX_SIZE),
"A generic string should be able to hold a command string"); "A generic string should be able to hold a command string");
static_assert(FW_FIXED_LENGTH_STRING_SIZE >= FW_LOG_STRING_MAX_SIZE, static_assert(FW_FIXED_LENGTH_STRING_SIZE >= static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE),
"A generic string should be able to hold an event string"); "A generic string should be able to hold an event string");
static_assert(FW_FIXED_LENGTH_STRING_SIZE >= FW_TLM_STRING_MAX_SIZE, static_assert(FW_FIXED_LENGTH_STRING_SIZE >= static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE),
"A generic string should be able to hold a telemetry string"); "A generic string should be able to hold a telemetry string");
static_assert(FW_FIXED_LENGTH_STRING_SIZE >= FW_PARAM_STRING_MAX_SIZE, static_assert(FW_FIXED_LENGTH_STRING_SIZE >= static_cast<FwSizeType>(FW_PARAM_STRING_MAX_SIZE),
"A generic string should be able to hold a parameter string"); "A generic string should be able to hold a parameter string");
// Check that command/telemetry strings are not larger than an argument buffer // Check that command/telemetry strings are not larger than an argument buffer
static_assert(FW_CMD_STRING_MAX_SIZE + sizeof(FwSizeStoreType) <= FW_CMD_ARG_BUFFER_MAX_SIZE, static_assert(static_cast<FwSizeType>(FW_CMD_STRING_MAX_SIZE) + sizeof(FwSizeStoreType) <=
static_cast<FwSizeType>(FW_CMD_ARG_BUFFER_MAX_SIZE),
"FW_CMD_STRING_MAX_SIZE cannot be larger than FW_CMD_ARG_BUFFER_MAX_SIZE"); "FW_CMD_STRING_MAX_SIZE cannot be larger than FW_CMD_ARG_BUFFER_MAX_SIZE");
static_assert(FW_LOG_STRING_MAX_SIZE + sizeof(FwSizeStoreType) <= FW_LOG_BUFFER_MAX_SIZE, static_assert(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE) + sizeof(FwSizeStoreType) <=
static_cast<FwSizeType>(FW_LOG_BUFFER_MAX_SIZE),
"FW_LOG_STRING_MAX_SIZE cannot be larger than FW_LOG_BUFFER_MAX_SIZE"); "FW_LOG_STRING_MAX_SIZE cannot be larger than FW_LOG_BUFFER_MAX_SIZE");
static_assert(FW_TLM_STRING_MAX_SIZE + sizeof(FwSizeStoreType) <= FW_TLM_BUFFER_MAX_SIZE, static_assert(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE) + sizeof(FwSizeStoreType) <=
static_cast<FwSizeType>(FW_TLM_BUFFER_MAX_SIZE),
"FW_TLM_STRING_MAX_SIZE cannot be larger than FW_TLM_BUFFER_MAX_SIZE"); "FW_TLM_STRING_MAX_SIZE cannot be larger than FW_TLM_BUFFER_MAX_SIZE");
static_assert(FW_PARAM_STRING_MAX_SIZE + sizeof(FwSizeStoreType) <= FW_PARAM_BUFFER_MAX_SIZE, static_assert(static_cast<FwSizeType>(FW_PARAM_STRING_MAX_SIZE) + sizeof(FwSizeStoreType) <=
static_cast<FwSizeType>(FW_PARAM_BUFFER_MAX_SIZE),
"FW_PARAM_STRING_MAX_SIZE cannot be larger than FW_PARAM_BUFFER_MAX_SIZE"); "FW_PARAM_STRING_MAX_SIZE cannot be larger than FW_PARAM_BUFFER_MAX_SIZE");
// Text logging needs the code generator for serializables to generate a stringified version of the // Text logging needs the code generator for serializables to generate a stringified version of the

View File

@ -275,7 +275,7 @@ File::Status File::readline(U8* buffer, FwSizeType& size, File::WaitType wait) {
FwSizeType read = 0; FwSizeType read = 0;
// Loop reading chunk by chunk // Loop reading chunk by chunk
for (FwSizeType i = 0; i < size; i += read) { for (FwSizeType i = 0; i < size; i += read) {
FwSizeType current_chunk_size = FW_MIN(size - i, FW_FILE_CHUNK_SIZE); FwSizeType current_chunk_size = FW_MIN(size - i, static_cast<FwSizeType>(FW_FILE_CHUNK_SIZE));
read = current_chunk_size; read = current_chunk_size;
status = this->read(buffer + i, read, wait); status = this->read(buffer + i, read, wait);
if (status != File::Status::OP_OK) { if (status != File::Status::OP_OK) {

View File

@ -40,8 +40,9 @@ void AssertFatalAdapterTester::testAsserts() {
U32 lineNo; U32 lineNo;
// Apply all truncations to file buffer size // Apply all truncations to file buffer size
const FwSizeType fileMaxSize = const FwSizeType fileMaxSize = FW_MIN(FW_MIN(static_cast<FwSizeType>(AssertFatalAdapterEventFileSize),
FW_MIN(FW_MIN(AssertFatalAdapterEventFileSize, FW_LOG_STRING_MAX_SIZE), FW_ASSERT_TEXT_SIZE); static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE)),
static_cast<FwSizeType>(FW_ASSERT_TEXT_SIZE));
char file[Fw::StringBase::BUFFER_SIZE(fileMaxSize)]; char file[Fw::StringBase::BUFFER_SIZE(fileMaxSize)];
Fw::String fileString; Fw::String fileString;

View File

@ -29,9 +29,9 @@ static_assert(Svc::Fpy::MAX_SEQUENCE_STATEMENT_COUNT <= std::numeric_limits<U16>
"Sequence statement count must be below U16 max"); "Sequence statement count must be below U16 max");
static_assert(Svc::Fpy::MAX_STACK_SIZE <= std::numeric_limits<Svc::Fpy::StackSizeType>::max(), static_assert(Svc::Fpy::MAX_STACK_SIZE <= std::numeric_limits<Svc::Fpy::StackSizeType>::max(),
"Max stack size must be below Svc::Fpy::StackSizeType max"); "Max stack size must be below Svc::Fpy::StackSizeType max");
static_assert(Svc::Fpy::MAX_STACK_SIZE >= FW_TLM_BUFFER_MAX_SIZE, static_assert(Svc::Fpy::MAX_STACK_SIZE >= static_cast<FwSizeType>(FW_TLM_BUFFER_MAX_SIZE),
"Max stack size must be greater than max tlm buffer size"); "Max stack size must be greater than max tlm buffer size");
static_assert(Svc::Fpy::MAX_STACK_SIZE >= FW_PARAM_BUFFER_MAX_SIZE, static_assert(Svc::Fpy::MAX_STACK_SIZE >= static_cast<FwSizeType>(FW_PARAM_BUFFER_MAX_SIZE),
"Max stack size must be greater than max prm buffer size"); "Max stack size must be greater than max prm buffer size");
static_assert(Svc::Fpy::FLAG_COUNT < std::numeric_limits<U8>::max(), "Flag count must be less than U8 max"); static_assert(Svc::Fpy::FLAG_COUNT < std::numeric_limits<U8>::max(), "Flag count must be less than U8 max");

View File

@ -16,6 +16,8 @@
# This differs from stock-fprime defaults and thus may be tested to ensure that # This differs from stock-fprime defaults and thus may be tested to ensure that
# the system has overridden this file. # the system has overridden this file.
type FwChanIdType = U64 type FwChanIdType = U64
constant SIZE_OF_FwChanIdType = 8 @< Size of FwChanIdType in bytes
# --- END OF THE ONLY DIFFERENCE --- # --- END OF THE ONLY DIFFERENCE ---
#### ####
@ -44,6 +46,10 @@ type FwTaskPriorityType = PlatformTaskPriorityType
@ The type of queue priorities used. @ The type of queue priorities used.
type FwQueuePriorityType = PlatformQueuePriorityType type FwQueuePriorityType = PlatformQueuePriorityType
@ The id type.
type FwIdType = U32
constant SIZE_OF_FwIdType = 4 @< Size of FwIdType in bytes
@ The type of task priorities used. @ The type of task priorities used.
type FwTaskIdType = PlatformTaskIdType type FwTaskIdType = PlatformTaskIdType
@ -52,9 +58,6 @@ type FwTaskIdType = PlatformTaskIdType
# Used for the project to override types shared with GDSes and other remote systems. # Used for the project to override types shared with GDSes and other remote systems.
#### ####
@ The id type.
type FwIdType = U32
@ The type of a data product identifier @ The type of a data product identifier
type FwDpIdType = FwIdType type FwDpIdType = FwIdType
@ -63,19 +66,19 @@ type FwDpPriorityType = U32
@ The type of an event identifier @ The type of an event identifier
type FwEventIdType = FwIdType type FwEventIdType = FwIdType
constant SIZE_OF_FwEventIdType = SIZE_OF_FwIdType @< Size of FwEventIdType in bytes
@ The type of a command opcode @ The type of a command opcode
type FwOpcodeType = FwIdType type FwOpcodeType = FwIdType
constant SIZE_OF_FwOpcodeType = SIZE_OF_FwIdType @< Size of FwOpcodeType in bytes
@ The type of a parameter identifier @ The type of a parameter identifier
type FwPrmIdType = FwIdType type FwPrmIdType = FwIdType
constant SIZE_OF_FwPrmIdType = SIZE_OF_FwIdType @< Size of FwPrmIdType in bytes
@ The type used to serialize a size value @ The type used to serialize a size value
type FwSizeStoreType = U16 type FwSizeStoreType = U16
@ The type used to serialize a time base value
type FwTimeBaseStoreType = U16
@ The type used to serialize a time context value @ The type used to serialize a time context value
type FwTimeContextStoreType = U8 type FwTimeContextStoreType = U8
@ -88,3 +91,14 @@ type FwTraceIdType = U32
@ The type used to serialize a C++ enumeration constant @ The type used to serialize a C++ enumeration constant
@ FPP enumerations are serialized according to their representation types @ FPP enumerations are serialized according to their representation types
type FwEnumStoreType = I32 type FwEnumStoreType = I32
@ The type used to serialize a time base value
type FwTimeBaseStoreType = U16
@ Define enumeration for Time base types
enum TimeBase : FwTimeBaseStoreType {
TB_NONE = 0 @< No time base has been established (Required)
TB_PROC_TIME = 1 @< Indicates time is processor cycle time. Not tied to external time
TB_WORKSTATION_TIME = 2 @< Time as reported on workstation where software is running. For testing. (Required)
TB_DONT_CARE = 0xFFFF @< Don't care value for sequences. If FwTimeBaseStoreType is changed, value should be changed (Required)
} default TB_NONE;

View File

@ -9,8 +9,10 @@ register_fprime_config(
"${CMAKE_CURRENT_LIST_DIR}/DpCfg.fpp" "${CMAKE_CURRENT_LIST_DIR}/DpCfg.fpp"
"${CMAKE_CURRENT_LIST_DIR}/ComCfg.fpp" "${CMAKE_CURRENT_LIST_DIR}/ComCfg.fpp"
"${CMAKE_CURRENT_LIST_DIR}/FpConfig.fpp" "${CMAKE_CURRENT_LIST_DIR}/FpConfig.fpp"
"${CMAKE_CURRENT_LIST_DIR}/FpConstants.fpp"
"${CMAKE_CURRENT_LIST_DIR}/FpySequencerCfg.fpp" "${CMAKE_CURRENT_LIST_DIR}/FpySequencerCfg.fpp"
"${CMAKE_CURRENT_LIST_DIR}/MemoryAllocation.fpp" "${CMAKE_CURRENT_LIST_DIR}/MemoryAllocation.fpp"
"${CMAKE_CURRENT_LIST_DIR}/PlatformCfg.fpp"
"${CMAKE_CURRENT_LIST_DIR}/PolyDbCfg.fpp" "${CMAKE_CURRENT_LIST_DIR}/PolyDbCfg.fpp"
"${CMAKE_CURRENT_LIST_DIR}/VersionCfg.fpp" "${CMAKE_CURRENT_LIST_DIR}/VersionCfg.fpp"
HEADERS HEADERS

View File

@ -1,13 +1,10 @@
# ====================================================================== # ======================================================================
# FPP file for configuration of the communications stack # FPP file for configuration of the communications stack
#
# The only reason to modify these definitions is if you are writing your own
# Framer/Deframer implementations and need more contextual data than what is
# defined
# ====================================================================== # ======================================================================
@ The width of packet descriptors when they are serialized by the framework @ The width of packet descriptors when they are serialized by the framework
type FwPacketDescriptorType = U16 type FwPacketDescriptorType = U16
constant SIZE_OF_FwPacketDescriptorType = 2 @< Size of FwPacketDescriptorType in bytes
module ComCfg { module ComCfg {

View File

@ -40,6 +40,7 @@ type FwQueuePriorityType = PlatformQueuePriorityType
@ The id type. @ The id type.
type FwIdType = U32 type FwIdType = U32
constant SIZE_OF_FwIdType = 4 @< Size of FwIdType in bytes
@ The type of task priorities used. @ The type of task priorities used.
type FwTaskIdType = PlatformTaskIdType type FwTaskIdType = PlatformTaskIdType
@ -51,6 +52,7 @@ type FwTaskIdType = PlatformTaskIdType
@ The type of a telemetry channel identifier @ The type of a telemetry channel identifier
type FwChanIdType = FwIdType type FwChanIdType = FwIdType
constant SIZE_OF_FwChanIdType = SIZE_OF_FwIdType @< Size of FwChanIdType in bytes
@ The type of a data product identifier @ The type of a data product identifier
type FwDpIdType = FwIdType type FwDpIdType = FwIdType
@ -60,17 +62,19 @@ type FwDpPriorityType = U32
@ The type of an event identifier @ The type of an event identifier
type FwEventIdType = FwIdType type FwEventIdType = FwIdType
constant SIZE_OF_FwEventIdType = SIZE_OF_FwIdType @< Size of FwEventIdType in bytes
@ The type of a command opcode @ The type of a command opcode
type FwOpcodeType = FwIdType type FwOpcodeType = FwIdType
constant SIZE_OF_FwOpcodeType = SIZE_OF_FwIdType @< Size of FwOpcodeType in bytes
@ The type of a parameter identifier @ The type of a parameter identifier
type FwPrmIdType = FwIdType type FwPrmIdType = FwIdType
constant SIZE_OF_FwPrmIdType = SIZE_OF_FwIdType @< Size of FwPrmIdType in bytes
@ The type used to serialize a size value @ The type used to serialize a size value
type FwSizeStoreType = U16 type FwSizeStoreType = U16
@ The type used to serialize a time context value @ The type used to serialize a time context value
type FwTimeContextStoreType = U8 type FwTimeContextStoreType = U8
@ -84,7 +88,6 @@ type FwTraceIdType = U32
@ FPP enumerations are serialized according to their representation types @ FPP enumerations are serialized according to their representation types
type FwEnumStoreType = I32 type FwEnumStoreType = I32
@ The type used to serialize a time base value @ The type used to serialize a time base value
type FwTimeBaseStoreType = U16 type FwTimeBaseStoreType = U16

View File

@ -17,24 +17,10 @@ extern "C" {
#include <Fw/Types/BasicTypes.h> #include <Fw/Types/BasicTypes.h>
#include <Platform/PlatformTypes.h> #include <Platform/PlatformTypes.h>
// ----------------------------------------------------------------------
// Type aliases
// ----------------------------------------------------------------------
#define FW_CONTEXT_DONT_CARE 0xFF //!< Don't care value for time contexts in sequences
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Configuration switches // Configuration switches
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Boolean values for serialization
#ifndef FW_SERIALIZE_TRUE_VALUE
#define FW_SERIALIZE_TRUE_VALUE (0xFF) //!< Value encoded during serialization for boolean true
#endif
#ifndef FW_SERIALIZE_FALSE_VALUE
#define FW_SERIALIZE_FALSE_VALUE (0x00) //!< Value encoded during serialization for boolean false
#endif
// Allow objects to have names. Allocates storage for each instance // Allow objects to have names. Allocates storage for each instance
#ifndef FW_OBJECT_NAMES #ifndef FW_OBJECT_NAMES
#define FW_OBJECT_NAMES \ #define FW_OBJECT_NAMES \
@ -135,56 +121,6 @@ extern "C" {
#endif #endif
#endif #endif
#if FW_OBJECT_REGISTRATION
// For the simple object registry provided with the framework, this specifies how many objects the registry will store.
#ifndef FW_OBJ_SIMPLE_REG_ENTRIES
#define FW_OBJ_SIMPLE_REG_ENTRIES 500 //!< Number of objects stored in simple object registry
#endif
// When dumping the contents of the registry, this specifies the size of the buffer used to store object names. Should
// be >= FW_OBJ_NAME_BUFFER_SIZE.
#ifndef FW_OBJ_SIMPLE_REG_BUFF_SIZE
#define FW_OBJ_SIMPLE_REG_BUFF_SIZE 255 //!< Size of object registry dump string
#endif
#endif
#if FW_QUEUE_REGISTRATION
// For the simple queue registry provided with the framework, this specifies how many queues the registry will store.
#ifndef FW_QUEUE_SIMPLE_QUEUE_ENTRIES
#define FW_QUEUE_SIMPLE_QUEUE_ENTRIES 100 //!< Number of queues stored in simple queue registry
#endif
#endif
// Specifies the size of the string holding the queue name for queues
#ifndef FW_QUEUE_NAME_BUFFER_SIZE
#define FW_QUEUE_NAME_BUFFER_SIZE 80 //!< Max size of message queue name
#endif
// Specifies the size of the string holding the task name for active components and tasks
#ifndef FW_TASK_NAME_BUFFER_SIZE
#define FW_TASK_NAME_BUFFER_SIZE 80 //!< Max size of task name
#endif
// Specifies the size of the buffer that contains a communications packet.
#ifndef FW_COM_BUFFER_MAX_SIZE
#define FW_COM_BUFFER_MAX_SIZE 512
#endif
// Specifies the size of the buffer attached to state machine signals.
#ifndef FW_SM_SIGNAL_BUFFER_MAX_SIZE
#define FW_SM_SIGNAL_BUFFER_MAX_SIZE 128 // Not to exceed max value of FwSizeType
#endif
// Specifies the size of the buffer that contains the serialized command arguments.
#ifndef FW_CMD_ARG_BUFFER_MAX_SIZE
#define FW_CMD_ARG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType))
#endif
// Specifies the maximum size of a string in a command argument
#ifndef FW_CMD_STRING_MAX_SIZE
#define FW_CMD_STRING_MAX_SIZE 40 //!< Max character size of command string arguments
#endif
// Normally when a command is deserialized, the handler checks to see if there are any leftover // Normally when a command is deserialized, the handler checks to see if there are any leftover
// bytes in the buffer. If there are, it assumes that the command was corrupted somehow since // bytes in the buffer. If there are, it assumes that the command was corrupted somehow since
// the serialized size should match the serialized size of the argument list. In some cases, // the serialized size should match the serialized size of the argument list. In some cases,
@ -195,63 +131,12 @@ extern "C" {
#define FW_CMD_CHECK_RESIDUAL 1 //!< Check for leftover command bytes #define FW_CMD_CHECK_RESIDUAL 1 //!< Check for leftover command bytes
#endif #endif
// Specifies the size of the buffer that contains the serialized log arguments.
#ifndef FW_LOG_BUFFER_MAX_SIZE
#define FW_LOG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType))
#endif
// Specifies the maximum size of a string in a log event
// Note: This constant truncates file names in assertion failure event reports
#ifndef FW_LOG_STRING_MAX_SIZE
#define FW_LOG_STRING_MAX_SIZE 200 //!< Max size of log string parameter type
#endif
// Specifies the size of the buffer that contains the serialized telemetry value.
#ifndef FW_TLM_BUFFER_MAX_SIZE
#define FW_TLM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType))
#endif
// Specifies the size of the buffer that contains statement args for the FpySequencer
#ifndef FW_STATEMENT_ARG_BUFFER_MAX_SIZE
#define FW_STATEMENT_ARG_BUFFER_MAX_SIZE (FW_CMD_ARG_BUFFER_MAX_SIZE)
#endif
// Specifies the maximum size of a string in a telemetry channel
#ifndef FW_TLM_STRING_MAX_SIZE
#define FW_TLM_STRING_MAX_SIZE 40 //!< Max size of channelized telemetry string type
#endif
// Specifies the size of the buffer that contains the serialized parameter value.
#ifndef FW_PARAM_BUFFER_MAX_SIZE
#define FW_PARAM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType))
#endif
// Specifies the maximum size of a string in a parameter
#ifndef FW_PARAM_STRING_MAX_SIZE
#define FW_PARAM_STRING_MAX_SIZE 40 //!< Max size of parameter string type
#endif
// Specifies the maximum size of a file downlink chunk
#ifndef FW_FILE_BUFFER_MAX_SIZE
#define FW_FILE_BUFFER_MAX_SIZE FW_COM_BUFFER_MAX_SIZE //!< Max size of file buffer (i.e. chunk of file)
#endif
// Specifies the maximum size of a string in an interface call
#ifndef FW_INTERNAL_INTERFACE_STRING_MAX_SIZE
#define FW_INTERNAL_INTERFACE_STRING_MAX_SIZE 256 //!< Max size of interface string parameter type
#endif
// Enables text logging of events as well as data logging. Adds a second logging port for text output. // Enables text logging of events as well as data logging. Adds a second logging port for text output.
// In order to set this to 0, FPRIME_ENABLE_TEXT_LOGGERS must be set to OFF. // In order to set this to 0, FPRIME_ENABLE_TEXT_LOGGERS must be set to OFF.
#ifndef FW_ENABLE_TEXT_LOGGING #ifndef FW_ENABLE_TEXT_LOGGING
#define FW_ENABLE_TEXT_LOGGING 1 //!< Indicates whether text logging is turned on #define FW_ENABLE_TEXT_LOGGING 1 //!< Indicates whether text logging is turned on
#endif #endif
// Define the size of the text log string buffer. Should be large enough for format string and arguments
#ifndef FW_LOG_TEXT_BUFFER_SIZE
#define FW_LOG_TEXT_BUFFER_SIZE 256 //!< Max size of string for text log message
#endif
// Define if serializables have toString() method. Turning off will save code space and // Define if serializables have toString() method. Turning off will save code space and
// string constants. Must be enabled if text logging enabled // string constants. Must be enabled if text logging enabled
#ifndef FW_SERIALIZABLE_TO_STRING #ifndef FW_SERIALIZABLE_TO_STRING
@ -263,73 +148,6 @@ extern "C" {
#define FW_AMPCS_COMPATIBLE 0 //!< Whether or not JPL AMPCS ground system support is enabled. #define FW_AMPCS_COMPATIBLE 0 //!< Whether or not JPL AMPCS ground system support is enabled.
#endif #endif
// Configuration for Fw::String
#ifndef FW_FIXED_LENGTH_STRING_SIZE
#define FW_FIXED_LENGTH_STRING_SIZE 256 //!< Character array size for Fw::String
#endif
// OS configuration
#ifndef FW_CONSOLE_HANDLE_MAX_SIZE
#define FW_CONSOLE_HANDLE_MAX_SIZE 24 //!< Maximum size of a handle for OS queues
#endif
#ifndef FW_TASK_HANDLE_MAX_SIZE
#define FW_TASK_HANDLE_MAX_SIZE 24 //!< Maximum size of a handle for OS queues
#endif
#ifndef FW_FILE_HANDLE_MAX_SIZE
#define FW_FILE_HANDLE_MAX_SIZE 16 //!< Maximum size of a handle for OS queues
#endif
#ifndef FW_MUTEX_HANDLE_MAX_SIZE
#define FW_MUTEX_HANDLE_MAX_SIZE 72 //!< Maximum size of a handle for OS queues
#endif
#ifndef FW_QUEUE_HANDLE_MAX_SIZE
#define FW_QUEUE_HANDLE_MAX_SIZE 352 //!< Maximum size of a handle for OS queues
#endif
#ifndef FW_DIRECTORY_HANDLE_MAX_SIZE
#define FW_DIRECTORY_HANDLE_MAX_SIZE 16 //!< Maximum size of a handle for OS resources (files, queues, locks, etc.)
#endif
#ifndef FW_FILESYSTEM_HANDLE_MAX_SIZE
#define FW_FILESYSTEM_HANDLE_MAX_SIZE 16 //!< Maximum size of a handle for OS resources (files, queues, locks, etc.)
#endif
#ifndef FW_RAW_TIME_HANDLE_MAX_SIZE
#define FW_RAW_TIME_HANDLE_MAX_SIZE 56 //!< Maximum size of a handle for OS::RawTime objects
#endif
#ifndef FW_RAW_TIME_SERIALIZATION_MAX_SIZE
#define FW_RAW_TIME_SERIALIZATION_MAX_SIZE 8 //!< Maximum allowed serialization size for Os::RawTime objects
#endif
#ifndef FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE
#define FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE 56 //!< Maximum size of a handle for OS condition variables
#endif
#ifndef FW_CPU_HANDLE_MAX_SIZE
#define FW_CPU_HANDLE_MAX_SIZE 16 //!< Maximum size of a handle for OS cpu
#endif
#ifndef FW_MEMORY_HANDLE_MAX_SIZE
#define FW_MEMORY_HANDLE_MAX_SIZE 16 //!< Maximum size of a handle for OS memory
#endif
#ifndef FW_HANDLE_ALIGNMENT
#define FW_HANDLE_ALIGNMENT 8 //!< Alignment of handle storage
#endif
// Note: One buffer of this size will be stack-allocated during certain OSAL operations e.g. when copying a file
#ifndef FW_FILE_CHUNK_SIZE
#define FW_FILE_CHUNK_SIZE 512 //!< Chunk size for working with files in the OSAL layer
#endif
#ifndef FW_ASSERT_COUNT_MAX
#define FW_ASSERT_COUNT_MAX 10 //!< Maximum number of cascading FW_ASSERT check failures before forcing a system assert
#endif
// *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have
// the type definitions in Fw/Types/BasicTypes available. // the type definitions in Fw/Types/BasicTypes available.
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -0,0 +1,86 @@
# ======================================================================
# FPP file for configuration of various F Prime framework constants
# ======================================================================
# ---------------------------------------------------------------------
# Buffer sizes
# ---------------------------------------------------------------------
@ When dumping the contents of the registry, this specifies the size of the buffer used to store object names.
@ Should be >= FW_OBJ_NAME_BUFFER_SIZE.
constant FW_OBJ_SIMPLE_REG_BUFF_SIZE = 255
@ Specifies the size of the string holding the queue name for queues
constant FW_QUEUE_NAME_BUFFER_SIZE = 80
@ Specifies the size of the string holding the task name for active components and tasks
constant FW_TASK_NAME_BUFFER_SIZE = 80
@ Specifies the size of the buffer that contains a communications packet
constant FW_COM_BUFFER_MAX_SIZE = 512
@ Specifies the size of the buffer attached to state machine signals
constant FW_SM_SIGNAL_BUFFER_MAX_SIZE = 128
@ Specifies the size of the buffer that contains the serialized command arguments
constant FW_CMD_ARG_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwOpcodeType - SIZE_OF_FwPacketDescriptorType
@ Specifies the maximum size of a string in a command argument
constant FW_CMD_STRING_MAX_SIZE = 40
@ Specifies the size of the buffer that contains the serialized log arguments
constant FW_LOG_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwEventIdType - SIZE_OF_FwPacketDescriptorType
@ Specifies the maximum size of a string in a log event
@ Note: This constant truncates file names in assertion failure event reports
constant FW_LOG_STRING_MAX_SIZE = 200
@ Specifies the size of the buffer that contains the serialized telemetry value
constant FW_TLM_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwChanIdType - SIZE_OF_FwPacketDescriptorType
@ Specifies the size of the buffer that contains the serialized telemetry value
constant FW_STATEMENT_ARG_BUFFER_MAX_SIZE = FW_CMD_ARG_BUFFER_MAX_SIZE
@ Specifies the maximum size of a string in a telemetry channel
constant FW_TLM_STRING_MAX_SIZE = 40
@ Specifies the size of the buffer that contains the serialized parameter value
constant FW_PARAM_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwPrmIdType - SIZE_OF_FwPacketDescriptorType
@ Specifies the maximum size of a string in a parameter
constant FW_PARAM_STRING_MAX_SIZE = 40
@ Specifies the maximum size of a file downlink chunk
constant FW_FILE_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE
@ Specifies the maximum size of a string in an interface call
constant FW_INTERNAL_INTERFACE_STRING_MAX_SIZE = 256
@ Defines the size of the text log string buffer. Should be large enough for format string and arguments
constant FW_LOG_TEXT_BUFFER_SIZE = 256
@ Configuration for Fw::String
@ Note: FPrimeBasicTypes.hpp needs to be updated to sync enum
constant FW_FIXED_LENGTH_STRING_SIZE = 256
# ---------------------------------------------------------------------
# Other constants
# ---------------------------------------------------------------------
@ For the simple object registry provided with the framework, this specifies how many objects the registry will store.
constant FW_OBJ_SIMPLE_REG_ENTRIES = 500
@ For the simple queue registry provided with the framework, this specifies how many queues the registry will store.
constant FW_QUEUE_SIMPLE_QUEUE_ENTRIES = 100
@ Maximum number of cascading FW_ASSERT check failures before forcing a system assert
constant FW_ASSERT_COUNT_MAX = 10
@ Don't care value for time contexts in sequences
constant FW_CONTEXT_DONT_CARE = 0xFF
@ Value encoded during serialization for boolean true
constant FW_SERIALIZE_TRUE_VALUE = 0xFF
@ Value encoded during serialization for boolean false
constant FW_SERIALIZE_FALSE_VALUE = 0x00

View File

@ -0,0 +1,45 @@
# =======================================================================
# FPP file for configuration of various F Prime Platform and Os constants
# =======================================================================
@ Maximum size of a handle for Os::Console
constant FW_CONSOLE_HANDLE_MAX_SIZE = 24
@ Maximum size of a handle for Os::Task
constant FW_TASK_HANDLE_MAX_SIZE = 24
@ Maximum size of a handle for Os::File
constant FW_FILE_HANDLE_MAX_SIZE = 16
@ Maximum size of a handle for Os::Mutex
constant FW_MUTEX_HANDLE_MAX_SIZE = 72
@ Maximum size of a handle for Os::Queue
constant FW_QUEUE_HANDLE_MAX_SIZE = 352
@ Maximum size of a handle for Os::Directory
constant FW_DIRECTORY_HANDLE_MAX_SIZE = 16
@ Maximum size of a handle for Os::FileSystem
constant FW_FILESYSTEM_HANDLE_MAX_SIZE = 16
@ Maximum size of a handle for Os::RawTime
constant FW_RAW_TIME_HANDLE_MAX_SIZE = 56
@ Maximum allowed serialization size for Os::RawTime objects
constant FW_RAW_TIME_SERIALIZATION_MAX_SIZE = 8
@ Maximum size of a handle for Os::ConditionVariable
constant FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE = 56
@ Maximum size of a handle for Os::Cpu
constant FW_CPU_HANDLE_MAX_SIZE = 16
@ Maximum size of a handle for Os::Memory
constant FW_MEMORY_HANDLE_MAX_SIZE = 16
@ Alignment of handle storage
constant FW_HANDLE_ALIGNMENT = 8
@ Chunk size for working with files in the OSAL layer
constant FW_FILE_CHUNK_SIZE = 512

View File

@ -109,8 +109,8 @@ printf("Index %" PRI_PlatformIndexType ". Min %" PRI_PlatformIndexType, index, s
### Configurable Integer Types ### Configurable Integer Types
Project may configure the framework types that the framework and components use for implementation through Projects may configure the framework types that the framework and components use for implementation through
`FpConfig.h`. The default configuration as supplied with F´ uses the above platform types where applicable. `FpConfig.[h|fpp]`. The default configuration as supplied with F´ uses the above platform types where applicable.
| Framework Type | Logical Usage | Default | Format Specifier | Signed | Size | | Framework Type | Logical Usage | Default | Format Specifier | Signed | Size |
|------------------|------------------------------|------------------------|----------------------|--------|-----------------| |------------------|------------------------------|------------------------|----------------------|--------|-----------------|

View File

@ -27,12 +27,14 @@ This guide includes:
All configurable files (top-level and component-specific) for F´ are available in the top-level All configurable files (top-level and component-specific) for F´ are available in the top-level
`config` directory. By default, all deployments use the F´ provided default configuration options. `config` directory. By default, all deployments use the F´ provided default configuration options.
Projects can also take ownership of the `config` directory to provide their own `AcConstants.fpp` Projects can also take ownership of the `config` directory to provide their own HPP/FPP configuration to
and configuration `*.hpp` files. To do so, copy the `config` directory into your project and use the override the framework defaults. To do so, copy the `config` directory into your project and use the
`config_directory` options in the project's `settings.ini` file. [`register_fprime_config()`](../../reference/api/cmake/API.md) CMake API to let the build system know
See the [settings.ini guide](../build-system/settings.md) for more details. to use your configuration overrides. This is demonstrated in various F´ reference projects, such as the
[FprimeZephyrReference](https://github.com/fprime-community/fprime-zephyr-reference/tree/devel/FprimeZephyrReference).
The `FpConfig.h` file is a C header allowing the user to define global settings. The `FpConfig.h` file is a C header allowing the user to define global settings. Other configuration options
can be found in `FpConfig.fpp` and `FpConstants.fpp`
Where components allow specific configuration, a `<component>Cfg.hpp` is available to be modified as well. Where components allow specific configuration, a `<component>Cfg.hpp` is available to be modified as well.
## AcConstants.fpp ## AcConstants.fpp
@ -59,12 +61,12 @@ number of components.
## FpConfig.h ## FpConfig.h
Some configurations may be changed during compilation time. The F framework has a number of optional features that can Some configurations may be changed during compilation time. The F framework has a number of optional features that can
be enabled or disabled by editing the `config/FpConfig.h` file. These changes affect of the whole of the F´ be enabled or disabled by editing one of the `config/FpConfig` files (H, HPP, or FPP). These changes affect of the whole of the F´
deployment. Users can change or override defined *C* macro values that activate or disable code by using compiler flags deployment. Users can change or override defined *C* macro values that activate or disable code by using compiler flags
for different deployment settings. During flight software (FSW) execution, disabling unnecessary features saves memory for different deployment settings. During flight software (FSW) execution, disabling unnecessary features saves memory
and CPU cycles. and CPU cycles.
All of these settings should be set in `FpConfig.h` and for most projects, this whole file will be cloned and owned All of these settings should be set in `FpConfig.fpp` and for most projects, this whole file will be cloned and owned
for their specific settings. Typically, the user will define the setting to be 0 for off and 1 for on. for their specific settings. Typically, the user will define the setting to be 0 for off and 1 for on.
e.g. e.g.