F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ConfigCheck.cpp
Go to the documentation of this file.
1 
13 #include <Fw/FPrimeBasicTypes.hpp>
14 #include <limits>
15 
16 // Check that Fw::String is big enough to hold any string that can be given a
17 // default value in FPP.
18 
20  "A generic string should be able to hold a command string");
22  "A generic string should be able to hold an event string");
24  "A generic string should be able to hold a telemetry string");
26  "A generic string should be able to hold a parameter string");
27 
28 // Check that command/telemetry strings are not larger than an argument buffer
29 
31  "FW_CMD_STRING_MAX_SIZE cannot be larger than FW_CMD_ARG_BUFFER_MAX_SIZE");
33  "FW_LOG_STRING_MAX_SIZE cannot be larger than FW_LOG_BUFFER_MAX_SIZE");
35  "FW_TLM_STRING_MAX_SIZE cannot be larger than FW_TLM_BUFFER_MAX_SIZE");
37  "FW_PARAM_STRING_MAX_SIZE cannot be larger than FW_PARAM_BUFFER_MAX_SIZE");
38 
39 // Text logging needs the code generator for serializables to generate a stringified version of the
40 // value.
41 static_assert((FW_ENABLE_TEXT_LOGGING == 0) || (FW_SERIALIZABLE_TO_STRING != 0),
42  "FW_SERIALIZABLE_TO_STRING must be enabled to enable FW_ENABLE_TEXT_LOGGING");
43 
44 // Unit testing needs serializable strings
45 #ifdef BUILD_UT
46 static_assert(FW_SERIALIZABLE_TO_STRING != 0,
47  "FW_SERIALIZABLE_TO_STRING must be enabled for unit testing");
48 #endif
49 
50 static_assert(std::numeric_limits<FwBuffSizeType>::max() == std::numeric_limits<FwSizeStoreType>::max() &&
52  "FwBuffSizeType must be equivalent to FwExternalSizeType");
53 
54 static_assert(std::numeric_limits<FwSizeType>::max() >= std::numeric_limits<FwSizeStoreType>::max() &&
56  "FwSizeType cannot entirely store values of type FwExternalSizeType");
57 
58 
59 // Check platform defined types for required invariants
60 static_assert(sizeof(PlatformPointerCastType) == sizeof(void*), "PlatformPointerCastType must be the same size as pointers");
61 static_assert(std::numeric_limits<PlatformSizeType>::max() >= std::numeric_limits<unsigned int>::max(),
62  "PlatformSizeType must be at least as large as unsigned int");
63 static_assert(std::numeric_limits<PlatformSignedSizeType>::max() >= std::numeric_limits<int>::max(),
64  "PlatformSignedSizeType must be at least as large as int");
66  "PlatformSignedSizeType must be at least as small as int");
67 static_assert(std::numeric_limits<PlatformIndexType>::is_signed, "PlatformIndexType must be signed");
68 static_assert(not std::numeric_limits<PlatformSizeType>::is_signed, "PlatformSizeType must be unsigned");
69 static_assert(std::numeric_limits<PlatformSignedSizeType>::is_signed, "PlatformSignedSizeType must be signed");
70 static_assert(std::numeric_limits<PlatformSizeType>::max() >= std::numeric_limits<U32>::max(), "PlatformSizeType must be at least as large as U32");
71 static_assert(sizeof(PlatformSizeType) == sizeof(PlatformSignedSizeType), "PlatformSizeType must be the same size as PlatformSignedSizeType");
72 
73 // Check framework configured types for required invariants
74 static_assert(std::numeric_limits<FwSizeType>::max() >= std::numeric_limits<unsigned int>::max(),
75  "FwSizeType must be at least as large as unsigned int");
76 static_assert(std::numeric_limits<FwSignedSizeType>::max() >= std::numeric_limits<int>::max(),
77  "FwSignedSizeType must be at least as large as int");
79  "FwSignedSizeType must be at least as large as int");
80 static_assert(std::numeric_limits<FwIndexType>::is_signed, "FwIndexType must be signed");
81 static_assert(not std::numeric_limits<FwSizeType>::is_signed, "FwSizeType must be unsigned");
82 static_assert(std::numeric_limits<FwSignedSizeType>::is_signed, "FwSignedSizeType must be signed");
83 static_assert(std::numeric_limits<FwSizeType>::max() >= std::numeric_limits<U32>::max(), "FwSizeType must be at least as large as U32");
84 static_assert(sizeof(FwSizeType) == sizeof(FwSignedSizeType), "FwSizeType must be the same size as FwSignedSizeType");
85 
PlatformSizeType FwSizeType
#define FW_TLM_STRING_MAX_SIZE
Max size of channelized telemetry string type.
Definition: FpConfig.h:239
#define FW_SERIALIZABLE_TO_STRING
Indicates if autocoded serializables have toString() methods.
Definition: FpConfig.h:276
#define FW_ENABLE_TEXT_LOGGING
Indicates whether text logging is turned on.
Definition: FpConfig.h:265
#define FW_TLM_BUFFER_MAX_SIZE
Definition: FpConfig.h:229
PlatformSignedSizeType FwSignedSizeType
#define FW_LOG_BUFFER_MAX_SIZE
Definition: FpConfig.h:218
#define FW_FIXED_LENGTH_STRING_SIZE
Character array size for Fw::String.
Definition: FpConfig.h:298
#define FW_CMD_ARG_BUFFER_MAX_SIZE
Definition: FpConfig.h:198
static U32 min(const U32 a, const U32 b)
Definition: Checksum.cpp:16
#define FW_PARAM_BUFFER_MAX_SIZE
Definition: FpConfig.h:244
#define FW_PARAM_STRING_MAX_SIZE
Max size of parameter string type.
Definition: FpConfig.h:249
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
Definition: FpConfig.h:224
#define FW_CMD_STRING_MAX_SIZE
Max character size of command string arguments.
Definition: FpConfig.h:203