UNPKG

@nataliapc/mcp-openmsx

Version:

Model context protocol server for openMSX automation and control

566 lines (327 loc) 145 kB
# SDCC Compiler User Guide ## Using SDCC ### Standard-Compliance range none pageformat default Standard-compliance SDCC aims to be a conforming freestanding implementation of the C programming language. The latest publicly available version of the standard *ISO/IEC 9899 - Programming languages - C* should be available at: https://www.open-std.org/jtc1/sc22/wg14/www/projects#9899. #### ISO C90 and ANSI C89 Use --std-c90 range none pageformat default --std-c90** to compile in this mode. Deviations from standard compliance - initialization of structure arrays must be fully braced. ```c struct s { char x } a[] = {1, 2}; /* invalid in SDCC */ struct s { char x } a[] = {{1}, {2}}; /* OK */ ``` - float range none pageformat default Floating point support is substituted for (long) double range none pageformat default double (not supported) and a warning is emitted. - K&R style range none pageformat default K R style functions are syntactically supported, but with the semantics of ISO style functions. Features missing in some ports - pic14, pic16: structures range none pageformat default struct and unions range none pageformat default union cannot be passed as function parameters - hc08, s08, mos6502, pic14, pic16: they cannot be a return value range none pageformat default return value from a function, e.g.: ```c struct s {... }; **struct** s foo1 (**struct** s parms) /* unsupported in these SDCC ports */ { struct s rets; ... return rets; /* unsupported in these SDCC ports */ } ``` - mcs51, ds390, hc08, s08, pdk13, pdk14, pdk15 and mos6502 ports: functions are not reentrant unless explicitly declared as such or --** stack-auto** is specified. #### ISO C94 (aka ISO C95) Use --std-c94 range none pageformat default --std-c94** or --std-c95 range none pageformat default --std-c95** to compile in this mode. Implementation status Except for the issues mentioned in the section above, this standard is supported. #### ISO C99 Use --std-c99 range none pageformat default --std-c99** to compile in this mode. Deviations from standard compliance In addition to what is mentioned in the section above, the following features of this standard are not supported by SDCC: - Objects of variably-modified types. - ptrdiff_t has 16 bits, while the standard requires at least 17 bits. Features missing in some ports - pic14: there is no support for 64 bit integer types. #### ISO C11 and ISO C17 Use --std-c11 range none pageformat default --std-c11** to compile in this mode. Implementation status Except for the issues mentioned in the section above, this standard is supported. Note: Variably-modified types became optional in this version. #### ISO C23 Use --std-c23 range none pageformat default --std-c23** to compile in this mode. Deviations from standard compliance - initialization of structure arrays must be fully braced. ```c struct s { char x } a[] = {1, 2}; /* invalid in SDCC */ struct s { char x } a[] = {{1}, {2}}; /* OK */ ``` - float range none pageformat default Floating point support is substituted for (long) double range none pageformat default double (not supported) and a warning is emitted. - Support for attributes is slightly incomplete. - Checked integer arithmetic is not supported for (unsigned) long long. - Qualifier-preserving standard library functions are not implemented. - constexpr is not implemented. Features missing in some ports - pic14, pic16: structures range none pageformat default struct and unions range none pageformat default union cannot be passed as function parameters - hc08, s08, mos6502, pic14, pic16: they cannot be a return value range none pageformat default return value from a function, e.g.: struct s {... }; **struct** s foo1 (**struct** s parms) /* unsupported in these SDCC ports */ { struct s rets; ... return rets; /* unsupported in these SDCC ports */ } - mcs51, ds390, hc08, s08, pdk13, pdk14, pdk15 and mos6502 ports: functions are not reentrant unless explicitly declared as such or --** stack-auto** is specified. - pic14: there is no support for 64 bit integer types. - pic14, pic16: _BitInt is not supported. #### ISO C2y preview Use --std-c2y range none pageformat default --std-c2y** to compile in this mode. Implementation status In anticipation of the upcoming version of the language standard, C2y, SDCC supports the following prospective features: - LatexCommand href name "N3260" target "https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3260.pdf" literal "false": _Generic selection expression with a type operand - LatexCommand href name "N3353" target "https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3353.htm" literal "false": Obsolete Octal and Provide New, Proper Escape Sequences - LatexCommand href name "N3356" target "https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3356.htm" literal "false": if Declarations - LatexCommand href name "N3369" target "https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3369.pdf" literal "false": The _Lengthof Operator (Note: renamed to _Countof following LatexCommand href name "N3469" target "https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3469.htm" literal "false") - LatexCommand href name "N3370" target "https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3370.htm" literal "false": Case range expressions #### Embedded C SDCC supports objects in named address spaces and to some degree pointers to such objects. The support for fixed-point math in SDCC is inconsistent with the standard. Other parts of the standard are not supported. #### Implementation-defined behavior ##### Translation - Diagnostics are output to stderr, in the format <filename>:<line-number>: - Nonempty sequences of white-space are retained in translation phase 3. ##### Environment - See SDCC source (and your own code if you use a custom crt0 for a target that supports it) for any information on the environment. ##### Identifiers - See the compiler and assembler source for information on characters that may appear in identifiers and on the number of significant initial characters. ##### Characters - There are 8 bits in a byte. - Values of members of the execution character set: TODO. - Values of members of the execution character set for escape sequences: TODO. - Value of char with something weird stored in it: TODO. - unsigned char has the same range, representation and behavior as" plain" char (unless - -fsigned-char **range none pageformat default --fsigned-char** is used). - See the SDCC source for further information on character sets. ##### Integers - There are no extended integer types. ##### Floating point - See the implementation (soft float library) for any information on floating point. ##### Arrays and Pointers - For the result of converting between pointers and integers see the SDCC source code. - For the size of the result of subtracting two pointers to elements of the same array see the SDCC source code. ##### Hints - The extend to which suggestions made by register are effective depends on the target. - SDCC will inline functions if and only if they are declared using inline and do not have variable arguments. ##### Structures, unions, enumerations and bit-fields - A plain int bit-field is treated as an unsigned int bit-field. - There are no allowed bit-field types other than _Bool, int, signed int, unsigned int and the bit-precise integer types. - Atomic types are not permitted for bit-fields. - If a bit-fields does not fit into the same byte as the previous bit-fields, it starts on the next byte. - bit-fields are allocated in the same order as they appear in the source. - Non-bit-field members of structures are aligned on byte boundaries (i.e. there are no padding bytes). - For enumerations, the compatible type is the first from the following list that fits the constants: bool, unsigned char, signed char, unsigned int, signed int, unsigned long int, signed long int, unsigned long long int, signed long long int. ##### Qualifiers - SDCC shall preserve all volatile reads and writes, but does not guarantee them to be atomic (except for atomic types and volatile sig_atomic_t). ##### Preprocessing directives - See the preprocessor source for information on preprocessing directives. ##### Library functions - See the respective library headers for the library functions available. - See assert.h and library source for the format of the diagnostic printed by the assert macro. - There is no fegetexceptflag function. - There is no feraiseexcept function. - There is no setlocale function. - There is no FLT_EVAL_METHOD macro. - There is no DEC_EVAL_METHOD macro. - There are no non-required domain errors for mathematics functions. - See library source for the values returned by mathematical functions on domain error and pole error (and anything else on mathematical functions and floating type encodings). - See library headers for the null-pointer constant to which NULL expands. - See library headers and source for anything else about the library. ##### Architecture - See the respective library headers for the values or expressions for macros specified in float.h, limits.h, stdint.h. - Multithreading is not supported. - The number of bytes in any object is the minimum allowed (except for some padding bits on bit-fields), byte order depends on the target. - No extended alignments are supported. - There are no valid alignments other than those returned by _Alignof. - sizeof always returns the smallest value allowed assuming an 8-bit char. _Alignof always returns 0. ### Compiling #### Single Source File Projects For single source file 8051 projects the process is very simple. Compile your programs with the following command **"sdcc sourcefile.c".** This will compile, assemble and link your source file. Output files are as follows: - sourcefile.asm range none pageformat default- Assembler source range none pageformat default Assembler source file created by the compiler - sourcefile.lst range none pageformat default- Assembler listing range none pageformat default Assembler listing file created by the Assembler - sourcefile.rst range none pageformat default- Assembler listing range none pageformat default Assembler listing file updated with linkedit information, created by linkage editor - sourcefile.sym range none pageformat default- symbol listing range none pageformat default Symbol listing for the sourcefile, created by the assembler - sourcefile.rel range none pageformat default- Object file range none pageformat default Object file created by the assembler, input to Linkage editor - sourcefile.map range none pageformat default- The memory map range none pageformat default Memory map for the load module, created by the Linker - sourcefile.mem range none pageformat default- A file with a summary of the memory usage - sourcefile.ihx range none pageformat default- The load module in Intel hex format range none pageformat default Intel hex format (you can select the Motorola S19 format range none pageformat default Motorola S19 format with --out-fmt-s19 range none pageformat default --out-fmt-s19. If you need another format you might want to use *objdump* range none pageformat default objdump (tool) or *srecord* range none pageformat default srecord (bin, hex,... tool) hyperlinks needed- see also section Postprocessing the Intel Hex). Both formats are documented in the documentation of srecord range none pageformat default srecord (bin, hex,... tool) - sourcefile.adb range none pageformat default- An intermediate file containing debug information needed to create the.cdb file (with --debug range none pageformat default --debug) - sourcefile.cdb range none pageformat default- An optional file (with --debug) containing debug information. The format is documented in cdbfileformat.pdf - sourcefile.omf range none pageformat default- An optional AOMF or AOMF51 range none pageformat default AOMF, AOMF51 file containing debug information (generated with option --debug). The (Intel) *a* bsolute *o* bject *m* odule *f* ormat is a subformat of the OMF51 format and is commonly used by third party tools (debuggers range none pageformat default Debugger, simulators, emulators). - sourcefile.dump*range none pageformat default- Dump file to debug the compiler it self (generated with option --dumpall) (see section Intermediate Dump Options and section The anatomy of the compiler" Anatomy of the compiler"). #### Postprocessing the Intel Hex range none pageformat default Intel hex format file In most cases this won't be needed but the Intel Hex file range none pageformat default which is generated by SDCC might include lines of varying length and the addresses within the file are not guaranteed to be strictly ascending. If your toolchain or a bootloader does not like this you can use the tool packihx range none pageformat default packihx (tool) which is part of the SDCC distribution: **packihx sourcefile.ihx >sourcefile.hex** The separately available *srecord* range none pageformat default srecord (bin, hex,... tool) package additionally allows to set undefined locations to a predefined value, to insert checksums range none pageformat default checksum of various flavours (crc, add, xor) and to perform other manipulations (convert, split, crop, offset,...). **srec_cat sourcefile.ihx -intel-o sourcefile.hex -intel ** An example for a more complex command line the command backfills range none pageformat default backfill unused memory unused memory with 0x12 and the overall 16 bit sum of the complete 64 kByte block is zero. If the program counter on an mcs51 runs wild the backfill pattern 0x12 will be interpreted as an lcall to address 0x1212 (where an emergency routine could sit). could look like: **srec_cat sourcefile.ihx -intel-fill 0x12 0x0000 0xfffe-little-endian-checksum-negative 0xfffe 0x02 0x02-o sourcefile.hex -intel ** The srecord package is available at http://sourceforge.net/projects/srecord/. #### Projects with Multiple Source Files SDCC can compile only ONE file at a time. Let us for example assume that you have a project containing the following files: foo1.c (contains some functions) foo2.c (contains some more functions) foomain.c (contains more functions and the function main) The first two files will need to be compiled separately with the commands: **sdcc-c foo1.c** **sdcc-c foo2.c** Then compile the source file containing the *main()* function and link range none pageformat default Linker the files together with the following command: **sdcc foomain.c foo1.rel foo2.rel** range none pageformat default Note that in this case, the source file being compiled is always linked in first, regardless of its position in the command line. This can be problematic when a custom CRT is supplied as object file. As an alternative to the above, *foomain.c* can be compiled separately, and the resulting object file can then be linked with the other object files using a separate command: ** `sdcc-c foomain.c` `sdcc foomain.rel foo1.rel foo2.rel` ** The file containing the *main()* function must be the first file specified in the command line, since the linkage editor processes object files in the order they are presented to it. The linker is invoked from SDCC using a script file with extension.lnk range none pageformat default. You can view this file to troubleshoot linking problems such as those arising from missing libraries. #### Projects with Additional Libraries range none pageformat default Libraries Some reusable routines may be compiled into a library, see the documentation for the assembler and linkage editor (which are in <installdir>/share/sdcc/doc) for how to create a *.lib range none pageformat default* library file. Section Using sdar to Create and Manage Libraries below contains a minimal example. Libraries created in this manner can be included in the command line. Make sure you include the -L <library-path> option to tell the linker where to look for these files if they are not in the current directory. Here is an example, assuming you have the source file *foomain.c* and a library *foolib.lib* in the directory *mylib* (if that is not the same as your current project): **sdcc foomain.c foolib.lib -L mylib ** Note here that *mylib* must be an absolute path name. The most efficient way to use libraries is to keep separate modules in separate source files. The lib file now should name all the modules.rel range none pageformat default files. For an example see the standard library file *libsdcc.lib* in the directory <installdir>/share/lib/small. #### Using sdar to Create and Manage Libraries range none pageformat default sdar Support for sdar format libraries was introduced in SDCC 2.9.0. ** ** Both the GNU and BSD ar format variants are supported by sdld linkers. ** ** To create a library containing sdas object files, you should use the following sequence: ** **sdar -rc <library name>.lib <list of.rel files> ### Command Line Options range none pageformat default Command Line Options #### Processor Selection Options range none pageformat default Options processor selection range none pageformat default Processor selection options **-mmcs51 range none pageformat default -mmcs51** Generate code for the Intel MCS51 range none pageformat default MCS51 family of processors. This is the default processor target. **-mds390 range none pageformat default -mds390** Generate code for the Dallas DS80C390 range none pageformat default DS80C390 processor. **-mds400 range none pageformat default -mds400** Generate code for the Dallas DS80C400 range none pageformat default DS80C400 processor. **-mhc08 range none pageformat default -mhc08** Generate code for the Freescale/Motorola HC08 (aka 68HC08) range none pageformat default HC08 family of processors. **-ms08 range none pageformat default -ms08** Generate code for the Freescale/Motorola S08 (aka 68HCS08, HCS08, CS08) range none pageformat default S08 family of processors. **-mz80 range none pageformat default -mz80** Generate code for the Zilog Z80 range none pageformat default Z80 family of processors. **-mz180 range none pageformat default -mz180** Generate code for the Zilog Z180 range none pageformat default Z180 family of processors. **-mr2k range none pageformat default -mr2k** Generate code for the Rabbit 2000 / Rabbit 3000 family of processors. **-mr3ka range none pageformat default -mr3ka** Generate code for the Rabbit 3000A family of processors. **-msm83 range none pageformat default -msm83** Generate code for the Sharp SM83 range none pageformat default sm83 (GameBoy Z80) processor. **-mtlcs90 range none pageformat default -mtlcs90** Generate code for the Toshiba TLCS-90 processor. **-mez80_z80 range none pageformat default -mez80_z80** Generate code for the Zilog eZ80 processor in Z80 mode. **-mstm8 range none pageformat default -mstm8** Generate code for the STMicroelectronics STM8 family of processors. **-mpdk13 range none pageformat default -mpdk13** Generate code for Padauk processors with 13 bit wide program memory. **-mpdk14 range none pageformat default -mpdk14** Generate code for Padauk processors with 14 bit wide program memory. **-mpdk15 range none pageformat default -mpdk15** Generate code for Padauk processors with 15 bit wide program memory. **-mpic14 range none pageformat default -mpic14** Generate code for the Microchip PIC 14 range none pageformat default PIC14-bit processors (p16f84 and variants. In development, not complete). p16f627 p16f628 p16f84 p16f873 p16f877? **-mpic16 range none pageformat default -mpic16** Generate code for the Microchip PIC 16 range none pageformat default PIC16-bit processors (p18f452 and variants. In development, not complete). **-mmos6502 range none pageformat default -mmos6502** Generate code for the original MOS Technology NMOS 6502 processor and compatible derivatives including the 6510 and 8502. **-mmos65c02 range none pageformat default -mmos65c02** Generate code for the CMOS Rockwell/WDC 65C02. SDCC inspects the program name it was called with so the processor family can also be selected by renaming the sdcc binary (to f.e. z80-sdcc) or by calling SDCC from a suitable link. Option -m has higher priority than setting from program name. #### Preprocessor Options range none pageformat default Options preprocessor range none pageformat default Preprocessor!Options range none pageformat default sdcpp (preprocessor) SDCC uses *sdcpp*, an adapted version of the GNU Compiler Collection range none pageformat default gcc (GNU Compiler Collection) preprocessor *cpp* range none pageformat default cpp|see sdcpp (*gcc* http://gcc.gnu.org/). If you need more dedicated options than those listed below please refer to the GCC CPP Manual at http://www.gnu.org/software/gcc/onlinedocs/. **-I<path> range none pageformat default -I<path>** The additional location where the preprocessor will look for <..h> or“..h” files. **-D<macro[=value]> range none pageformat default -D<macro[=value]>** Command line definition of macros. Passed to the preprocessor. **-M range none pageformat default -M** Tell the preprocessor to output a rule suitable for make describing the dependencies of each object file. For each source file, the preprocessor outputs one make-rule whose target is the object file name for that source file and whose dependencies are all the files `#include'd in it. This rule may be a single line or may be continued with `\ '-newline if it is long. The list of rules is printed on standard output instead of the preprocessed C program. `-M' implies `-E range none pageformat default -E '. **-C range none pageformat default -C** Tell the preprocessor not to discard comments. Used with the `-E' option. **-MM range none pageformat default -MM** Like `-M' but the output mentions only the user header files included with `#include“ file"'. System header files included with `#include <file>' are omitted. **-Aquestion(answer) range none pageformat default -Aquestion(answer)** Assert the answer answer for question, in case it is tested with a preprocessor conditional such as `#if #question(answer)'. `-A-' disables the standard assertions that normally describe the target machine. **-Umacro range none pageformat default -Umacro** Undefine macro macro. `-U' options are evaluated after all `-D' options, but before any `-include' and `-imacros' options. **-dM range none pageformat default -dM** Tell the preprocessor to output only a list of the macro definitions that are in effect at the end of preprocessing. Used with the `-E' option. **-dD range none pageformat default -dD** Tell the preprocessor to pass all macro definitions into the output, in their proper sequence in the rest of the output. **-dN range none pageformat default -dN** Like `-dD' except that the macro arguments and contents are omitted. Only `#define name' is included in the output. **-Wp preprocessorOption[,preprocessorOption]** range none pageformat default -Wp preprocessorOption[,preprocessorOption]... Pass the preprocessorOption to the preprocessor sdcpp range none pageformat default sdcpp (preprocessor). #### Optimization Options range none pageformat default Options optimization range none pageformat default Optimization options **--nogcse range none pageformat default --nogcse** Will not do global common subexpression elimination, this option may be used when the compiler creates undesirably large stack/data spaces to store compiler temporaries (*s* pill *loc* ations, sloc range none pageformat default sloc (spill location)). A warning message will be generated when this happens and the compiler will indicate the number of extra bytes it allocated. It is recommended that this option NOT be used, #pragma nogcse range none pageformat default pragma nogcse can be used to turn off global subexpression elimination range none pageformat default Subexpression elimination for a given function only. **--noinvariant range none pageformat default --noinvariant** Will not do loop invariant optimizations, this may be turned off for reasons explained for the previous option. For more details of loop optimizations performed see Loop Invariants in section Loop Optimizations. It is recommended that this option NOT be used, #pragma noinvariant range none pageformat default pragma noinvariant can be used to turn off invariant optimizations for a given function only. **--noinduction range none pageformat default --noinduction** Will not do loop induction optimizations, see section strength reduction for more details. It is recommended that this option is NOT used, #pragma noinduction range none pageformat default pragma noinduction can be used to turn off induction optimizations for a given function only. **--noloopreverse range none pageformat default --noloopreverse** Will not do loop reversal range none pageformat default Loop reversing optimization. -- **nolabelopt** range none pageformat default --nolabelopt Will not optimize labels (makes the dumpfiles more readable). **--no-xinit-opt range none pageformat default --no-xinit-opt** Will not memcpy initialized data from code space into xdata space. This saves a few bytes in code space if you don't have initialized data range none pageformat default Variable initialization. **--nooverlay range none pageformat default --nooverlay** The compiler will not overlay parameters and local variables of any function, see section Parameters and local variables for more details. **--no-peep range none pageformat default --no-peep** Disable peep-hole optimization with built-in rules. **--peep-file** range none pageformat default --peep-file See section Peephole Optimizer Peep Hole optimizations for details on how to write these rules. **--peep-asm range none pageformat default --peep-asm** Pass the inline assembler code through the peep hole optimizer. This can cause unexpected changes to inline assembler code, please go through the peephole optimizer range none pageformat default Peephole optimizer rules defined in the source file tree '<target>/peeph.def' before using this option. **--peep-return range none pageformat default --peep-return** Let the peep hole optimizer do return optimizations. This is the default without **--** debug **range none pageformat default --debug**. **--no-peep-return range none pageformat default --no-peep-return** Do not let the peep hole optimizer do return optimizations. This is the default with **--** debug **range none pageformat default --debug**. **--opt-code-speed range none pageformat default --opt-code-speed** The compiler will optimize code generation towards fast code, possibly at the expense of code size. **--opt-code-size range none pageformat default --opt-code-size** The compiler will optimize code generation towards compact code, possibly at the expense of code speed. -- **fomit-frame-pointer** range none pageformat default --fomit-frame-pointer Frame pointer will be omitted when the function uses no local variables. On the z80-related ports this option will result in the frame pointer always being omitted. -- **max-allocs-per-node** range none pageformat default --max-allocs-per-node Setting this to a high value will result in increased compilation time (and increased memory use during compilation) and more optimized code being generated. Setting it to lower values speeds up compilation, but does not optimize as much. The default value is 3000. This option currently does not affect the mcs51, ds390, pic14 and pic16 ports. -- **nolospre** range none pageformat default --nolospre Disable lospre. lospre is an advanced redundancy elimination technique, essentially an improved variant of global subexpression elimination. -- **allow-unsafe-read** range none pageformat default --allow-unsafe-read Allow optimizations to generate unsafe reads. This will enable additional optimizations, but can result in spurious reads from undefined memory addresses, which can be harmful if the target system uses certain ways of doing memory-mapped I/O. -- **nostdlibcall** range none pageformat default --nostdlibcall Disable the optimization of calls to the standard library. #### Other Options range none pageformat default Options other **-v--version range none pageformat default --version range none pageformat default -v** displays the sdcc version. **-c--compile-only range none pageformat default --compile-only range none pageformat default -c** will compile and assemble the source, but will not call the linkage editor. **--c1mode range none pageformat default --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 range none pageformat default -E** Run only the C preprocessor range none pageformat default Preprocessor. Preprocess all the C source files specified and output the results to standard output. **--syntax-only range none pageformat default --syntax-only** Parse and verify syntax only, no output files are produced. **-o range none pageformat default -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 range none pageformat default -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 range none pageformat default --stack-auto** All functions in the source file will be compiled as *reentrant* range none pageformat default reentrant, i.e. the parameters and local variables will be allocated on the stack range none pageformat default stack. See section Parameters 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 range none pageformat default --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 **range none pageformat default function prologue** and epilogue **range none pageformat default function 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 range none pageformat default pragma callee saves Pragmas. **--all-callee-saves range none pageformat default --all-callee-saves** Function of --callee-saves will be applied to all functions by default. **--debug range none pageformat 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 range none pageformat default AOMF, 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 range none pageformat default -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 range none pageformat default --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 range none pageformat default --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 range none pageformat default Cyclomatic complexity* see section on Cyclomatic Complexity for more details. **--float-reent range none pageformat default --float-reent** Floating point library is compiled as reentrant range none pageformat default reentrant. See section Installation for more details. **--fsigned-char range none pageformat default --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 range none pageformat default --nostdinc** This will prevent the compiler from passing on the default include path to the preprocessor. **--nostdlib range none pageformat default --nostdlib** This will prevent the compiler from passing on the default library range none pageformat default Libraries path to the linker. **--verbose range none pageformat default --verbose** Shows the various actions the compiler is performing. **-V range none pageformat default -V** Shows the actual commands the compiler is executing. **--no-c-code-in-asm range none pageformat default --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 range none pageformat default --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 range none pageformat default --i-code-in-asm** Include i-codes in the asm file. Sounds like noise but is helpful for debugging the compiler itself. **--less-pedantic range none pageformat default pedantic range none pageformat default --less-pedantic** Disable some of the more pedantic warnings range none pageformat default Warnings. For more details, see the less_pedantic pragma Pragmas. **--disable-warning range none pageformat default --disable-warning** Disable specific warning with number <nnnn>. **--Werror range none pageformat default --Werror** Treat all warnings as errors. **--print-search-dirs range none pageformat default --print-search-dirs** Display the directories in the compiler's search path **--vc range none pageformat default --vc** Display errors and warnings using MSVC style, so you can use SDCC with the visual studio IDE range none pageformat default IDE. With SDCC both offering a GCC-like (the default) and a MSVC-like range none pageformat default MSVC output style output style, integration into most programming editors should be straightforward. **--use-stdout range none pageformat default --use-stdout** Send errors and warnings to stdout instead of stderr. **-Wa asmOption[,asmOption]** range none pageformat default -Wa asmOption[,asmOption]... Pass the asmOption to the assembler range none pageformat default Options assembler range none pageformat default Assembler options. 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 , can be one of the following: **c90 range none pageformat default --std-c89** Follow the ISO/IEC 9899 First Edition standard (ANSI C89 / ISO C90). Alternative spellings: **c89**, **iso9899:1990 **c94 range none pageformat default --std-sdcc99** Follow the ISO/IEC 9899 First Edition standard as modified in amendment 1. Alternative spelling: **c95, iso9899:199409 **c99 range none pageformat default --std-sdcc99** Follow the ISO/IEC 9899 Second Edition standard (ISO C99). Alternative spelling: **iso9899:1999 **c11 range none pageformat default --std-sdcc11** Follow the ISO/IEC 9899 Third Edition standard (ISO C11). Alternative spelling: **iso9899:2011 **c17 range none pageformat default --std-sdcc17** Follow the ISO/IEC 9899 Fourth Edition standard (ISO C17). Alternative spellings: **iso9899:2017**, **c18**, **iso9899:2018 **c23 range none pageformat default --std-sdcc23** Follow the ISO/IEC 9899 Fifth Edition standard (ISO C23). Alternative spelling: **c2x **c2y range none pageformat default --std-sdcc2y** Enable features anticipated for the Sixth Edition standard (currently abbreviated ISO C2y). **sdcc90 range none pageformat default --std-sdcc89** Generally follow ANSI C89 / ISO C90, but allow some SDCC behaviour that conflicts with the standard. Alternative spelling: **sdcc89 **sdcc99 range none pageformat default --std-sdcc99** Generally follow ISO C99, but allow some SDCC behaviour that conflicts with the standard. **sdcc11 range none pageformat default --std-sdcc11** Generally follow ISO C11, but allow some SDCC behaviour that conflicts with the standard (default). **sdcc17 range none pageformat default --std-sdcc17** Generally follow ISO C17, but allow some SDCC behaviour that conflicts with the standard. Alternative spelling: **sdcc18 **sdcc23 range none pageformat default --std-sdcc23** Generally follow ISO C23, but allow some SDCC behaviour that conflicts with the standard. Alternative spelling: **sdcc2x **sdcc2y range none pageformat default --std-sdcc2y** Generally follow ISO C2y, but allow some SDCC behaviour that conflicts with the standard. **--codeseg** range none pageformat default --codeseg <Value> range none pageformat default 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** range none pageformat default --constseg <Value> range none pageformat default 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 range none pageformat default --fdollars-in-identifiers** Permit '$' as an identifier character. **--more-pedantic** range none pageformat default --more-pedantic range none pageformat default 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 range none pageformat default lint (syntax checking tool) http://www.splint.org. To make your source files parseable by splint you will have to include lint.h range none pageformat default splint (syntax checking tool) 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** range none pageformat default --use-non-free Search / include non-free licensed libraries and header files, located under the non-free directory - see section Search Paths #### Linker Options range none pageformat default Options linker range none pageformat default Linker options **--lib-path range none pageformat default --lib-path <path>** range none pageformat default Libraries search path. The path name must be absolute. Additional library files may be specified in the command line. See section Compiling programs for more details. **-L range none pageformat default -L <path>** **--xram-loc** range none pageformat default --xram-loc <Value> range none pageformat default xdata (mcs51, ds390 named address space), default value is 0. The value entered can be in Hexadecimal or Decimal format, e.g.:--xram-loc 0x8000 or --xram-loc 32768. **--code-loc** range none pageformat default --code-loc <Value> range none pageformat default code segment, default value 0. Note when this option is used the interrupt vector table range none pageformat default interrupt vector table is also relocated to the given address. The value entered can be in Hexadecimal or Decimal format, e.g.:--code-loc 0x8000 or --code-loc 32768. **--stack-loc** range none pageformat default --stack-loc <Value> e.g.--stack-loc 0x20 or --stack-loc 32. For stm8, by default the stack is placed at the device-specific reset value. By using this option, the stack can be placed anywhere in the lower 16-bits of the stm8 memory space. This is particularly useful for working around the stack roll-over antifeature present in some stm8 devices. **--xstack-loc** range none pageformat default --xstack-loc <Value> range none pageformat default xstack is placed after the __pdata range none pageformat default pdata (mcs51, ds390 named address space) segment. Using this option the xstack can be placed anywhere in the external memory space of the 8051. The value entered can be in Hexadecimal or Decimal format, e.g.--xstack-loc 0x8000 or --xstack-loc 32768. The provided value should not overlap any other memory areas such as the pdata or xdata segment and with enough space for the current application. **--data-loc** range none pageformat default --data-loc <Value> range none pageformat default data (mcs51, ds390 named address space) segment. The value entered can be in Hexadecimal or Decimal format, eg.--data-loc 0x20 or --data-loc 32. (By default, the start location of the internal ram data segment is set as low as possible in memory, taking into account the used register banks and the bit segment at address 0x20. For example if register banks 0 and 1 are used without bit variables, the data segment will be set, if --data-loc is not used, to location 0x10.) **--idata-loc** range none pageformat default --idata-loc <Value> range none pageformat default idata (mcs51, ds390 named address space) of the 8051, default value is 0x80. The value entered can be in Hexadecimal or Decimal format, eg.--idata-loc 0x88 or --idata-loc 136. **--bit-loc** range none pageformat default bit addressable internal ram of the 8051. This is *not* implemented yet. Instead an option can be passed directly to the linker:-Wl-bBSEG=<Value>. **--out-fmt-ihx range none pageformat default --out-fmt-ihx** The linker output (final object code) is in Intel Hex format. range none pageformat default Intel hex format This is the default option. The format itself is documented in the documentation of srecord range none pageformat default srecord (bin, hex,... tool). **--out-fmt-s19 range none pageformat default --out-fmt-s19** The linker output (final object code) is in Motorola S19 format range none pageformat default Motorola S19 format. The format itself is documented in the documentation of srecord. **--out-fmt-elf range none pageformat default --out-fmt-s19 range none pageformat default HC08!Options!--out-fmt-elf** The linker output (final object code) is in ELF format range none pageformat default ELF format. (Currently only supported for the HC08 range none pageformat default HC08, S08 and STM8 processors). When used with --debug, the debug info is in DWARF format instead of CDB. **-Wl linkOption[,linkOption]** range none pageformat default -Wl linkOption[,linkOption]... Pass the linkOption to the linker. If a bootloader is used an option like"-Wl-bCSEG=0x1000" would be typical to set the start of the code segment. Either use the double quotes around this option or use no space (e.g.-Wl-bCSEG=0x1000). See also #pragma constseg and #pragma codeseg in section Pragmas. File sdcc/sdas/doc/asmlnk.txt has more on linker options. #### MCS51 Options range none pageformat default Options MCS51 range none pageformat default MCS51 options **--model-small range none pageformat default --model-small** Generate code for Small model programs, see section Memory Models for more details. This is the default model. **--model-medium range none pageformat default --model-medium** Generate code for Medium model programs, see section Memory Models for more details. If this option is used all source files in the project have to be compiled with this option. It must also be used when invoking the linker. **--model-large range none pageformat default --model-large** Generate code for Large model programs, see section Memory Models for more details. If this option is used all source files in the project have to be compiled with this option. It must also be used when invoking the linker. **--model-huge range none pageformat default --model-huge** Generate code for Huge model programs, see section Memory Models for more details. If this option is used all source files in the project have to be compiled with this option. It must also be used when invoking the linker. **--xstack range none pageformat default --xstack** Uses a pseudo stack in the __pdata range none pageformat default pdata (mcs51, ds390 named address space) area (usually the first 256 bytes in the external ram) for allocating variables and passing parameters. See section External Stack External Stack for more details. **--iram-size** range none pageformat default --iram-size <Value> Causes the linker to check if the internal ram usage is within limits of the given value. **--xram-size** range none pageformat default --xram-size <Value> Causes the linker to check if the external ram usage is within limits of the given value. **--code-size** range none pageformat default --code-size <Value> Causes the linker to check if the code memory usage is within limits of the given value. **--stack-size** range none pageformat default --stack-size <Value> Causes the linker to check if there is at minimum <Value> bytes for stack. **--acall-ajmp** range none pageformat default --acall-ajmp Replaces the three byte instructions lcall/ljmp with the two byte instructions acall/ajmp. Only use this option if your code is in the same 2k block of memory. You may need to use this option for some 8051 derivatives which lack the lcall/ljmp instructions. **--no-ret-without-call** range none pageformat default --no-ret-without-call Causes the code generator to insert an extra lcall or acall instruction whenever it needs to use a ret instruction in a context other than a function returning. This option is needed when using the Infineon range none pageformat default Infineon XC800 series microcontrollers to keep its Memory Extension Stack balanced. #### DS390 / DS400 Options range none pageformat default Options DS390 range none pageformat default DS390 **--model-flat24** range none pageformat default DS390!Options!--model-flat24 Generate 24-bit flat mode code. This is the one and only that the ds390 code generator supports right now and is default when using *-mds390*. See section Memory Models for more details. **--protect-sp-update range none pageformat default DS390!Options!--protect-sp-update** disable interrupts during ESP:SP updates. **--stack-8-bit - switches off the 10-bit mode **--stack-10bit** range none pageformat default DS390!Options!--stack-10bit Generate code for the 10 bit stack mode of the Dallas DS80C390 part. This is the one and only that the ds390 code generator supports right now and is default when using *-mds390*. In this mode, the stack is located in the lower 1K of the internal RAM, which is mapped to 0x400000. Note that the support is incomplete, since it still uses a single byte as the stack pointer. This means that only the lower 256 bytes of the potential 1K stack space will actually be used. However, this does allow you to reclaim the precious 256 bytes of low RAM for use for the DATA and IDATA segments. The compiler will not generate any code to put the processor into 10 bit stack mode. It is important to ensure that the processor is in this mode before calling any re-entrant functions compiled with this option. In principle, this should work with the *--stack-auto range none pageformat default --stack-auto* option, but that has not been tested. It is incompatible with the *--xstack range none pageformat default --xstack* option. It also only makes sense if the processor is in 24 bit contiguous addressing mode (see the *--model-flat24 option*). ** **--stack-probe range none pageformat default DS390!Options!--stack-probe** insert call to function __stack_probe at each function prologue. **--tini-libid range none pageformat default DS390!Options!--tini-libid** **--use-accelerator range none pageformat default DS390!Options!-