\layout Comment
Please note: double dashed longoptions (e.g.
- --version) need three dashes in this document to be visable in html and
- pdf output.
+ --version) are written this way: -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-
+\layout Comment
+
+Two resp.
+ three consecutive dashes simply result in a long resp.
+ extra long dash.
\layout Title
SDCC Compiler User Guide
\newline
\newline
-SDCC also provides an option (--cyclomatic) to report the relative complexity
- of a function.
+SDCC also provides an option (-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-cyclomatic) to report the relative complexity of a function.
These functions can then be further optimized, or hand coded in assembly
if needed.
will push a as an int and as a char resp.
\layout Itemize
-option ---regextend has been removed
+option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-regextend has been removed
\layout Itemize
-option ---noregparms has been removed
+option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noregparms has been removed
\layout Itemize
-option ---stack-after-data has been removed
+option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-after-data has been removed
\layout Standard
\layout List
\labelwidthstring 00.00.0000
----prefix see tabel below
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-prefix see tabel below
\layout List
\labelwidthstring 00.00.0000
----exec_prefix see tabel below
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-exec_prefix see tabel below
\layout List
\labelwidthstring 00.00.0000
----bindir see tabel below
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-bindir see tabel below
\layout List
\labelwidthstring 00.00.0000
----datadir see tabel below
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-datadir see tabel below
\layout List
\labelwidthstring 00.00.0000
\layout List
\labelwidthstring 00.00.0000
----disable-mcs51-port Excludes the Intel mcs51 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-mcs51-port Excludes the Intel mcs51 port
\layout List
\labelwidthstring 00.00.0000
----disable-gbz80-port Excludes the Gameboy gbz80 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-gbz80-port Excludes the Gameboy gbz80 port
\layout List
\labelwidthstring 00.00.0000
----disable-z80-port Excludes the z80 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-z80-port Excludes the z80 port
\layout List
\labelwidthstring 00.00.0000
----disable-avr-port Excludes the AVR port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-avr-port Excludes the AVR port
\layout List
\labelwidthstring 00.00.0000
----disable-ds390-port Excludes the DS390 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-ds390-port Excludes the DS390 port
\layout List
\labelwidthstring 00.00.0000
----disable-pic-port Excludes the PIC port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-pic-port Excludes the PIC port
\layout List
\labelwidthstring 00.00.0000
----disable-xa51-port Excludes the XA51 port
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-xa51-port Excludes the XA51 port
\layout List
\labelwidthstring 00.00.0000
----disable-ucsim Disables configuring and building of ucsim
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-ucsim Disables configuring and building of ucsim
\layout List
\labelwidthstring 00.00.0000
----disable-device-lib-build Disables automatically building device libraries
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-device-lib-build Disables automatically building device libraries
\layout List
\labelwidthstring 00.00.0000
----disable-packihx Disables building packihx
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-packihx Disables building packihx
\layout List
\labelwidthstring 00.00.0000
----enable-libgc Use the Bohem memory allocator.
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-enable-libgc Use the Bohem memory allocator.
Lower runtime footprint.
\layout Standard
Furthermore the environment variables CC, CFLAGS, ...
the tools and their arguments can be influenced.
- Please see `configure ---help` and the man/info pages of `configure` for
- details.
+ Please see `configure -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-help` and the man/info pages of `configure` for details.
\newline
\newline
./configure
\layout LyX-Code
-./configure ---prefix=
+./configure --prefix=
\begin_inset Quotes srd
\end_inset
\begin_inset Quotes srd
\end_inset
- ---datadir=
+ --datadir=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
-./configure ---disable-avr-port ---disable-xa51-port
+./configure --disable-avr-port --disable-xa51-port
\layout Standard
To crosscompile on linux for Mingw32 (see also 'sdcc/support/scripts/sdcc_mingw3
\layout LyX-Code
- ---prefix=
+ --prefix=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
- ---datadir=
+ --datadir=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
- ---disable-device-lib-build
+ --disable-device-lib-build
\backslash
\layout LyX-Code
- ---disable-ucsim
+ --disable-ucsim
\backslash
\layout LyX-Code
- ---host=i586-mingw32msvc ---build=unknown-unknown-linux-gnu
+ --host=i586-mingw32msvc --build=unknown-unknown-linux-gnu
\layout Standard
To
\layout LyX-Code
- ---prefix=
+ --prefix=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
- ---datadir=
+ --datadir=
\begin_inset Quotes srd
\end_inset
\layout LyX-Code
- ---disable-ucsim
+ --disable-ucsim
\layout Standard
'configure' is quite slow on Cygwin (at least on windows before Win2000/XP).
- The option '--C' turns on caching, which gives a little bit extra speed.
+ The option '-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-C' turns on caching, which gives a little bit extra speed.
However if options are changed, it can be necessary to delete the config.cache
file.
\layout Subsection
\layout Standard
----I dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-I dir
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\layout Standard
----I dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-I dir
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\layout Standard
----I dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-I dir
\end_inset
</cell>
</row>
\newline
\newline
- The option ---nostdinc disables the last two search paths.
+ The option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nostdinc disables the last two search paths.
\newline
\newline
\begin_inset Quotes sld
\end_inset
----L dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-L dir
\begin_inset Quotes srd
\end_inset
\layout Standard
----L dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-L dir
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\layout Standard
----L dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-L dir
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\layout Standard
----L dir
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-L dir
\end_inset
</cell>
</row>
\SpecialChar ~
\newline
-The option ---nostdlib disables the last two search paths.
+The option -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nostdlib disables the last two search paths.
\layout Subsection
Building SDCC
Type
\family sans
\series bold
-"sdcc ---version"
+"sdcc -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-version"
\begin_inset LatexCommand \index{version}
\end_inset
\end_inset
- with ---out-fmt-s19
-\begin_inset LatexCommand \index{---out-fmt-s19}
+ with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-out-fmt-s19
+\begin_inset LatexCommand \index{-\/-out-fmt-s19}
\end_inset
\end_inset
- An intermediate file containing debug information needed to create the
- .cdb file (with ---debug
-\begin_inset LatexCommand \index{---debug}
+ .cdb file (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug
+\begin_inset LatexCommand \index{-\/-debug}
\end_inset
\end_inset
- - An optional file (with ---debug) containing debug information
+ - An optional file (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug) containing debug information
\layout Itemize
sourcefile.
\end_inset
- An optional AOMF51 file containing debug information (with ---debug)
+ An optional AOMF51 file containing debug information (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug)
\layout Itemize
sourcefile.dump*
\end_inset
- - Dump file to debug the compiler it self (with ---dumpall) (see section
-
+ - Dump file to debug the compiler it self (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpall) (see section
\begin_inset Quotes sld
\end_inset
\series bold
-L\SpecialChar ~
----lib-path
-\begin_inset LatexCommand \index{---lib-path}
+-
+\series default
+
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+
+\series bold
+-lib-path
+\begin_inset LatexCommand \index{-\/-lib-path}
\end_inset
-\begin_inset LatexCommand \index{-L ---lib-path}
+\begin_inset LatexCommand \index{-L -\/-lib-path}
\end_inset
\series bold
----xram-loc
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xram-loc
\series default
-\begin_inset LatexCommand \index{---xram-loc}
+\begin_inset LatexCommand \index{-\/-xram-loc}
\end_inset
\end_inset
, default value is 0.
- The value entered can be in Hexadecimal or Decimal format, e.g.: ---xram-loc
- 0x8000 or ---xram-loc 32768.
+ The value entered can be in Hexadecimal or Decimal format, e.g.: -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xram-loc 0x8000 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xram-loc 32768.
\layout List
\labelwidthstring 00.00.0000
\series bold
----code-loc
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-code-loc
\series default
-\begin_inset LatexCommand \index{---code-loc}
+\begin_inset LatexCommand \index{-\/-code-loc}
\end_inset
segment, default value 0.
Note when this option is used the 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.
+ The value entered can be in Hexadecimal or Decimal format, e.g.: -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-code-loc 0x8000 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-code-loc 32768.
\layout List
\labelwidthstring 00.00.0000
\series bold
----stack-loc
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-loc
\series default
-\begin_inset LatexCommand \index{---stack-loc}
+\begin_inset LatexCommand \index{-\/-stack-loc}
\end_inset
Using this option the stack can be placed anywhere in the internal memory
space of the 8051.
The value entered can be in Hexadecimal or Decimal format, e.g.
- ---stack-loc 0x20 or ---stack-loc 32.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-loc 0x20 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-loc 32.
Since the sp register is incremented before a push or call, the initial
sp will be set to one byte prior the provided value.
The provided value should not overlap any other memory areas such as used
\series bold
----data-loc
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc
\series default
-\begin_inset LatexCommand \index{---data-loc}
+\begin_inset LatexCommand \index{-\/-data-loc}
\end_inset
segment.
The value entered can be in Hexadecimal or Decimal format, eg.
- ---data-loc 0x20 or ---data-loc 32.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc 0x20 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-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.)
+ data segment will be set, if -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc is not used, to location 0x10.)
\layout List
\labelwidthstring 00.00.0000
\series bold
----idata-loc
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-idata-loc
\series default
-\begin_inset LatexCommand \index{---idata-loc}
+\begin_inset LatexCommand \index{-\/-idata-loc}
\end_inset
, default value is 0x80.
The value entered can be in Hexadecimal or Decimal format, eg.
- ---idata-loc 0x88 or ---idata-loc 136.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-idata-loc 0x88 or -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-idata-loc 136.
\layout List
\labelwidthstring 00.00.0000
\series bold
----out-fmt-ihx
-\begin_inset LatexCommand \index{---out-fmt-ihx}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-out-fmt-ihx
+\begin_inset LatexCommand \index{-\/-out-fmt-ihx}
\end_inset
\series bold
----out-fmt-s19
-\begin_inset LatexCommand \index{---out-fmt-s19}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-out-fmt-s19
+\begin_inset LatexCommand \index{-\/-out-fmt-s19}
\end_inset
\series bold
----model-large
-\begin_inset LatexCommand \index{---model-large}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-large
+\begin_inset LatexCommand \index{-\/-model-large}
\end_inset
\series bold
----model-small
-\begin_inset LatexCommand \index{---model-small}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-small
+\begin_inset LatexCommand \index{-\/-model-small}
\end_inset
\series bold
----model-flat24
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-flat24
\series default
-\begin_inset LatexCommand \index{---model-flat24}
+\begin_inset LatexCommand \index{-\/-model-flat24}
\end_inset
\series bold
----stack-10bit
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-10bit
\series default
-\begin_inset LatexCommand \index{--stack-10bit}
+\begin_inset LatexCommand \index{-\/-stack-10bit}
\end_inset
any re-entrant functions compiled with this option.
In principle, this should work with the
\emph on
----stack-auto
-\begin_inset LatexCommand \index{---stack-auto}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
option, but that has not been tested.
It is incompatible with the
\emph on
----xstack
-\begin_inset LatexCommand \index{---xstack}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xstack
+\begin_inset LatexCommand \index{-\/-xstack}
\end_inset
It also only makes sense if the processor is in 24 bit contiguous addressing
mode (see the
\emph on
----model-flat24 option
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-flat24 option
\emph default
).
\layout Subsubsection
\series bold
----nogcse
-\begin_inset LatexCommand \index{---nogcse}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nogcse
+\begin_inset LatexCommand \index{-\/-nogcse}
\end_inset
\series bold
----noinvariant
-\begin_inset LatexCommand \index{---noinvariant}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noinvariant
+\begin_inset LatexCommand \index{-\/-noinvariant}
\end_inset
\series bold
----noinduction
-\begin_inset LatexCommand \index{---noinduction}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noinduction
+\begin_inset LatexCommand \index{-\/-noinduction}
\end_inset
\series bold
----nojtbound
-\begin_inset LatexCommand \index{---nojtbound}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nojtbound
+\begin_inset LatexCommand \index{-\/-nojtbound}
\end_inset
\series bold
----noloopreverse
-\begin_inset LatexCommand \index{---noloopreverse}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noloopreverse
+\begin_inset LatexCommand \index{-\/-noloopreverse}
\end_inset
\layout List
\labelwidthstring 00.00.0000
----
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-
\series bold
nolabelopt
\series default
-\begin_inset LatexCommand \index{---nolabelopt }
+\begin_inset LatexCommand \index{-\/-nolabelopt }
\end_inset
\series bold
----no-xinit-opt
-\begin_inset LatexCommand \index{---no-xinit-opt}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-no-xinit-opt
+\begin_inset LatexCommand \index{-\/-no-xinit-opt}
\end_inset
\series bold
-c\SpecialChar ~
----compile-only
-\begin_inset LatexCommand \index{---compile-only}
+-
+\begin_inset ERT
+status Collapsed
+\layout Standard
+
+\backslash
+/
\end_inset
+-compile-only
+\begin_inset LatexCommand \index{-\/-compile-only}
+
+\end_inset
-\begin_inset LatexCommand \index{-c ---compile-only}
+
+\begin_inset LatexCommand \index{-c -\/-compile-only}
\end_inset
\series bold
---c1mode
-\begin_inset LatexCommand \index{--c1mode}
+-
+\series default
+
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+
+\series bold
+-c1mode
+\begin_inset LatexCommand \index{-\/-c1mode}
\end_inset
\series bold
----stack-auto
-\begin_inset LatexCommand \index{---stack-auto}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
\series bold
----xstack
-\begin_inset LatexCommand \index{---xstack}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xstack
+\begin_inset LatexCommand \index{-\/-xstack}
\end_inset
\series bold
----callee-saves
-\begin_inset LatexCommand \index{---callee-saves}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-callee-saves
+\begin_inset LatexCommand \index{-\/-callee-saves}
\end_inset
reduce code & improve run time performance of the generated code.
In the future the compiler (with interprocedural 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 _muluint..., if this
+ 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.
+ should be compiled with the same -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-callee-saves option string.
Also see #pragma\SpecialChar ~
CALLEE-SAVES
\begin_inset LatexCommand \index{\#pragma CALLEE-SAVES}
\series bold
----debug
-\begin_inset LatexCommand \index{---debug}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug
+\begin_inset LatexCommand \index{-\/-debug}
\end_inset
\series bold
----peep-file
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-file
\series default
-\begin_inset LatexCommand \index{---peep-file}
+\begin_inset LatexCommand \index{-\/-peep-file}
\end_inset
\series bold
----int-long-reent
-\begin_inset LatexCommand \index{---int-long-reent}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-int-long-reent
+\begin_inset LatexCommand \index{-\/-int-long-reent}
\end_inset
\series bold
----cyclomatic
-\begin_inset LatexCommand \index{---cyclomatic}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-cyclomatic
+\begin_inset LatexCommand \index{-\/-cyclomatic}
\end_inset
\series bold
----float-reent
-\begin_inset LatexCommand \index{---float-reent}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-float-reent
+\begin_inset LatexCommand \index{-\/-float-reent}
\end_inset
\series bold
----nooverlay
-\begin_inset LatexCommand \index{---nooverlay}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nooverlay
+\begin_inset LatexCommand \index{-\/-nooverlay}
\end_inset
\series bold
----main-return
-\begin_inset LatexCommand \index{---main-return}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-main-return
+\begin_inset LatexCommand \index{-\/-main-return}
\end_inset
\series bold
----no-peep
-\begin_inset LatexCommand \index{---no-peep}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-no-peep
+\begin_inset LatexCommand \index{-\/-no-peep}
\end_inset
\series bold
----peep-asm
-\begin_inset LatexCommand \index{---peep-asm}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-asm
+\begin_inset LatexCommand \index{-\/-peep-asm}
\end_inset
\series bold
----iram-size
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-iram-size
\series default
<Value>
-\begin_inset LatexCommand \index{---iram-size<Value>}
+\begin_inset LatexCommand \index{-\/-iram-size<Value>}
\end_inset
\series bold
----xram-size
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xram-size
\series default
<Value>
-\begin_inset LatexCommand \index{---xram-size<Value>}
+\begin_inset LatexCommand \index{-\/-xram-size<Value>}
\end_inset
\series bold
----code-size
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-code-size
\series default
<Value>
-\begin_inset LatexCommand \index{---code-size<Value>}
+\begin_inset LatexCommand \index{-\/-code-size<Value>}
\end_inset
\series bold
----nostdincl
-\begin_inset LatexCommand \index{---nostdincl}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nostdincl
+\begin_inset LatexCommand \index{-\/-nostdincl}
\end_inset
\series bold
----nostdlib
-\begin_inset LatexCommand \index{---nostdlib}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-nostdlib
+\begin_inset LatexCommand \index{-\/-nostdlib}
\end_inset
\series bold
----verbose
-\begin_inset LatexCommand \index{---verbose}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-verbose
+\begin_inset LatexCommand \index{-\/-verbose}
\end_inset
\series bold
----no-c-code-in-asm
-\begin_inset LatexCommand \index{---no-c-code-in-asm}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-no-c-code-in-asm
+\begin_inset LatexCommand \index{-\/-no-c-code-in-asm}
\end_inset
\series bold
----i-code-in-asm
-\begin_inset LatexCommand \index{---i-code-in-asm}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-i-code-in-asm
+\begin_inset LatexCommand \index{-\/-i-code-in-asm}
\end_inset
\series bold
----less-pedantic
-\begin_inset LatexCommand \index{---less-pedantic}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-less-pedantic
+\begin_inset LatexCommand \index{-\/-less-pedantic}
\end_inset
\series bold
----print-search-dirs
-\begin_inset LatexCommand \index{---print-search-dirs}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-print-search-dirs
+\begin_inset LatexCommand \index{-\/-print-search-dirs}
\end_inset
\series bold
----dumpraw
-\begin_inset LatexCommand \index{---dumpraw}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpraw
+\begin_inset LatexCommand \index{-\/-dumpraw}
\end_inset
\series bold
----dumpgcse
-\begin_inset LatexCommand \index{---dumpgcse}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpgcse
+\begin_inset LatexCommand \index{-\/-dumpgcse}
\end_inset
\series bold
----dumpdeadcode
-\begin_inset LatexCommand \index{---dumpdeadcode}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpdeadcode
+\begin_inset LatexCommand \index{-\/-dumpdeadcode}
\end_inset
\series bold
----dumploop
-\begin_inset LatexCommand \index{---dumploop}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumploop
+\begin_inset LatexCommand \index{-\/-dumploop}
\end_inset
\series bold
----dumprange
-\begin_inset LatexCommand \index{---dumprange}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumprange
+\begin_inset LatexCommand \index{-\/-dumprange}
\end_inset
\series bold
----dumlrange
-\begin_inset LatexCommand \index{---dumlrange}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumlrange
+\begin_inset LatexCommand \index{-\/-dumlrange}
\end_inset
\series bold
----dumpregassign
-\begin_inset LatexCommand \index{---dumpregassign}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpregassign
+\begin_inset LatexCommand \index{-\/-dumpregassign}
\end_inset
\labelwidthstring 00.00.0000
-\series bold
----dumplrange
-\begin_inset LatexCommand \index{---dumplrange}
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumplrange
+\begin_inset LatexCommand \index{-\/-dumplrange}
\end_inset
\series bold
----dumpall
-\begin_inset LatexCommand \index{---dumpall}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpall
+\begin_inset LatexCommand \index{-\/-dumpall}
\end_inset
either by using the
\emph on
- ---stack-auto
-\begin_inset LatexCommand \index{--stack-auto}
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
\emph default
keyword or the
\emph on
- ---stack-auto
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
\emph default
option should be used sparingly.
Note that the reentrant keyword just means that the parameters & local
in internal ram.
When compiled with
\emph on
----stack-auto
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
\emph default
or when a function is declared as
\emph on
then the support routines (as mentioned in a following section) will have
to be recompiled using the
\emph on
- ---stack-auto
-\begin_inset LatexCommand \index{---stack-auto}
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
\emph default
option and the source file will need to be compiled using the
\emph on
----int-long-ren
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-int-long-ren
\emph default
t
-\begin_inset LatexCommand \index{---int-long-rent}
+\begin_inset LatexCommand \index{-\/-int-long-rent}
\end_inset
be placed in a separate line (as the example shows).
When the
\emph on
----peep-asm
-\begin_inset LatexCommand \index{--peep-asm}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-asm
+\begin_inset LatexCommand \index{-\/-peep-asm}
\end_inset
\newline
\newline
-_mulsint.c - signed 16 bit multiplication (calls _muluint)
-\newline
-_muluint.c - unsigned 16 bit multiplication
+_mulint.c - 16 bit multiplication
\newline
_divsint.c - signed 16 bit division (calls _divuint)
\newline
\newline
_moduint.c - unsigned 16 bit modulus
\newline
-_mulslong.c - signed 32 bit multiplication (calls _mululong)
-\newline
-_mululong.c - unsigned32 bit multiplication
+_mullong.c - 32 bit multiplication
\newline
_divslong.c - signed 32 division (calls _divulong)
\newline
If this is unavoidable then the above routines will need to be compiled
with the
\emph on
----stack-auto
-\begin_inset LatexCommand \index{---stack-auto}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
\emph default
option, after which the source program will have to be compiled with
\emph on
----int-long-rent
-\begin_inset LatexCommand \index{---int-long-rent}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-int-long-rent
+\begin_inset LatexCommand \index{-\/-int-long-rent}
\end_inset
\newline
Like the
\emph on
----model-large
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-large
\emph default
option, variables will by default be placed into the XDATA segment.
\newline
Segments may be placed anywhere in the 4 meg address space using the usual
- ---*-loc options.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-*-loc options.
Note that if any segments are located above 64K, the -r flag must be passed
to the linker to generate the proper segment relocations, and the Intel
HEX output format must be used.
- this symbol is defined when
\emph on
----stack-auto
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
\emph default
option is used.
\layout Itemize
- when
\emph on
----model-small
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-small
\emph default
is used.
\layout Itemize
- when
\emph on
----model-large
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-large
\emph default
is used.
\layout Itemize
- when
\emph on
----xstack
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xstack
\emph default
option is used.
\layout Itemize
The compiler will generate a warning message when it is forced to allocate
extra space either on the stack or data space.
If this extra space allocation is undesirable then induction optimization
- can be eliminated either for the entire source file (with ---noinduction
- option) or for a given function only using #pragma\SpecialChar ~
+ can be eliminated either for the entire source file (with -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-noinduction option) or for a given function only using #pragma\SpecialChar ~
NOINDUCTION
\begin_inset LatexCommand \index{\#pragma NOINDUCTION}
A default set of rules are compiled into the compiler, additional rules
may be added with the
\emph on
----peep-file
-\begin_inset LatexCommand \index{---peep-file}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-file
+\begin_inset LatexCommand \index{-\/-peep-file}
\end_inset
\newline
Other special case optimizations may be added by the user (via
\emph on
----peep-file option
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-file option
\emph default
).
E.g.
have some better means.
If you are looking at this file, you will also see the default rules that
are compiled into the compiler, you can add your own rules in the default
- set there if you get tired of specifying the ---peep-file option.
+ set there if you get tired of specifying the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-peep-file option.
\layout Subsection
Pragmas
reduce code & improve run time performance of the generated code.
In the future the compiler (with interprocedural analysis) may be able
to determine the appropriate scheme to use for each function call.
- If ---callee-saves command line option is used, the function names specified
+ If -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-callee-saves command line option is used, the function names specified
in #pragma\SpecialChar ~
CALLEE-SAVES
\begin_inset LatexCommand \index{\#pragma CALLEE-SAVES}
\emph default
to pass the first parameter to a routine.
The second parameter onwards is either allocated on the stack (for reentrant
- routines or if ---stack-auto is used) or in the internal / external ram
- (depending on the memory model).
+ routines or if -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto is used) or in the internal / external ram (depending on the
+ memory model).
\layout Subsubsection
The external stack is located at the start of the external ram segment,
and is 256 bytes in size.
- When ---xstack option is used to compile the program, the parameters and
- local variables of all reentrant functions are allocated in this area.
+ When -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xstack option is used to compile the program, the parameters and local
+ variables of all reentrant functions are allocated in this area.
This option is provided for programs with large stack space requirements.
- When used with the ---stack-auto option, all parameters and local variables
- are allocated on the external stack (note support libraries will need to
- be recompiled with the same options).
+ When used with the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto option, all parameters and local variables are allocated on
+ the external stack (note support libraries will need to be recompiled with
+ the same options).
\layout Standard
The compiler outputs the higher order address byte of the external ram segment
\layout Standard
The amount of stack being used is affected by the use of the "internal stack"
- to save registers before a subroutine call is made (---stack-auto
-\begin_inset LatexCommand \index{---stack-auto}
+ to save registers before a subroutine call is made (-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto
+\begin_inset LatexCommand \index{-\/-stack-auto}
\end_inset
If you detect that the stack is over writing you data, then the following
can be done.
- ---xstack will cause an external stack to be used for saving registers
- and (if ---stack-auto is being used) storing parameters and local variables.
+ -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-xstack will cause an external stack to be used for saving registers and
+ (if -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-auto is being used) storing parameters and local variables.
However this will produce more code which will be slower to execute.
\layout Standard
----stack-loc
-\begin_inset LatexCommand \index{---stack-loc}
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-stack-loc
+\begin_inset LatexCommand \index{-\/-stack-loc}
\end_inset
the stack.
\layout Standard
----stack-after-data
-\begin_inset LatexCommand \index{---stack-after-data}
-
-\end_inset
+-
+\begin_inset ERT
+status Collapsed
-, similar to the ---stack-loc, but it automatically places the stack after
- the end of the "near data".
- Again this could waste any spare register space.
\layout Standard
----data-loc
-\begin_inset LatexCommand \index{---data-loc}
+\backslash
+/
+\end_inset
+
+-data-loc
+\begin_inset LatexCommand \index{-\/-data-loc}
\end_inset
If you find that the stack is over writing your bit variables or "near data"
then the approach which best utilised the internal memory is to position
the "near data" after the last bank of used registers or, if you use bit
- variables, after the last bit variable by using the ---data-loc, e.g.
- if two register banks are being used and no bit variables, ---data-loc
- 16, and use the ---stack-after-data option.
+ variables, after the last bit variable by using the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc, e.g.
+ if two register banks are being used and no bit variables, -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-data-loc 16.
\layout Standard
If bit variables are being used, another method would be to try and squeeze
The intermediate code generation assumes the target machine has unlimited
number of registers, and designates them with the name iTemp.
The compiler can be made to dump a human readable form of the code generated
- by using the ---dumpraw option.
+ by using the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpraw option.
\layout Itemize
This phase does the bulk of the standard optimizations and is also MCU independe
How the Debugger Works
\layout Standard
-When the ---debug option is specified the compiler generates extra symbol
- information some of which are put into the the assembler source and some
- are put into the .adb file.
+When the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-debug option is specified the compiler generates extra symbol information
+ some of which are put into the the assembler source and some are put into
+ the .adb file.
Then the linker creates the .cdb file from the individual .adb files with
the address information for the symbols.
The debugger reads the symbolic information generated by the compiler &
Command Line Options.
\layout Itemize
----directory=<source file directory> this option can used to specify the
- directory search list.
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-directory=<source file directory> this option can used to specify the directory
+ search list.
The debugger will look into the directory list specified for source, cdb
& ihx files.
The items in the directory list must be separated by ':', e.g.
if the source files can be in the directories /home/src1 and /home/src2,
- the ---directory option should be ---directory=/home/src1:/home/src2.
+ the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-directory option should be -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-directory=/home/src1:/home/src2.
Note there can be no spaces in the option.
\layout Itemize
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
---------
+--------
\newline
;;
\newline
which reproduces the problem.
If you can isolate the problem by looking at the generated assembly code,
this can be very helpful.
- Compiling your program with the ---dumpall
-\begin_inset LatexCommand \index{---dumpall}
+ Compiling your program with the -
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-dumpall
+\begin_inset LatexCommand \index{-\/-dumpall}
\end_inset
\layout Standard
Traffic on sdcc-devel and sdcc-user is about 100 mails/month each not counting
- spam and automated messages (mid 2003)
+ automated messages (mid 2003)
\end_inset
and the
\shape italic
This is an excerpt from an atricle published in Circuit Cellar MagaZine
in august 2000.
- It's a little outdated (the compiler is much more efficient now and user/devell
-oper friendly), but pretty well exposes the guts of it all.
+ It's a little outdated (the compiler is much more efficient now and user/develo
+per friendly), but pretty well exposes the guts of it all.
\shape default
\newline
\newline
15.\SpecialChar ~
\SpecialChar ~
-for (i = 0, j = 10 ; i < 10 ; i++, j---) {
+for (i = 0, j = 10 ; i < 10 ; i++, j--) {
\newline
16.\SpecialChar ~
\SpecialChar ~