3 sdcc \- Small Device C Compiler
6 .I "[options] filename"
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
12 For complete and current documentation, refer to the
14 SDCC Compiler User Guide\c
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.
29 \&, a Freeware, retargettable assembler & linker.
31 \& has extensive language extensions suitable for utilizing various
32 microcontrollers and underlying hardware effectively.
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.
37 .SH PROCESSOR SELECTION OPTIONS
40 Generate code for the MCS51 (8051) family of processors. This is the default
44 Generate code for the DS80C390 processor.
47 Generate code for the DS80C400 processor.
50 Generate code for the Z80 family of processors.
53 Generate code for the GameBoy Z80 processor.
56 Generate code for the Atmel AVR processor (In development, not complete).
59 Generate code for the PIC 14-bit processors (In development, not complete).
62 Generate code for the PIC 14-bit processors (In development, not complete).
65 Generate code for the Toshiba TLCS-900H processor (In development, not
68 Generate code for the Phillips XA51 processor (In development, not
71 .SH PREPROCESSOR OPTIONS
74 The additional location where the pre processor will look for `<..h>' or
77 .BI "\-D " "<macro[=value]>"
78 Command line definition of macros. Passed to the pre processor.
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
94 Tell the preprocessor not to discard comments. Used with the
101 \& but the output mentions only the user header files included with
102 `#include "file"'. System header files included with `#include <file>'
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)'.
109 \& disables the standard assertions that normally describe the target machine.
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)'.
115 \& disables the standard assertions that normally describe the target machine.
118 Undefine macro macro.
120 \& options are evaluated after all
122 \& options, but before any
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
135 Tell the preprocessor to pass all macro definitions into the output, in their
136 proper sequence in the rest of the output.
141 \&except that the macro arguments and contents are omitted. Only
142 `#define name' is included in the output.
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
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
157 .B --xram-loc 32768\c
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
166 .B --code-loc 32768\c
169 .BI "\-\-stack-loc " "<Value>"
170 The initial value of the stack pointer. The default value of the stack pointer
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
178 \&. The value entered can be in Hexadecimal or Decimal format, eg.
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
187 .BI "\-\-stack-after-data"
188 This option will cause the stack to be located in the internal ram after the
191 .BI "\-\-data-loc " "<Value>"
192 The start location of the internal ram data segment, the default value is
194 \&. The value entered can be in Hexadecimal or Decimal format, eg.
200 .BI "--idata-loc " "<Value>"
201 The start location of the indirectly addressable internal ram, default value is
203 \&. The value entered can be in Hexadecimal or Decimal format, eg.
204 .B --idata-loc 0x88\c
209 .BI "\-\-out\-fmt\-ihx"
210 The linker output (final object code) is in Intel Hex format. (This is the
213 .BI "\-\-out\-fmt\-s19"
214 The linker output (final object code) is in Motorola S19 format.
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.
224 .BI "\-\-model\-small"
225 Generate code for Small Model programs see section Memory Models for more
226 details. This is the default model.
228 .SH DS390 / DS400 OPTIONS
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
236 .BI "\-\-protect\-sp\-update"
237 Disable interrupts during ESP:SP updates.
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
244 \&. In this mode, the stack is located in the lower 1K of the internal RAM,
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
255 .B --stack-auto option\c
256 \&, but that has not been tested. It is incompatible with the
258 \& option. It also only makes sense if the processor is in 24 bit contiguous
259 addressing mode (see the
264 .BI "\-\-callee\-saves\-bc"
265 Force a called function to always save BC.
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.
270 .SH OPTIMIZATIONS OPTIONS
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,
279 \& can be used to turn off global subexpression elimination for a given
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
287 .B #pragma NOINVARIANT\c
288 \& can be used to turn off invariant optimizations for a given function only.
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.
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
303 .BI "\-\-noloopreverse"
304 Will not do loop reversal optimization.
308 .BI "\-c, \-\-compile\-only"
309 will compile and assemble the source, but will not call the linkage editor.
312 Run only the C preprocessor. Preprocess all the C source files specified and
313 output the results to standard output.
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.
321 Uses a pseudo stack in the first 256 bytes in the external ram for allocating
322 variables and passing parameters.
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
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.
337 \& use this option for built-in functions such as
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
347 When this option is used the compiler will generate debug information, that can
350 \&. The debug information is collected in a file with .cdb extension.
353 This option is obsolete and isn't supported anymore.
356 This option is obsolete and isn't supported anymore.
358 .BI "\-\-peep-file" "<filename>
359 This option can be used to use additional rules to be used by the peep hole
363 Stop after the stage of compilation proper; do not assemble. The output is an
364 assembler code file for the input file specified.
366 .BI "\-Wa_" "asmOption[,asmOption]...]"
367 Pass the asmOption to the assembler.
369 .BI "\-Wl_" "linkOption[,linkOption]...]"
370 Pass the linkOption to the linker.
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.
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.
382 .BI "\-\-float\-reent"
383 Floating point library is compiled as reentrant.
386 The compiler will not overlay parameters and local variables of any function,
387 see section Parameters and local variables for more details.
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 '.
395 Disable peep-hole optimization.
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
403 .BI "\-\-iram\-size " "<Value>"
404 Causes the linker to check if the interal ram usage is within limits of the
408 This will prevent the compiler from passing on the default include path to the
412 This will prevent the compiler from passing on the default library path to the
416 Shows the various actions the compiler is performing.
419 Shows the actual commands the compiler is executing.
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.
428 This option will cause the compiler to dump the intermediate code into a file
429 of named <source filename>.
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.
436 Will create a dump of iCode's, after global subexpression elimination, into a
437 file named <source filename>.dumpgcse.
439 .BI "\-\-dumpdeadcode"
440 Will create a dump of iCode's, after deadcode elimination, into a file named
441 <source filename>.dumpdeadcode.
444 Will create a dump of iCode's, after loop optimizations, into a file named
445 <source filename>.dumploop.
448 Will create a dump of iCode's, after live range analysis, into a file named
449 <source filename>.dumprange.
452 Will dump the life ranges for all symbols.
454 .BI "\-\-dumpregassign"
455 Will create a dump of iCode's, after register assignment, into a file named
456 <source filename>.dumprassgn.
459 Will create a dump of the live ranges of iTemp's
462 Will cause all the above mentioned dumps to be created.
465 The entire source code for the compiler is distributed under GNU General Public
469 sdcpp(1), asxxxx(1), aslink(1).
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).