F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FpConfig.h
Go to the documentation of this file.
1 
11 #ifndef FPCONFIG_H_
12 #define FPCONFIG_H_
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 #include <Fw/Types/BasicTypes.h>
18 #include <Platform/PlatformTypes.h>
19 
20 // ----------------------------------------------------------------------
21 // Configuration switches
22 // ----------------------------------------------------------------------
23 
24 // Enable strict assertions
25 #ifndef FW_STRICT_ASSERTIONS
26 #define FW_STRICT_ASSERTIONS (1)
27 #endif
28 
29 // Enable direct port calls
30 #ifndef FW_DIRECT_PORT_CALLS
31 #ifdef BUILD_UT
32 #define FW_DIRECT_PORT_CALLS (0)
33 #else
34 #define FW_DIRECT_PORT_CALLS (1)
35 #endif
36 #endif
37 
38 // Allow objects to have names. Allocates storage for each instance
39 #ifndef FW_OBJECT_NAMES
40 #define FW_OBJECT_NAMES \
41  (1)
42 #endif
43 
44 // To reduce binary size, FW_OPTIONAL_NAME(<string>) can be used to substitute strings with an empty string
45 // when running with FW_OBJECT_NAMES disabled
46 #if FW_OBJECT_NAMES == 1
47 #define FW_OPTIONAL_NAME(name) name // NO_CODESONAR LANG.PREPROC.MACROSTART/END
48 #else
49 #define FW_OPTIONAL_NAME(name) "" // NO_CODESONAR LANG.PREPROC.MACROSTART/END
50 #endif
51 
52 // Add methods to query an object about its name. Can be overridden by derived classes
53 // For FW_OBJECT_TO_STRING to work, FW_OBJECT_NAMES must be enabled
54 #if FW_OBJECT_NAMES == 1
55 #ifndef FW_OBJECT_TO_STRING
56 #define FW_OBJECT_TO_STRING \
57  (1)
58 #endif
59 #else
60 #define FW_OBJECT_TO_STRING (0)
61 #endif
62 
63 // Adds the ability for all component related objects to register
64 // centrally.
65 #ifndef FW_OBJECT_REGISTRATION
66 #define FW_OBJECT_REGISTRATION \
67  (1)
68 #endif
69 
70 #ifndef FW_QUEUE_REGISTRATION
71 #define FW_QUEUE_REGISTRATION (1)
72 #endif
73 
74 // On some systems, use of *printf family functions (snprintf, printf, etc) require a prohibitive amount of program
75 // space. Setting this to `0` indicates that the Fw/String methods should stop using these functions to conserve
76 // program size. However, this comes at the expense of discarding format parameters. i.e. the format string is returned
77 // unchanged.
78 #ifndef FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING
79 #define FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING (1)
80 #endif
81 
82 // Port Facilities
83 
84 // This allows tracing calls through ports for debugging
85 #ifndef FW_PORT_TRACING
86 #define FW_PORT_TRACING (1)
87 #endif
88 
89 // This generates code to connect to serialized ports
90 #ifndef FW_PORT_SERIALIZATION
91 #define FW_PORT_SERIALIZATION \
92  (1)
93 #endif
95 
96 // Component Facilities
97 
98 // Serialization
99 
100 // Add a type id when serialization is done. More storage,
101 // but better detection of errors
102 // TODO: Not working yet
103 
104 #ifndef FW_SERIALIZATION_TYPE_ID
105 #define FW_SERIALIZATION_TYPE_ID \
106  (0)
107 #endif
108 
109 // Number of bytes to use for serialization IDs. More
110 // bytes is more storage, but greater number of IDs
111 #if FW_SERIALIZATION_TYPE_ID
112 #ifndef FW_SERIALIZATION_TYPE_ID_BYTES
113 #define FW_SERIALIZATION_TYPE_ID_BYTES (4)
114 #endif
115 #endif
116 
117 // Set assertion form. Options:
118 // 1. FW_NO_ASSERT: assertions are compiled out, side effects are kept
119 // 2. FW_FILEID_ASSERT: asserts report a file CRC and line number
120 // 3. FW_FILENAME_ASSERT: asserts report a file path (__FILE__) and line number
121 // 4. FW_RELATIVE_PATH_ASSERT: asserts report a relative path within F' or F' library and line number
122 //
123 // Note: users who want alternate asserts should set assert level to FW_NO_ASSERT and define FW_ASSERT in this header
124 #ifndef FW_ASSERT_LEVEL
125 #define FW_ASSERT_LEVEL (FW_FILENAME_ASSERT)
126 #endif
127 
128 // Decide whether the framework should force assertions to always abort.
129 // If enabled, allows additional compiler optimizations and prevents code from running after an assertion trips.
130 // If disabled (default), allows the FATAL event handler to decide whether code should continue running after an
131 // assertion trips.
132 #ifndef FW_ASSERTIONS_ALWAYS_ABORT
133 #define FW_ASSERTIONS_ALWAYS_ABORT 0
134 #endif
135 
136 // Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values
137 
138 // The size of the object name stored in the object base class. Larger names will be truncated.
139 #if FW_OBJECT_NAMES
140 #ifndef FW_OBJ_NAME_BUFFER_SIZE
141 #define FW_OBJ_NAME_BUFFER_SIZE \
142  (80)
143 #endif
144 #endif
145 
146 // Normally when a command is deserialized, the handler checks to see if there are any leftover
147 // bytes in the buffer. If there are, it assumes that the command was corrupted somehow since
148 // the serialized size should match the serialized size of the argument list. In some cases,
149 // command buffers are padded so the data can be larger than the serialized size of the command.
150 // Setting the below to zero will disable the check at the cost of not detecting commands that
151 // are too large.
152 #ifndef FW_CMD_CHECK_RESIDUAL
153 #define FW_CMD_CHECK_RESIDUAL (1)
154 #endif
155 
156 // Enables text logging of events as well as data logging. Adds a second logging port for text output.
157 // In order to set this to 0, FPRIME_ENABLE_TEXT_LOGGERS must be set to OFF.
158 #ifndef FW_ENABLE_TEXT_LOGGING
159 #define FW_ENABLE_TEXT_LOGGING (1)
160 #endif
161 
162 // Define if serializables have toString() method. Turning off will save code space and
163 // string constants. Must be enabled if text logging enabled
164 #ifndef FW_SERIALIZABLE_TO_STRING
165 #define FW_SERIALIZABLE_TO_STRING (1)
166 #endif
167 
168 // Some settings to enable AMPCS compatibility. This breaks regular ISF GUI compatibility
169 #ifndef FW_AMPCS_COMPATIBLE
170 #define FW_AMPCS_COMPATIBLE (0)
171 #endif
172 
173 // Posix thread names are limited to 16 characters, this can lead to collisions. In the event of a
174 // collision, set this to 0.
175 #ifndef POSIX_THREADS_ENABLE_NAMES
176 #define POSIX_THREADS_ENABLE_NAMES (1)
177 #endif
178 
179 // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have
180 // the type definitions in Fw/Types/BasicTypes available.
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 #endif