3.3.4 Other Options
- [-v —version] displays
the sdcc version.
- [-c —compile-only] will
compile and assemble the source, but will not call the linkage editor.
- [--c1mode] reads
the preprocessed source from standard input and compiles it. The file
name for the assembler output must be specified using the -o option.
- [-E] Run only the C preprocessor.
Preprocess all the C source files specified and output the results
to standard output.
- [—syntax-only] Parse
and verify syntax only, no output files are produced.
- [-o <path/file>] The output path
where everything will be placed or the file name used for all generated
output files. If the parameter is a path, it must have a trailing
slash (or backslash for the Windows binaries) to be recognized as
a path. Note for Windows users: if the path contains spaces, it should
be surrounded by quotes. The trailing backslash should be doubled
in order to prevent escaping the final quote, for example: -o
”F:\Projects\test3\output
1\\” or put after the final quote,
for example: -o ”F:\Projects\test3\output
1”\. The path using slashes for directory delimiters
can be used too, for example: -o ”F:/Projects/test3/output
1/”.
- [-x <type>] The specified type overrides
the file type that SDCC detected based on the file name extension.
The currently supported options are ”c”, ”c-header” and ”none”.
The option ”none” restores the default behavior.
- [—stack-auto] All
functions in the source file will be compiled as reentrant,
i.e. the parameters and local variables will be allocated on the stack.
See section 3.6 Parameters and
Local Variables for more details. If this option is used all source
files in the project should be compiled with this option. It automatically
implies --int-long-reent and --float-reent.
- [—callee-saves] function1[,function2][,function3]....
The compiler by default uses a caller saves convention for register
saving across function calls, however this can cause unnecessary register
pushing and popping when calling small functions from larger functions.
This option can be used to switch the register saving convention for
the function names specified. The compiler will not save registers
when calling these functions, no extra code will be generated at the
entry and exit (function prologue
and epilogue) for these functions
to save and restore the registers used by these functions, this can
SUBSTANTIALLY reduce code and improve run time performance of the
generated code. In the future the compiler (with inter procedural
analysis) will be able to determine the appropriate scheme to use
for each function call. DO NOT use this option for built-in functions
such as _mulint..., if this option is used for a library function
the appropriate library function needs to be recompiled with the same
option. If the project consists of multiple source files then all
the source file should be compiled with the same —callee-saves
option string. Also see #pragma callee_saves
ite:callee_saves-function1=00005B,function2=00005B,function3...=00005D=00005D–.
- [—all-callee-saves] Function
of —callee-saves will be applied to all functions by default.
- [—debug] When this option
is used the compiler will generate debug information. By default,
the debug information collected in a file with .cdb extension can
be used with the SDCDB. For more information see documentation for
SDCDB. Another file with a .omf extension contains debug information
in AOMF or AOMF51 format which is commonly used
by third party tools. When –out-gmt-elf is used, the debug information
is in DWARF format instead.
- [-S] Stop after the stage of compilation proper;
do not assemble. The output is an assembler code file for the input
file specified.
- [—int-long-reent] Integer
(16 bit) and long (32 bit) libraries have been compiled as reentrant.
Note by default these libraries are compiled as non-reentrant. See
section Installation for more details.
- [—cyclomatic] This
option will cause the compiler to generate an information message
for each function in the source file. The message contains some important
information about the function. The number of edges and nodes the
compiler detected in the control flow graph of the function, and most
importantly the cyclomatic complexity
see section on Cyclomatic Complexity for more details.
- [—float-reent] Floating
point library is compiled as reentrant. See section
Installation for more details.
- [—fsigned-char] By
default char is unsigned. To set the signedness for characters
to signed, use the option --fsigned-char. If this option
is set and no signedness keyword (unsigned/signed) is given, a char
will be unsigned. All other types are unaffected.
- [—nostdinc] This will
prevent the compiler from passing on the default include path to the
preprocessor.
- [—nostdlib] This will
prevent the compiler from passing on the default library
path to the linker.
- [—verbose] Shows the
various actions the compiler is performing.
- [-V] Shows the actual commands the compiler
is executing.
- [—no-c-code-in-asm] Hides
your ugly and inefficient c-code from the asm file, so you can always
blame the compiler :)
- [—no-peep-comments] Don't
include peep-hole comments in the generated asm files even if --fverbose-asm
option is specified.
- [—i-code-in-asm] Include
i-codes in the asm file. Sounds like noise but is helpful for debugging
the compiler itself.
- [—less-pedantic] Disable
some of the more pedantic warnings. For more details,
see the less_pedantic pragma ite:less_pedantic.
- [—disable-warning <nnnn>] Disable
specific warning with number <nnnn>.
- [—Werror] Treat all warnings
as errors.
- [—print-search-dirs] Display
the directories in the compiler's search path
- [—vc] Display errors and warnings
using MSVC style, so you can use SDCC with the visual studio IDE.
With SDCC both offering a GCC-like (the default) and a MSVC-like
output style, integration into most programming editors should be
straightforward.
- [—use-stdout] Send
errors and warnings to stdout instead of stderr.
- [-Wa asmOption[,asmOption]...] Pass
the asmOption to the assembler.
See file sdcc/sdas/doc/asmlnk.txt for assembler options.cd
- [—std-<arg>] Determine the language standard. For
enhanced compatibility with other compilers, —std can
also be used with a single dash (i.e. -std) and with =
or _ (whitespace) as delimiter. The language
standard, specified via <arg>, can be one of the following:
- [c89] Follow the
ANSI C89 / ISO C90 standard. Alternative spellings: c90,
iso9899:1990
- [c95] Follow
the ISO C90 standard as modified in amendment 1. Alternative spelling:
iso9899:199409
- [c99] Follow
the ISO C99 standard. Alternative spelling: iso9899:1999
- [c11] Follow
the ISO C11 standard. Alternative spelling: iso9899:2011
- [c17] Follow
the ISO C17 standard. Alternative spellings: iso9899:2017,
c18, iso9899:2018
- [c23] Follow
the ISO C23 standard. Alternative spelling: c2x
- [sdcc89]
Generally follow the ANSI C89 / ISO C90 standard, but allow some SDCC
behaviour that conflicts with the standard. Alternative spelling:
sdcc90
- [sdcc99]
Generally follow the ISO C99 standard, but allow some SDCC behaviour
that conflicts with the standard.
- [sdcc11]
Generally follow the ISO C11 standard, but allow some SDCC behaviour
that conflicts with the standard (default).
- [sdcc17]
Generally follow the ISO C17 standard, but allow some SDCC behaviour
that conflicts with the standard. Alternative spelling: sdcc18
- [sdcc23]
Generally follow the ISO C23 standard, but allow some SDCC behaviour
that conflicts with the standard. Alternative spelling: sdcc2x
- [—codeseg <Name>] The
name to be used for the code segment, default CSEG. This
is useful if you need to tell the compiler to put the code in a special
segment so you can later on tell the linker to put this segment in
a special place in memory. Can be used for instance when using bank
switching to put the code in a bank.
- [—constseg <Name>] The
name to be used for the const segment, default CONST.
This is useful if you need to tell the compiler to put the const data
in a special segment so you can later on tell the linker to put this
segment in a special place in memory. Can be used for instance when
using bank switching to put the const data in a bank.
- [—fdollars-in-identifiers] Permit
'$' as an identifier character.
- [—more-pedantic] Actually
this is not a SDCC compiler option but if you want
more warnings you can use a separate tool dedicated to syntax
checking like splint
http://www.splint.org. To make your source files parseable
by splint you will have to include lint.h
in your source file and add brackets around extended keywords (like
”__at (0xab)”
and ”__interrupt (2)”).
Splint has an excellent on line manual at http://www.splint.org/manual/and it's capabilities go beyond pure syntax checking. You'll need
to tell splint the location of SDCC's include files so a typical command
line could look like this:
splint -I /usr/local/share/sdcc/include/mcs51/ myprogram.c
- [—use-non-free] Search
/ include non-free licensed libraries and header files, located under
the non-free directory - see section 2.3