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 <Platform/PlatformTypes.h>
18 #include <Fw/Types/BasicTypes.h>
19 
20 
21 // ----------------------------------------------------------------------
22 // Type aliases
23 // ----------------------------------------------------------------------
24 #define FW_CONTEXT_DONT_CARE 0xFF
25 
26 // ----------------------------------------------------------------------
27 // Configuration switches
28 // ----------------------------------------------------------------------
29 
30 // Boolean values for serialization
31 #ifndef FW_SERIALIZE_TRUE_VALUE
32 #define FW_SERIALIZE_TRUE_VALUE (0xFF)
33 #endif
34 
35 #ifndef FW_SERIALIZE_FALSE_VALUE
36 #define FW_SERIALIZE_FALSE_VALUE (0x00)
37 #endif
38 
39 // Allow objects to have names. Allocates storage for each instance
40 #ifndef FW_OBJECT_NAMES
41 #define FW_OBJECT_NAMES \
42  1
43 #endif
44 
45 // To reduce binary size, FW_OPTIONAL_NAME(<string>) can be used to substitute strings with an empty string
46 // when running with FW_OBJECT_NAMES disabled
47 #if FW_OBJECT_NAMES == 1
48 #define FW_OPTIONAL_NAME(name) name
49 #else
50 #define FW_OPTIONAL_NAME(name) ""
51 #endif
52 
53 // Add methods to query an object about its name. Can be overridden by derived classes
54 // For FW_OBJECT_TO_STRING to work, FW_OBJECT_NAMES must be enabled
55 #if FW_OBJECT_NAMES == 1
56 #ifndef FW_OBJECT_TO_STRING
57 #define FW_OBJECT_TO_STRING \
58  1
59 #endif
60 #else
61 #define FW_OBJECT_TO_STRING 0
62 #endif
63 
64 // Adds the ability for all component related objects to register
65 // centrally.
66 #ifndef FW_OBJECT_REGISTRATION
67 #define FW_OBJECT_REGISTRATION \
68  1
69 #endif
70 
71 #ifndef FW_QUEUE_REGISTRATION
72 #define FW_QUEUE_REGISTRATION 1
73 #endif
74 
75 // On some systems, use of *printf family functions (snprintf, printf, etc) require a prohibitive amount of program
76 // space. Setting this to `0` indicates that the Fw/String methods should stop using these functions to conserve
77 // program size. However, this comes at the expense of discarding format parameters. i.e. the format string is returned
78 // unchanged.
79 #ifndef FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING
80 #define FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING 1
81 #endif
82 
83 // Port Facilities
84 
85 // This allows tracing calls through ports for debugging
86 #ifndef FW_PORT_TRACING
87 #define FW_PORT_TRACING 1
88 #endif
89 
90 // This generates code to connect to serialized ports
91 #ifndef FW_PORT_SERIALIZATION
92 #define FW_PORT_SERIALIZATION \
93  1
94 #endif
96 
97 // Component Facilities
98 
99 // Serialization
100 
101 // Add a type id when serialization is done. More storage,
102 // but better detection of errors
103 // TODO: Not working yet
104 
105 #ifndef FW_SERIALIZATION_TYPE_ID
106 #define FW_SERIALIZATION_TYPE_ID \
107  0
108 #endif
109 
110 // Number of bytes to use for serialization IDs. More
111 // bytes is more storage, but greater number of IDs
112 #if FW_SERIALIZATION_TYPE_ID
113 #ifndef FW_SERIALIZATION_TYPE_ID_BYTES
114 #define FW_SERIALIZATION_TYPE_ID_BYTES 4
115 #endif
116 #endif
117 
118 // Set assertion form. Options:
119 // 1. FW_NO_ASSERT: assertions are compiled out, side effects are kept
120 // 2. FW_FILEID_ASSERT: asserts report a file CRC and line number
121 // 3. FW_FILENAME_ASSERT: asserts report a file path (__FILE__) and line number
122 // 4. FW_RELATIVE_PATH_ASSERT: asserts report a relative path within F´ or F´ library and line number
123 //
124 // Note: users who want alternate asserts should set assert level to FW_NO_ASSERT and define FW_ASSERT in this header
125 #ifndef FW_ASSERT_LEVEL
126 #define FW_ASSERT_LEVEL FW_FILENAME_ASSERT
127 #endif
128 
129 // Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values
130 
131 // The size of the object name stored in the object base class. Larger names will be truncated.
132 #if FW_OBJECT_NAMES
133 #ifndef FW_OBJ_NAME_BUFFER_SIZE
134 #define FW_OBJ_NAME_BUFFER_SIZE \
135  80
136 #endif
137 #endif
138 
139 #if FW_OBJECT_REGISTRATION
140 // For the simple object registry provided with the framework, this specifies how many objects the registry will store.
141 #ifndef FW_OBJ_SIMPLE_REG_ENTRIES
142 #define FW_OBJ_SIMPLE_REG_ENTRIES 500
143 #endif
144 // When dumping the contents of the registry, this specifies the size of the buffer used to store object names. Should
145 // be >= FW_OBJ_NAME_BUFFER_SIZE.
146 #ifndef FW_OBJ_SIMPLE_REG_BUFF_SIZE
147 #define FW_OBJ_SIMPLE_REG_BUFF_SIZE 255
148 #endif
149 #endif
150 
151 #if FW_QUEUE_REGISTRATION
152 // For the simple queue registry provided with the framework, this specifies how many queues the registry will store.
153 #ifndef FW_QUEUE_SIMPLE_QUEUE_ENTRIES
154 #define FW_QUEUE_SIMPLE_QUEUE_ENTRIES 100
155 #endif
156 #endif
157 
158 // Specifies the size of the string holding the queue name for queues
159 #ifndef FW_QUEUE_NAME_BUFFER_SIZE
160 #define FW_QUEUE_NAME_BUFFER_SIZE 80
161 #endif
162 
163 // Specifies the size of the string holding the task name for active components and tasks
164 #ifndef FW_TASK_NAME_BUFFER_SIZE
165 #define FW_TASK_NAME_BUFFER_SIZE 80
166 #endif
167 
168 // Specifies the size of the buffer that contains a communications packet.
169 #ifndef FW_COM_BUFFER_MAX_SIZE
170 #define FW_COM_BUFFER_MAX_SIZE 512
171 #endif
172 
173 // Specifies the size of the buffer attached to state machine signals.
174 #ifndef FW_SM_SIGNAL_BUFFER_MAX_SIZE
175 #define FW_SM_SIGNAL_BUFFER_MAX_SIZE 128 // Not to exceed max value of FwSizeType
176 #endif
177 
178 // Specifies the size of the buffer that contains the serialized command arguments.
179 
180 #ifndef FW_CMD_ARG_BUFFER_MAX_SIZE
181 #define FW_CMD_ARG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType))
182 #endif
183 
184 // Specifies the maximum size of a string in a command argument
185 #ifndef FW_CMD_STRING_MAX_SIZE
186 #define FW_CMD_STRING_MAX_SIZE 40
187 #endif
188 
189 // Normally when a command is deserialized, the handler checks to see if there are any leftover
190 // bytes in the buffer. If there are, it assumes that the command was corrupted somehow since
191 // the serialized size should match the serialized size of the argument list. In some cases,
192 // command buffers are padded so the data can be larger than the serialized size of the command.
193 // Setting the below to zero will disable the check at the cost of not detecting commands that
194 // are too large.
195 #ifndef FW_CMD_CHECK_RESIDUAL
196 #define FW_CMD_CHECK_RESIDUAL 1
197 #endif
198 
199 // Specifies the size of the buffer that contains the serialized log arguments.
200 #ifndef FW_LOG_BUFFER_MAX_SIZE
201 #define FW_LOG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType))
202 #endif
203 
204 // Specifies the maximum size of a string in a log event
205 // Note: This constant truncates file names in assertion failure event reports
206 #ifndef FW_LOG_STRING_MAX_SIZE
207 #define FW_LOG_STRING_MAX_SIZE 200
208 #endif
209 
210 // Specifies the size of the buffer that contains the serialized telemetry value.
211 #ifndef FW_TLM_BUFFER_MAX_SIZE
212 #define FW_TLM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType))
213 #endif
214 
215 // Specifies the size of the buffer that contains statement args for the FpySequencer
216 #ifndef FW_STATEMENT_ARG_BUFFER_MAX_SIZE
217 #define FW_STATEMENT_ARG_BUFFER_MAX_SIZE (FW_CMD_ARG_BUFFER_MAX_SIZE)
218 #endif
219 
220 // Specifies the maximum size of a string in a telemetry channel
221 #ifndef FW_TLM_STRING_MAX_SIZE
222 #define FW_TLM_STRING_MAX_SIZE 40
223 #endif
224 
225 // Specifies the size of the buffer that contains the serialized parameter value.
226 #ifndef FW_PARAM_BUFFER_MAX_SIZE
227 #define FW_PARAM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType))
228 #endif
229 
230 // Specifies the maximum size of a string in a parameter
231 #ifndef FW_PARAM_STRING_MAX_SIZE
232 #define FW_PARAM_STRING_MAX_SIZE 40
233 #endif
234 
235 // Specifies the maximum size of a file downlink chunk
236 #ifndef FW_FILE_BUFFER_MAX_SIZE
237 #define FW_FILE_BUFFER_MAX_SIZE FW_COM_BUFFER_MAX_SIZE
238 #endif
239 
240 // Specifies the maximum size of a string in an interface call
241 #ifndef FW_INTERNAL_INTERFACE_STRING_MAX_SIZE
242 #define FW_INTERNAL_INTERFACE_STRING_MAX_SIZE 256
243 #endif
244 
245 // Enables text logging of events as well as data logging. Adds a second logging port for text output.
246 // In order to set this to 0, FPRIME_ENABLE_TEXT_LOGGERS must be set to OFF.
247 #ifndef FW_ENABLE_TEXT_LOGGING
248 #define FW_ENABLE_TEXT_LOGGING 1
249 #endif
250 
251 // Define the size of the text log string buffer. Should be large enough for format string and arguments
252 #ifndef FW_LOG_TEXT_BUFFER_SIZE
253 #define FW_LOG_TEXT_BUFFER_SIZE 256
254 #endif
255 
256 // Define if serializables have toString() method. Turning off will save code space and
257 // string constants. Must be enabled if text logging enabled
258 #ifndef FW_SERIALIZABLE_TO_STRING
259 #define FW_SERIALIZABLE_TO_STRING 1
260 #endif
261 
262 // Some settings to enable AMPCS compatibility. This breaks regular ISF GUI compatibility
263 #ifndef FW_AMPCS_COMPATIBLE
264 #define FW_AMPCS_COMPATIBLE 0
265 #endif
266 
267 // Configuration for Fw::String
268 #ifndef FW_FIXED_LENGTH_STRING_SIZE
269 #define FW_FIXED_LENGTH_STRING_SIZE 256
270 #endif
271 
272 // OS configuration
273 #ifndef FW_CONSOLE_HANDLE_MAX_SIZE
274 #define FW_CONSOLE_HANDLE_MAX_SIZE 24
275 #endif
276 
277 #ifndef FW_TASK_HANDLE_MAX_SIZE
278 #define FW_TASK_HANDLE_MAX_SIZE 24
279 #endif
280 
281 #ifndef FW_FILE_HANDLE_MAX_SIZE
282 #define FW_FILE_HANDLE_MAX_SIZE 16
283 #endif
284 
285 #ifndef FW_MUTEX_HANDLE_MAX_SIZE
286 #define FW_MUTEX_HANDLE_MAX_SIZE 72
287 #endif
288 
289 #ifndef FW_QUEUE_HANDLE_MAX_SIZE
290 #define FW_QUEUE_HANDLE_MAX_SIZE 352
291 #endif
292 
293 #ifndef FW_DIRECTORY_HANDLE_MAX_SIZE
294 #define FW_DIRECTORY_HANDLE_MAX_SIZE 16
295 #endif
296 
297 #ifndef FW_FILESYSTEM_HANDLE_MAX_SIZE
298 #define FW_FILESYSTEM_HANDLE_MAX_SIZE 16
299 #endif
300 
301 #ifndef FW_RAW_TIME_HANDLE_MAX_SIZE
302 #define FW_RAW_TIME_HANDLE_MAX_SIZE 56
303 #endif
304 
305 #ifndef FW_RAW_TIME_SERIALIZATION_MAX_SIZE
306 #define FW_RAW_TIME_SERIALIZATION_MAX_SIZE 8
307 #endif
308 
309 #ifndef FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE
310 #define FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE 56
311 #endif
312 
313 #ifndef FW_CPU_HANDLE_MAX_SIZE
314 #define FW_CPU_HANDLE_MAX_SIZE 16
315 #endif
316 
317 #ifndef FW_MEMORY_HANDLE_MAX_SIZE
318 #define FW_MEMORY_HANDLE_MAX_SIZE 16
319 #endif
320 
321 #ifndef FW_HANDLE_ALIGNMENT
322 #define FW_HANDLE_ALIGNMENT 8
323 #endif
324 
325 // Note: One buffer of this size will be stack-allocated during certain OSAL operations e.g. when copying a file
326 #ifndef FW_FILE_CHUNK_SIZE
327 #define FW_FILE_CHUNK_SIZE 512
328 #endif
329 
330 // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have
331 // the type definitions in Fw/Types/BasicTypes available.
332 #ifdef __cplusplus
333 }
334 #endif
335 
336 #endif