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