summaryrefslogtreecommitdiffstats
path: root/main/common/inc_check.h
blob: e755689e9b0f8d90daf2ac0f5c24e21b6724eb63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
/**************************************************************************
 *
 * Copyright (c) 2013 Alcatel-Lucent
 *
 * Alcatel Lucent licenses this file to You under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License.  A copy of the License is contained the
 * file LICENSE at the top level of this repository.
 * You may also obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 **************************************************************************
 *
 * inc_check.h:
 *
 * DESCRIPTION HERE
 *
 *
 *  This is an include file used to verify that all of the monitor macros
 *  are defined.  There is also some attempt to verify that macro conflicts
 *  do not exist (for example, the flash file system cannot exist if the
 *  flash driver is not included); however, there are probably holes in this
 *  check.
 *
 *  Following is a brief description of what each macro includes if set to
 *  non-zero...
 *
 *  INCLUDE_MEMCMDS:
 *      Memory display, modification and test commands.  The included as a
 *      result of setting this macro is primarily found in memcmds.c.
 *  INCLUDE_EDIT:
 *      An ascii file editor.  This is an on-board file editor that provides
 *      the system with the ability to edit files in TFS.  Refer to edit.c
 *      for details of this functionality.  This obviously assumes that TFS
 *      and the FLASH drivers are also enabled.
 *  INCLUDE_DISASSEMBLER:
 *      This pulls in a disassembler.
 *  INCLUDE_UNPACK:
 *  INCLUDE_UNZIP:
 *      These two macros define one of two different mechanisms for
 *      decompression of executables in TFS.  UNPACK is huffman and UNZIP
 *      is the public domain zlib stuff.  Huffman is a small addition to the
 *      monitor size but only provides about 15% compression.  The zlib stuff
 *      is a bit larger and needs more RAM for malloc() but it does a MUCH
 *      better job of compression.  I've seen as high as 75% of the file size
 *      compressed.  It is illegal to set both of these macros.
 *  INCLUDE_ETHERNET:
 *      This pulls in the basic ethernet drivers with ARP, and some of the
 *      lowest level ethernet interface code.
 *  INCLUDE_TFTP:
 *      This pulls in a TFTP client and server (obviously assumes ETHERNET
 *      is also pulled in).
 *  INCLUDE_DHCPBOOT:
 *      This pulls in a DHCP/BOOTP client (also assumes ETHERNET
 *      is also pulled in).
 *  INCLUDE_TFS:
 *  INCLUDE_TFSAPI:
 *  INCLUDE_TFSAUTODEFRAG:
 *  INCLUDE_TFSSYMTBL:
 *  INCLUDE_TFSSCRIPT:
 *  INCLUDE_TFSCLI:
 *      The above TFS macros allow the monitor to be built with varying degrees
 *      of FFS capability depending on the needs of the system.  INCLUDE_TFS
 *      is required by all others and is the minimum TFS hookup.  It provides
 *      the minimum set of TFS facilities such as autoboot, use of a monrc file
 *      for startup config, and defragmentation.  TFSAPI pulls in the TFS
 *      code that allows an application to hook into TFS's capabilities in
 *      code-space.  TFSCLI pulls in the TFS command at the command line
 *      interface.  TFSSAFEDEFRAG pulls in the power-safe defragmenation
 *      (otherwise a simpler, less robust mechanism is used).
 *      TFSSYMTBL pulls in the symbol-table functionality and TFSSCRIPT
 *      pulls in the CLI commands that are normally associated with scripts.
 *  INCLUDE_XMODEM:
 *      Pull in Xmodem.
 *  INCLUDE_LINEEDIT:
 *      Pull in a command line editor and history facility.
 *  INCLUDE_EE:
 *      Pull in an expression evaluator for the CLI.
 *      Note that this is not included with the public distribution.
 *  INCLUDE_FLASH:
 *      Pull in the flash drivers.
 *  INCLUDE_CRYPT:
 *      Pull in UNIX crypt() instead of a simpler encryption scheme I wrote.
 *      Note that this is not included with the public distribution.
 *  INCLUDE_GDB:
 *      Pull in the "gdb" command.  This is an incomplete facility that
 *      will eventually allow the monitor to hook up to a gdb debugger.
 *  INCLUDE_STRACE:
 *      Pull in the "strack trace" command.
 *  INCLUDE_CAST:
 *      Pull in the "cast" command for complex structure display at the
 *      CLI.
 *  INCLUDE_REDIRECT:
 *      This pulls in the code that allows the monitor's CLI to redirect
 *      command output to a TFS file.
 *  INCLUDE_QUICKMEMCPY:
 *      This pulls in some faster memcpy stuff in genlib.c.
 *  INCLUDE_PROFILER:
 *      This pulls in some code and a CLI command that provides an
 *      application with some task and function level profiling.
 *  INCLUDE_BBC:
 *      This pulls in some code and a CLI command that provides an
 *      application with a basic ability to organize basic block coverage
 *      verification.
 *  INCLUDE_MEMTRACE:
 *      This pulls in a simple memory trace capability.  It's a simple
 *      printf()-like function with data logged to RAM instead of a UART.
 *  INCLUDE_STOREMAC:
 *      This pulls in a function that forces the user to establish the MAC
 *      in the etheradd space allocated in reset.s.  It needs INCLUDE_FLASH
 *      because flash writes are done.  If not enabled the MAC address can
 *      still be stored in etheradd using the "ether mac" command.
 *  INCLUDE_SHELLVARS:
 *      This pulls in the monitor's ability to deal with shell variables.
 *      This includes the "set" command on the CLI, plus a lot of other
 *      subsections of the monitor depend on shell variables.
 *      This facility should only be disabled when there is a desperate
 *      need to shink the monitor's footprint.
 *  INCLUDE_MALLOC:
 *      This pulls in the monitor's malloc.  This includes the "heap"
 *      command on the CLI, plus a few other factilies in the monitor
 *      assume malloc is included; so without it, they won't work either.
 *      This facility should only be disabled when there is a desperate
 *      need to shink the monitor's footprint.
 *  INCLUDE_HWTMR:
 *      If set, then the target port must supply a function called
 *      target_timer() which returns a 32-bit value representing a
 *      a hardware-resident clock whose rate is defined by the value
 *      specified by TIMER_TICKS_PER_MSEC.
 *  INCLUDE_VERBOSEHELP:
 *      If set, then full help text is built in; else only the usage
 *      and abstract is included.
 *  INCLUDE_PORTCMD:
 *      If set, then the mon_portcmd(int cmd, void *arg) API can be
 *      used to build port-specific API extensions.
 *  INCLUDE_USRLVL:
 *      If set, then the code that incorporates user levels is included
 *      in the build.
 *  INCLUDE_STRUCT:
 *      If set, then the struct command is included in the build.  This
 *      requires that TFS be included also.
 *
 * Original author:     Ed Sutter (ed.sutter@alcatel-lucent.com)
 *
 */
#ifndef _INC_CHECK_H
#define _INC_CHECK_H

/***********************************************************************
 * Verify that the basic set of INCLUDE macros have been defined:
 */

#ifndef INCLUDE_ICMP
#error "INCLUDE_ICMP must be defined in config.h."
#endif

#ifndef INCLUDE_USRLVL
#error "INCLUDE_USRLVL must be defined in config.h."
#endif

#ifndef INCLUDE_PORTCMD
#error "INCLUDE_PORTCMD must be defined in config.h."
#endif

#ifndef INCLUDE_HWTMR
#error "INCLUDE_HWTMR must be defined in config.h."
#endif

#ifndef INCLUDE_VERBOSEHELP
#error "INCLUDE_VERBOSEHELP must be defined in config.h."
#endif

#ifndef INCLUDE_MEMTRACE
#error "INCLUDE_MEMTRACE must be defined in config.h."
#endif

#ifdef INCLUDE_TFSSAFEDEFRAG
#error "INCLUDE_TFSSAFEDEFRAG no longer needed."
#endif

#ifndef INCLUDE_MEMCMDS
#error "INCLUDE_MEMCMDS must be defined in config.h"
#endif

#ifndef INCLUDE_EDIT
#error "INCLUDE_EDIT must be defined in config.h"
#endif

#ifndef INCLUDE_DISASSEMBLER
#error "INCLUDE_DISASSEMBLER must be defined in config.h"
#endif

#ifndef INCLUDE_UNZIP
#error "INCLUDE_UNZIP must be defined in config.h"
#endif

#ifndef INCLUDE_ETHERNET
#error "INCLUDE_ETHERNET must be defined in config.h"
#endif

#ifndef INCLUDE_TFTP
#error "INCLUDE_TFTP must be defined in config.h"
#endif

#ifndef INCLUDE_DHCPBOOT
#error "INCLUDE_DHCPBOOT must be defined in config.h"
#endif

#ifndef INCLUDE_TFS
#error "INCLUDE_TFS  must be defined in config.h"
#endif

#ifndef INCLUDE_TFSCLI
#error "INCLUDE_TFSCLI must be defined in config.h"
#endif

#ifndef INCLUDE_TFSAPI
#error "INCLUDE_TFSAPI must be defined in config.h"
#endif

#ifndef INCLUDE_TFSSCRIPT
#error "INCLUDE_TFSSCRIPT must be defined in config.h"
#endif

#ifndef INCLUDE_TFSSYMTBL
#error "INCLUDE_TFSSYMTBL must be defined in config.h"
#endif

#ifndef INCLUDE_XMODEM
#error "INCLUDE_XMODEM must be defined in config.h"
#endif

#ifndef INCLUDE_LINEEDIT
#error "INCLUDE_LINEEDIT must be defined in config.h"
#endif

#ifndef INCLUDE_EE
#error "INCLUDE_EE must be defined in config.h"
#endif

#ifndef INCLUDE_FLASH
#error "INCLUDE_FLASH must be defined in config.h"
#endif

#ifndef INCLUDE_STRACE
#error "INCLUDE_STRACE must be defined in config.h"
#endif

#ifndef INCLUDE_CAST
#error "INCLUDE_CAST must be defined in config.h"
#endif

#ifdef INCLUDE_SHELLVAR
#error "INCLUDE_SHELLVAR definition no longer needed in config.h"
#endif

//#ifdef INCLUDE_MALLOC
//#error "INCLUDE_MALLOC definition no longer needed in config.h"
//#endif

#ifndef INCLUDE_REDIRECT
#error "INCLUDE_REDIRECT must be defined in config.h"
#endif

#ifndef INCLUDE_QUICKMEMCPY
#error "INCLUDE_QUICKMEMCPY must be defined in config.h"
#endif

#ifndef INCLUDE_PROFILER
#error "INCLUDE_PROFILER must be defined in config.h"
#endif

#ifndef INCLUDE_BBC
#error "INCLUDE_BBC must be defined in config.h"
#endif

#ifndef INCLUDE_STOREMAC
#error "INCLUDE_STOREMAC must be defined in config.h"
#endif

#ifndef INCLUDE_MALLOC
#error "INCLUDE_MALLOC must be defined in config.h"
#endif

#ifndef INCLUDE_SHELLVARS
#error "INCLUDE_SHELLVARS must be defined in config.h"
#endif

#ifndef INCLUDE_STRUCT
#error "INCLUDE_STRUCT must be defined in config.h"
#endif


/***********************************************************************
 * The storemac facility needs flash to be enabled.
 */
#if INCLUDE_STOREMAC
#if !INCLUDE_FLASH
#error  "Can't include STOREMAC without FLASH"
#endif
#endif

/***********************************************************************
 * The hardware timer facility needs to know the tick rate.
 */
#if INCLUDE_HWTMR
#ifndef TIMER_TICKS_PER_MSEC
#error "Can't set INCLUDE_HWTMR without TIMER_TICKS_PER_MSEC."
#endif
#endif

/***********************************************************************
 * Certain pieces of the monitor cannot be enabled without basic TFS:
 */
#if !INCLUDE_TFS
#if INCLUDE_REDIRECT
#error  "Can't include REDIRECT without TFS"
#endif
#if INCLUDE_PROFILER
#error  "Can't include PROFILER without TFS"
#endif
#if INCLUDE_USRLVL
#error  "Can't include USRLVL without TFS"
#endif
#if INCLUDE_STRUCT
#error  "Can't include STRUCT without TFS"
#endif
#endif

/***********************************************************************
 * Certain pieces of the monitor cannot be enabled without TFS API:
 */

#if !INCLUDE_TFSAPI

#if INCLUDE_EDIT
#error  "Can't include EDIT without TFSAPI"
#endif
#if INCLUDE_STRACE
#error  "Can't include STRACE without TFSAPI"
#endif
#if INCLUDE_TFSSYMTBL
#error  "Can't include TFSSYMTBL without TFSAPI"
#endif

#endif

/***********************************************************************
 * Certain pieces of the monitor cannot be enabled without ETHERNET:
 */
#if !INCLUDE_ETHERNET

#if INCLUDE_TFTP
#error  "Can't include TFTP without ETHERNET"
#endif
#if INCLUDE_DHCPBOOT
#error  "Can't include DHCPBOOT without ETHERNET"
#endif
#if INCLUDE_SYSLOG
#error  "Can't include SYSLOG without ETHERNET"
#endif
#if INCLUDE_ICMP
#error  "Can't include ICMP without ETHERNET"
#endif

#endif

/***********************************************************************
 * Just history...
 */
#define DONT_INCLUDE_OLDSTYLE_FLAGCHECK

/***********************************************************************
 * Check for things removed as of 1.0...
 */
#ifdef INCLUDE_UNPACK
#error  "INCLUDE_UNPACK is unused as of uMon 1.0"
#endif
#ifdef INCLUDE_DEBUG
#error  "INCLUDE_DEBUG is unused as of uMon 1.0"
#endif
#ifdef INCLUDE_PIO
#error  "INCLUDE_PIO is unused as of uMon 1.0"
#endif
#ifdef INCLUDE_EXCTEST
#error "INCLUDE_EXCTEST is unused as of uMon 1.0"
#endif
#ifdef INCLUDE_IDEV
#error "INCLUDE_IDEV is unused as of uMon 1.0"
#endif
#ifdef INCLUDE_CRYPT
#error "INCLUDE_CRYPT is unused as of uMon 1.0"
#endif
#ifdef INCLUDE_TFSAUTODEFRAG
#error "INCLUDE_TFSAUTODEFRAG is unused as of uMon 1.0"
#endif
#ifdef FLASH_LOCK_SUPPORTED
#error "FLASH_LOCK_SUPPORT is unused as of uMon 1.0"
#endif
#ifdef INCLUDE_ARGV
#error "INCLUDE_ARGV is unused as of uMon 1.0"
#endif


#endif