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 // Type aliases
22 // ----------------------------------------------------------------------
23 #define FW_CONTEXT_DONT_CARE 0xFF
24 
25 // ----------------------------------------------------------------------
26 // Configuration switches
27 // ----------------------------------------------------------------------
28 
29 // Boolean values for serialization
30 #ifndef FW_SERIALIZE_TRUE_VALUE
31 #define FW_SERIALIZE_TRUE_VALUE (0xFF)
32 #endif
33 
34 #ifndef FW_SERIALIZE_FALSE_VALUE
35 #define FW_SERIALIZE_FALSE_VALUE (0x00)
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
48 #else
49 #define FW_OPTIONAL_NAME(name) ""
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 // Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values
129 
130 // The size of the object name stored in the object base class. Larger names will be truncated.
131 #if FW_OBJECT_NAMES
132 #ifndef FW_OBJ_NAME_BUFFER_SIZE
133 #define FW_OBJ_NAME_BUFFER_SIZE \
134  80
135 #endif
136 #endif
137 
138 #if FW_OBJECT_REGISTRATION
139 // For the simple object registry provided with the framework, this specifies how many objects the registry will store.
140 #ifndef FW_OBJ_SIMPLE_REG_ENTRIES
141 #define FW_OBJ_SIMPLE_REG_ENTRIES 500
142 #endif
143 // When dumping the contents of the registry, this specifies the size of the buffer used to store object names. Should
144 // be >= FW_OBJ_NAME_BUFFER_SIZE.
145 #ifndef FW_OBJ_SIMPLE_REG_BUFF_SIZE
146 #define FW_OBJ_SIMPLE_REG_BUFF_SIZE 255
147 #endif
148 #endif
149 
150 #if FW_QUEUE_REGISTRATION
151 // For the simple queue registry provided with the framework, this specifies how many queues the registry will store.
152 #ifndef FW_QUEUE_SIMPLE_QUEUE_ENTRIES
153 #define FW_QUEUE_SIMPLE_QUEUE_ENTRIES 100
154 #endif
155 #endif
156 
157 // Specifies the size of the string holding the queue name for queues
158 #ifndef FW_QUEUE_NAME_BUFFER_SIZE
159 #define FW_QUEUE_NAME_BUFFER_SIZE 80
160 #endif
161 
162 // Specifies the size of the string holding the task name for active components and tasks
163 #ifndef FW_TASK_NAME_BUFFER_SIZE
164 #define FW_TASK_NAME_BUFFER_SIZE 80
165 #endif
166 
167 // Specifies the size of the buffer that contains a communications packet.
168 #ifndef FW_COM_BUFFER_MAX_SIZE
169 #define FW_COM_BUFFER_MAX_SIZE 512
170 #endif
171 
172 // Specifies the size of the buffer attached to state machine signals.
173 #ifndef FW_SM_SIGNAL_BUFFER_MAX_SIZE
174 #define FW_SM_SIGNAL_BUFFER_MAX_SIZE 128 // Not to exceed max value of FwSizeType
175 #endif
176 
177 // Specifies the size of the buffer that contains the serialized command arguments.
178 
179 #ifndef FW_CMD_ARG_BUFFER_MAX_SIZE
180 #define FW_CMD_ARG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType))
181 #endif
182 
183 // Specifies the maximum size of a string in a command argument
184 #ifndef FW_CMD_STRING_MAX_SIZE
185 #define FW_CMD_STRING_MAX_SIZE 40
186 #endif
187 
188 // Normally when a command is deserialized, the handler checks to see if there are any leftover
189 // bytes in the buffer. If there are, it assumes that the command was corrupted somehow since
190 // the serialized size should match the serialized size of the argument list. In some cases,
191 // command buffers are padded so the data can be larger than the serialized size of the command.
192 // Setting the below to zero will disable the check at the cost of not detecting commands that
193 // are too large.
194 #ifndef FW_CMD_CHECK_RESIDUAL
195 #define FW_CMD_CHECK_RESIDUAL 1
196 #endif
197 
198 // Specifies the size of the buffer that contains the serialized log arguments.
199 #ifndef FW_LOG_BUFFER_MAX_SIZE
200 #define FW_LOG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType))
201 #endif
202 
203 // Specifies the maximum size of a string in a log event
204 // Note: This constant truncates file names in assertion failure event reports
205 #ifndef FW_LOG_STRING_MAX_SIZE
206 #define FW_LOG_STRING_MAX_SIZE 200
207 #endif
208 
209 // Specifies the size of the buffer that contains the serialized telemetry value.
210 #ifndef FW_TLM_BUFFER_MAX_SIZE
211 #define FW_TLM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType))
212 #endif
213 
214 // Specifies the size of the buffer that contains statement args for the FpySequencer
215 #ifndef FW_STATEMENT_ARG_BUFFER_MAX_SIZE
216 #define FW_STATEMENT_ARG_BUFFER_MAX_SIZE (FW_CMD_ARG_BUFFER_MAX_SIZE)
217 #endif
218 
219 // Specifies the maximum size of a string in a telemetry channel
220 #ifndef FW_TLM_STRING_MAX_SIZE
221 #define FW_TLM_STRING_MAX_SIZE 40
222 #endif
223 
224 // Specifies the size of the buffer that contains the serialized parameter value.
225 #ifndef FW_PARAM_BUFFER_MAX_SIZE
226 #define FW_PARAM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType))
227 #endif
228 
229 // Specifies the maximum size of a string in a parameter
230 #ifndef FW_PARAM_STRING_MAX_SIZE
231 #define FW_PARAM_STRING_MAX_SIZE 40
232 #endif
233 
234 // Specifies the maximum size of a file downlink chunk
235 #ifndef FW_FILE_BUFFER_MAX_SIZE
236 #define FW_FILE_BUFFER_MAX_SIZE FW_COM_BUFFER_MAX_SIZE
237 #endif
238 
239 // Specifies the maximum size of a string in an interface call
240 #ifndef FW_INTERNAL_INTERFACE_STRING_MAX_SIZE
241 #define FW_INTERNAL_INTERFACE_STRING_MAX_SIZE 256
242 #endif
243 
244 // Enables text logging of events as well as data logging. Adds a second logging port for text output.
245 // In order to set this to 0, FPRIME_ENABLE_TEXT_LOGGERS must be set to OFF.
246 #ifndef FW_ENABLE_TEXT_LOGGING
247 #define FW_ENABLE_TEXT_LOGGING 1
248 #endif
249 
250 // Define the size of the text log string buffer. Should be large enough for format string and arguments
251 #ifndef FW_LOG_TEXT_BUFFER_SIZE
252 #define FW_LOG_TEXT_BUFFER_SIZE 256
253 #endif
254 
255 // Define if serializables have toString() method. Turning off will save code space and
256 // string constants. Must be enabled if text logging enabled
257 #ifndef FW_SERIALIZABLE_TO_STRING
258 #define FW_SERIALIZABLE_TO_STRING 1
259 #endif
260 
261 // Some settings to enable AMPCS compatibility. This breaks regular ISF GUI compatibility
262 #ifndef FW_AMPCS_COMPATIBLE
263 #define FW_AMPCS_COMPATIBLE 0
264 #endif
265 
266 // Configuration for Fw::String
267 #ifndef FW_FIXED_LENGTH_STRING_SIZE
268 #define FW_FIXED_LENGTH_STRING_SIZE 256
269 #endif
270 
271 // OS configuration
272 #ifndef FW_CONSOLE_HANDLE_MAX_SIZE
273 #define FW_CONSOLE_HANDLE_MAX_SIZE 24
274 #endif
275 
276 #ifndef FW_TASK_HANDLE_MAX_SIZE
277 #define FW_TASK_HANDLE_MAX_SIZE 24
278 #endif
279 
280 #ifndef FW_FILE_HANDLE_MAX_SIZE
281 #define FW_FILE_HANDLE_MAX_SIZE 16
282 #endif
283 
284 #ifndef FW_MUTEX_HANDLE_MAX_SIZE
285 #define FW_MUTEX_HANDLE_MAX_SIZE 72
286 #endif
287 
288 #ifndef FW_QUEUE_HANDLE_MAX_SIZE
289 #define FW_QUEUE_HANDLE_MAX_SIZE 352
290 #endif
291 
292 #ifndef FW_DIRECTORY_HANDLE_MAX_SIZE
293 #define FW_DIRECTORY_HANDLE_MAX_SIZE 16
294 #endif
295 
296 #ifndef FW_FILESYSTEM_HANDLE_MAX_SIZE
297 #define FW_FILESYSTEM_HANDLE_MAX_SIZE 16
298 #endif
299 
300 #ifndef FW_RAW_TIME_HANDLE_MAX_SIZE
301 #define FW_RAW_TIME_HANDLE_MAX_SIZE 56
302 #endif
303 
304 #ifndef FW_RAW_TIME_SERIALIZATION_MAX_SIZE
305 #define FW_RAW_TIME_SERIALIZATION_MAX_SIZE 8
306 #endif
307 
308 #ifndef FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE
309 #define FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE 56
310 #endif
311 
312 #ifndef FW_CPU_HANDLE_MAX_SIZE
313 #define FW_CPU_HANDLE_MAX_SIZE 16
314 #endif
315 
316 #ifndef FW_MEMORY_HANDLE_MAX_SIZE
317 #define FW_MEMORY_HANDLE_MAX_SIZE 16
318 #endif
319 
320 #ifndef FW_HANDLE_ALIGNMENT
321 #define FW_HANDLE_ALIGNMENT 8
322 #endif
323 
324 // Note: One buffer of this size will be stack-allocated during certain OSAL operations e.g. when copying a file
325 #ifndef FW_FILE_CHUNK_SIZE
326 #define FW_FILE_CHUNK_SIZE 512
327 #endif
328 
329 #ifndef FW_ASSERT_COUNT_MAX
330 #define FW_ASSERT_COUNT_MAX 10
331 #endif
332 
333 // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have
334 // the type definitions in Fw/Types/BasicTypes available.
335 #ifdef __cplusplus
336 }
337 #endif
338 
339 #endif