Imported Debian patch 2.9.0-5
[debian/cc1111] / debian / manpages / sdcc.1
1 .TH SDCC 1
2 .SH NAME
3 sdcc \- Small Device C Compiler
4 .SH SYNOPSIS
5 .B sdcc
6 .I "[options] filename"
7 .SH WARNING
8 The information in this man page is an extract from the full
9 documentation of SDCC, and is limited to the meaning of the 
10 options.
11 .PP
12 For complete and current documentation, refer to the 
13 .B
14 SDCC Compiler User Guide\c
15 \&.
16
17 .SH "DESCRIPTION"
18 .B SDCC
19 is a Freeware, retargettable, optimizing ANSI-C compiler. The current 
20 version targets Intel MCS51 based Microprocessors(8051, 8052, etc), Zilog 
21 Z80 based MCUs, and the Dallas DS80C390 variant. It can be retargetted for 
22 other microprocessors, support for PIC, AVR and 186 is under development. 
23 .PP
24 .B SDCC\c
25 \& uses 
26 .B ASXXXX\c
27 \& & 
28 .B ASLINK\c
29 \&, a Freeware, retargettable assembler & linker.
30 .B SDCC\c
31 \& has extensive language extensions suitable for utilizing various
32 microcontrollers and underlying hardware effectively.
33 .PP
34 The compiler also allows inline assembler code to be embedded anywhere in a
35 function. In addition, routines developed in assembly can also be called.
36
37 .SH PROCESSOR SELECTION OPTIONS
38 .TP
39 .BI "\-mmcs51"
40 Generate code for the MCS51 (8051) family of processors. This is the default 
41 processor target.
42 .TP
43 .BI "\-mds390"
44 Generate code for the DS80C390 processor.
45 .TP
46 .BI "\-mds400"
47 Generate code for the DS80C400 processor.
48 .TP
49 .BI "\-mz80"
50 Generate code for the Z80 family of processors.
51 .TP
52 .BI "\-mgbz80"
53 Generate code for the GameBoy Z80 processor.
54 .TP
55 .BI "\-mavr"
56 Generate code for the Atmel AVR processor (In development, not complete).
57 .TP
58 .BI "\-mpic14"
59 Generate code for the PIC 14-bit processors (In development, not complete).
60 .TP
61 .BI "\-mpic16"
62 Generate code for the PIC 14-bit processors (In development, not complete).
63 .TP
64 .BI "\-mtlcs900h"
65 Generate code for the Toshiba TLCS-900H processor (In development, not 
66 complete).
67 .BI "\-mxa51"
68 Generate code for the Phillips XA51 processor (In development, not 
69 complete).
70
71 .SH PREPROCESSOR OPTIONS
72 .TP
73 .BI "\-I" "<path>"
74 The additional location where the pre processor will look for `<..h>' or 
75 `..h' files.
76 .TP
77 .BI "\-D " "<macro[=value]>"
78 Command line definition of macros. Passed to the pre processor.
79 .TP
80 .BI "\-M"
81 Tell the preprocessor to output a rule suitable for make describing the 
82 dependencies of each object file. For each source file, the preprocessor 
83 outputs one make-rule whose target is the object file name for that source 
84 file and whose dependencies are all the files `#include'd in it. This rule 
85 may be a single line or may be continued with `\\'-newline if it is long. 
86 The list of rules is printed on standard output instead of the preprocessed 
87 C program. 
88 .B `-M'\c
89 \& implies 
90 .B `-E'\c
91 \&.
92 .TP
93 .BI "-C"
94 Tell the preprocessor not to discard comments. Used with the 
95 .B `-E' 
96 option.
97 .TP
98 .BI "\-MM"
99 Like 
100 .B `-M'\c
101 \& but the output mentions only the user header files included with
102 `#include "file"'. System header files included with `#include <file>' 
103 are omitted.
104 .TP
105 .BI "\-A " "question(answer)"
106 Assert the answer answer for question, in case it is tested with a 
107 preprocessor conditional such as `#if #question(answer)'. 
108 .B `-A-'\c
109 \& disables the standard assertions that normally describe the target machine.
110 .TP
111 .BI "\-A " "question"
112 (answer) Assert the answer answer for question, in case it is tested with a 
113 preprocessor conditional such as `#if #question(answer)'. 
114 .B `-A-'\c
115 \& disables the standard assertions that normally describe the target machine.
116 .TP
117 .BI "-Umacro"
118 Undefine macro macro. 
119 .B `-U'\c
120 \& options are evaluated after all 
121 .B `-D'\c
122 \& options, but before any 
123 .B `-include'\c
124 \& and 
125 .B `-imacros'\c
126 \& options.
127 .TP
128 .BI "\-dM"
129 Tell the preprocessor to output only a list of the macro definitions that 
130 are in effect at the end of preprocessing. Used with the 
131 .B '-E'\c
132 \& option.
133 .TP
134 .BI "\-dD"
135 Tell the preprocessor to pass all macro definitions into the output, in their 
136 proper sequence in the rest of the output.
137 .TP
138 .BI "\-dN"
139 Like 
140 .B `-dD'\c
141 \&except that the macro arguments and contents are omitted. Only 
142 `#define name' is included in the output.
143
144 .SH LINKER OPTIONS
145 .TP
146 .BI "\-L, \-lib\-path" "<absolute path to additional libraries>"
147 This option is passed to the linkage editor's additional libraries search 
148 path. The path name must be absolute. Additional library files may be 
149 specified in the command line. See section Compiling programs for more 
150 details.
151 .TP
152 .BI "\-\-xram-loc " "<Value>"
153 The start location of the external ram, default value is 0. The value entered 
154 can be in Hexadecimal or Decimal format, e.g.: 
155 .B --xram-loc 0x8000\c
156 \& or
157 .B --xram-loc 32768\c
158 \&.
159 .TP
160 .BI "\-\-code-loc " "<Value>"
161 The start location of the code segment, default value 0. Note when this 
162 option is used the interrupt vector table is also relocated to the given 
163 address. The value entered can be in Hexadecimal or Decimal format, e.g.: 
164 .B --code-loc 0x8000\c
165 \& or
166 .B --code-loc 32768\c
167 \&.
168 .TP
169 .BI "\-\-stack-loc " "<Value>" 
170 The initial value of the stack pointer. The default value of the stack pointer 
171 is 
172 .B 0x07\c
173 \& if only register bank 0 is used, if other register banks are used then the 
174 stack pointer is initialized to the location above the highest register bank 
175 used. eg. if register banks 1 & 2 are used the stack pointer will default to 
176 location 
177 .B 0x18\c
178 \&. The value entered can be in Hexadecimal or Decimal format, eg. 
179 .B --stack-loc 0x20 
180 or 
181 .B --stack-loc 32\c
182 \&. If all four register banks are used the stack will be placed after the data 
183 segment (equivalent to 
184 .B --stack-after-data\c
185 \&)
186 .TP
187 .BI "\-\-stack-after-data" 
188 This option will cause the stack to be located in the internal ram after the 
189 data segment.
190 .TP
191 .BI "\-\-data-loc " "<Value>"
192 The start location of the internal ram data segment, the default value is 
193 .B 0x30\c
194 \&. The value entered can be in Hexadecimal or Decimal format, eg. 
195 .B --data-loc 0x20\c
196 \& or 
197 .B --data-loc 32\c
198 \&.
199 .TP
200 .BI "--idata-loc " "<Value>"
201 The start location of the indirectly addressable internal ram, default value is
202 .B 0x80\c
203 \&. The value entered can be in Hexadecimal or Decimal format, eg. 
204 .B --idata-loc 0x88\c
205 \& or
206 .B --idata-loc 136\c
207 \&.
208 .TP
209 .BI "\-\-out\-fmt\-ihx"
210 The linker output (final object code) is in Intel Hex format. (This is the 
211 default option).
212 .TP
213 .BI "\-\-out\-fmt\-s19"
214 The linker output (final object code) is in Motorola S19 format.
215
216 .SH MCS51 OPTIONS
217 .TP
218 .BI "\-\-model\-large"
219 Generate code for Large model programs see section Memory Models for more 
220 details. If this option is used all source files in the project should be 
221 compiled with this option. In addition the standard library routines are 
222 compiled with small model, they will need to be recompiled.
223 .TP
224 .BI "\-\-model\-small"
225 Generate code for Small Model programs see section Memory Models for more 
226 details. This is the default model.
227
228 .SH DS390 / DS400 OPTIONS
229 .TP
230 .BI "\-\-model\-flat24"
231 Generate 24-bit flat mode code. This is the one and only that the ds390 code 
232 generator supports right now and is default when using 
233 .B -mds390\c
234 \&.
235 .TP
236 .BI "\-\-protect\-sp\-update"
237 Disable interrupts during ESP:SP updates.
238 .TP
239 .BI "\_-\-stack\-10bit"
240 Generate code for the 10 bit stack mode of the Dallas DS80C390 part. This is 
241 the one and only that the ds390 code generator supports right now and is 
242 default when using 
243 .B -mds390\c
244 \&. In this mode, the stack is located in the lower 1K of the internal RAM, 
245 which is mapped to 
246 .B 0x400000
247 \&. Note that the support is incomplete, since it still uses a single byte as 
248 the stack pointer. This means that only the lower 256 bytes of the potential 
249 1K stack space will actually be used. However, this does allow you to reclaim 
250 the precious 256 bytes of low RAM for use for the DATA and IDATA segments. The 
251 compiler will not generate any code to put the processor into 10 bit stack 
252 mode. It is important to ensure that the processor is in this mode before 
253 calling any re-entrant functions compiled with this option. In principle, this 
254 should work with the 
255 .B --stack-auto option\c
256 \&, but that has not been tested. It is incompatible with the 
257 .B --xstack\c
258 \& option. It also only makes sense if the processor is in 24 bit contiguous 
259 addressing mode (see the 
260 .B --model-flat24\c
261 \& option).
262 .SH Z80 Options
263 .TP
264 .BI "\-\-callee\-saves\-bc"
265 Force a called function to always save BC.
266 .TP
267 .BI "\-\-no\-std\-crt0"
268 When linking, skip the standard crt0.o object file. You must provide your own crt0.o for your system when linking.
269
270 .SH OPTIMIZATIONS OPTIONS
271 .TP
272 .BI "\-\-nogcse"
273 Will not do global subexpression elimination, this option may be used when the 
274 compiler creates undesirably large stack/data spaces to store compiler 
275 temporaries. A warning message will be generated when this happens and the 
276 compiler will indicate the number of extra bytes it allocated. It recommended 
277 that this option NOT be used, 
278 .B #pragma NOGCSE\c
279 \& can be used to turn off global subexpression elimination for a given 
280 function only.
281 .TP
282 .BI "\-\-noinvariant"
283 Will not do loop invariant optimizations, this may be turned off for reasons 
284 explained for the previous option. For more details of loop optimizations 
285 performed see section Loop Invariants.It recommended that this option NOT be 
286 used, 
287 .B #pragma NOINVARIANT\c
288 \& can be used to turn off invariant optimizations for a given function only.
289 .TP
290 .BI "\-\-noinduction"
291 Will not do loop induction optimizations, see section strength reduction for 
292 more details. It is recommended that this option is NOT used, 
293 .B #pragma NOINDUCTION\c
294 \& can be used to turn off induction optimizations for a given function only.
295 .TP
296 .BI "\-\-nojtbound"
297 Will not generate boundary condition check when switch statements are 
298 implemented using jump-tables. It is recommended that this option is NOT used, 
299 .B #pragma NOJTBOUND\c
300 \& can be used to turn off boundary checking for jump tables for a given 
301 function only.
302 .TP
303 .BI "\-\-noloopreverse"
304 Will not do loop reversal optimization.
305
306 .SH OTHER OPTIONS
307 .TP
308 .BI "\-c, \-\-compile\-only"
309 will compile and assemble the source, but will not call the linkage editor.
310 .TP
311 .BI "\-E"
312 Run only the C preprocessor. Preprocess all the C source files specified and 
313 output the results to standard output.
314 .TP
315 .BI "\-\-stack-auto"
316 All functions in the source file will be compiled as reentrant, i.e. the 
317 parameters and local variables will be allocated on the stack. If this option 
318 is used all source files in the project should be compiled with this option.
319 .TP
320 .BI "\-\-xstack"
321 Uses a pseudo stack in the first 256 bytes in the external ram for allocating 
322 variables and passing parameters.
323 .TP
324 .BI "\-\-callee-saves " "function1[,function2][,function3]...."
325 The compiler by default uses a caller saves convention for register saving 
326 across function calls, however this can cause unneccessary register pushing & 
327 popping when calling small functions from larger functions. This option can be 
328 used to switch the register saving convention for the function names specified.
329 The compiler will not save registers when calling these functions, no extra 
330 code will be generated at the entry & exit for these functions to save & 
331 restore the registers used by these functions, this can 
332 .I SUBSTANTIALLY\c
333 \& reduce code & improve run time performance of the generated code. In the 
334 future the compiler (with interprocedural analysis) will be able to determine 
335 the appropriate scheme to use for each function call. 
336 .I DO NOT\c
337 \& use this option for built-in functions such as 
338 .B _muluint\c
339 \&..., if this option is used for a library function the appropriate library 
340 function needs to be recompiled with the same option. If the project consists 
341 of multiple source files then all the source file should be compiled with the 
342 same 
343 .B --callee-saves\c
344 \& option string. 
345 .TP
346 .BI "\-\-debug"
347 When this option is used the compiler will generate debug information, that can
348 be used with the 
349 .B SDCDB\c
350 \&. The debug information is collected in a file with .cdb extension.  
351 .TP
352 .BI "\-\-regextend" 
353 This option is obsolete and isn't supported anymore.
354 .TP
355 .BI "\-\-noregparms"
356 This option is obsolete and isn't supported anymore.
357 .TP
358 .BI "\-\-peep-file" "<filename>
359 This option can be used to use additional rules to be used by the peep hole 
360 optimizer. 
361 .TP
362 .BI "\-S"
363 Stop after the stage of compilation proper; do not assemble. The output is an 
364 assembler code file for the input file specified.
365 .TP
366 .BI "\-Wa_" "asmOption[,asmOption]...]"
367 Pass the asmOption to the assembler.
368 .TP
369 .BI "\-Wl_" "linkOption[,linkOption]...]"
370 Pass the linkOption to the linker.
371 .TP
372 .BI "\-\-int-long-reent" 
373 Integer (16 bit) and long (32 bit) libraries have been compiled as reentrant. 
374 Note by default these libraries are compiled as non-reentrant. 
375 .TP
376 .BI "\-\-cyclomatic"
377 This option will cause the compiler to generate an information message for each
378 function in the source file. The message contains some important information 
379 about the function. The number of edges and nodes the compiler detected in the 
380 control flow graph of the function, and most importantly the cyclomatic complexity.
381 .TP
382 .BI "\-\-float\-reent" 
383 Floating point library is compiled as reentrant.
384 .TP
385 .BI "\-\-nooverlay" 
386 The compiler will not overlay parameters and local variables of any function, 
387 see section Parameters and local variables for more details.
388 .TP
389 .BI "\-\-main\-return"
390 This option can be used when the code generated is called by a monitor program.
391 The compiler will generate a 'ret' upon return from the 'main' function. The 
392 default option is to lock up i.e. generate a 'ljmp '.
393 .TP
394 .BI "\-\-no\-peep" 
395 Disable peep-hole optimization.
396 .TP
397 .BI "\-\-peep\-asm" 
398 Pass the inline assembler code through the peep hole optimizer. This can cause 
399 unexpected changes to inline assembler code, please go through the peephole 
400 optimizer rules defined in the source file tree '<target>/peeph.def' before 
401 using this option.
402 .TP
403 .BI "\-\-iram\-size " "<Value>"
404 Causes the linker to check if the interal ram usage is within limits of the 
405 given value.
406 .TP
407 .BI "\-\-nostdincl"
408 This will prevent the compiler from passing on the default include path to the 
409 preprocessor.
410 .TP
411 .BI "\-\-nostdlib"
412 This will prevent the compiler from passing on the default library path to the 
413 linker.
414 .TP
415 .BI "\-\-verbose"
416 Shows the various actions the compiler is performing.
417 .TP
418 .BI "\-V"
419 Shows the actual commands the compiler is executing.
420
421 .SH INTERMEDIATE DUMP OPTIONS
422 The following options are provided for the purpose of retargetting and 
423 debugging the compiler. These provided a means to dump the intermediate code 
424 (iCode) generated by the compiler in human readable form at various stages of 
425 the compilation process.
426 .TP
427 .BI "\-\-dumpraw"
428 This option will cause the compiler to dump the intermediate code into a file 
429 of named <source filename>. 
430 .B dumpraw\c
431 \& just after the intermediate code has been generated for a function, i.e. 
432 before any optimizations are done. The basic blocks at this stage ordered in 
433 the depth first number, so they may not be in sequence of execution.
434 .TP
435 .BI "\-\-dumpgcse"
436 Will create a dump of iCode's, after global subexpression elimination, into a 
437 file named <source filename>.dumpgcse.
438 .TP
439 .BI "\-\-dumpdeadcode"
440 Will create a dump of iCode's, after deadcode elimination, into a file named 
441 <source filename>.dumpdeadcode.
442 .TP
443 .BI "\-\-dumploop"
444 Will create a dump of iCode's, after loop optimizations, into a file named 
445 <source filename>.dumploop.
446 .TP
447 .BI "\-\-dumprange"
448 Will create a dump of iCode's, after live range analysis, into a file named 
449 <source filename>.dumprange.
450 .TP
451 .BI "\-\-dumlrange"
452 Will dump the life ranges for all symbols.
453 .TP
454 .BI "\-\-dumpregassign"
455 Will create a dump of iCode's, after register assignment, into a file named 
456 <source filename>.dumprassgn.
457 .TP
458 .BI "\-\-dumplrange"
459 Will create a dump of the live ranges of iTemp's
460 .TP
461 .BI "\-\-dumpall"
462 Will cause all the above mentioned dumps to be created.
463
464 .SH COPYING
465 The entire source code for the compiler is distributed under GNU General Public
466 License.
467
468 .SH SEE ALSO
469 sdcpp(1), asxxxx(1), aslink(1).
470
471 .SH AUTHOR
472 This manual page was written by Aurelien Jarno <aurel32@debian.org>,
473 for the Debian GNU/Linux system (but may be used by others).
474