\layout Date
\size normal
-SDCC 2.6.4
+SDCC 2.6.5
\size footnotesize
\newline
-$Date$
+$Date:: $
\newline
$Revision$
Some of the other tools (simulator and assembler) included with SDCC contain
their own documentation and can be found in the source distribution.
If you want the latest unreleased software, the complete source package
- is available directly from Subversion on https://svn.sourceforge.net/svnroot/sdcc
-/trunk/sdcc.
+ is available directly from Subversion on https://sdcc.svn.sourceforge.net/svnroot/
+sdcc/trunk/sdcc.
\layout Section
Wishes for the future
a gcc compiler and last but not least
\layout Enumerate
-the binaries can be built by cross compiling on Sourceforge's compile farm.
+the binaries can be built by cross compiling on SDCC Distributed Compile
+ Farm.
\layout Standard
See the examples, how to pass the Win32 settings to 'configure'.
\series medium
Download the source package
\series default
- either from the SDCC Subversion repository or from the nightly snapshots
+ either from the SDCC Subversion repository or from snapshot builds
\series medium
, it will be named something like sdcc
\series default
-.src
+-src
\series medium
-.t
+-yyyymmdd-rrrr.t
\series default
ar.
\series medium
-gz
+bz2
\series default
\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/snap.php}
Unpack the file using a command like:
\family sans
\series bold
-"tar -xvzf sdcc.src.tar.gz
+"tar -xvzf sdcc-src-yyyymmdd-rrrr.tar.bz2
+\begin_inset Quotes srd
+\end_inset
+
+
\family default
-\series default
-"
\series medium
, this will create a sub-directory called sdcc with all of the sources.
Download the source package
\series default
either from the SDCC Subversion repository or from the
-\begin_inset LatexCommand \url[nightly snapshots]{http://sdcc.sourceforge.net/snap.php}
+\begin_inset LatexCommand \url[snapshot builds]{http://sdcc.sourceforge.net/snap.php}
\end_inset
\series medium
, it will be named something like sdcc
\series default
-.src
+-src
\series medium
-.tgz.
+-yyyymmdd-rrrr.tar.bz2.
\series default
SDCC is distributed with all the projects, workspaces, and files you need
\layout Standard
+\backslash
+/
+
+\end_inset
+
+-funsigned-char
+\begin_inset LatexCommand \index{-\/-funsigned-char}
+
+\end_inset
+
+
+\series default
+ The default signedness for every type is
+\family typewriter
+ signed
+\family default
+.
+ In some embedded environments the default signedness of
+\family typewriter
+ char
+\family default
+ is
+\family typewriter
+ unsigned
+\family default
+.
+ To set the signess for characters to unsigned, use the option --funsigned-char.
+ If this option is set and no signedness keyword (unsigned/signed) is given,
+ a char will be signed.
+ All other types are unaffected.
+
+\layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+
\backslash
/
\layout Standard
+\backslash
+/
+
+\end_inset
+
+-no-gen-comments
+\begin_inset LatexCommand \index{-\/-no-gen-comments}
+
+\end_inset
+
+
+\series default
+ Will not include code generator comments in the generated files.
+
+\layout List
+\labelwidthstring 00.00.0000
+
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+
\backslash
/
\layout Verse
\family typewriter
-volatile
-\begin_inset LatexCommand \index{volatile}
+volatile
+\begin_inset LatexCommand \index{volatile}
+
+\end_inset
+
+ bit resource_is_free;
+\newline
+
+\newline
+if (resource_is_free)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+{
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+resource_is_free=0;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+resource_is_free=1;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+}
+
+\layout Standard
+Note, mcs51 and ds390 support only an atomic
+\begin_inset LatexCommand \index{atomic}
+
+\end_inset
+
+ bit test and
+\emph on
+clear
+\emph default
+ instruction (as opposed to atomic bit test and
+\emph on
+set).
+
+\layout Section
+Functions using private register banks
+\begin_inset LatexCommand \label{sub:Functions-using-private-banks}
+
+\end_inset
+
+ (mcs51/ds390)
+
+\layout Standard
+Some architectures have support for quickly changing register sets.
+ SDCC supports this feature with the
+\emph on
+using
+\begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_using (mcs51, ds390 register bank)}
+
+\end_inset
+
+
+\emph default
+ attribute (which tells the compiler to use a register bank
+\begin_inset LatexCommand \index{register bank (mcs51, ds390)}
+
+\end_inset
+
+ other than the default bank zero).
+ It should only be applied to
+\emph on
+interrupt
+\begin_inset LatexCommand \index{interrupt}
+
+\end_inset
+
+
+\emph default
+ functions (see footnote below).
+ This will in most circumstances make the generated ISR code more efficient
+ since it will not have to save registers on the stack.
+
+\layout Standard
+The
+\emph on
+using
+\emph default
+ attribute will have no effect on the generated code for a
+\emph on
+non-interrupt
+\emph default
+ function (but may occasionally be useful anyway
+\begin_inset Foot
+collapsed false
+
+\layout Standard
+possible exception: if a function is called ONLY from 'interrupt' functions
+ using a particular bank, it can be declared with the same 'using' attribute
+ as the calling 'interrupt' functions.
+ For instance, if you have several ISRs using bank one, and all of them
+ call memcpy(), it might make sense to create a specialized version of memcpy()
+ 'using 1', since this would prevent the ISR from having to save bank zero
+ to the stack on entry and switch to bank zero before calling the function
+
+\end_inset
+
+).
+\newline
+
+\emph on
+(pending: Note, nowadays the
+\emph default
+using
+\emph on
+ attribute has an effect on
+\emph default
+
+\emph on
+the generated code for a
+\emph default
+non-interrupt
+\emph on
+ function
+\emph default
+.
+\emph on
+)
+
+\layout Standard
+An
+\emph on
+interrupt
+\emph default
+ function using a non-zero bank will assume that it can trash that register
+ bank, and will not save it.
+ Since high-priority interrupts
+\begin_inset LatexCommand \index{interrupts}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{interrupt priority}
+
+\end_inset
+
+ can interrupt low-priority ones on the 8051 and friends, this means that
+ if a high-priority ISR
+\emph on
+using
+\emph default
+ a particular bank occurs while processing a low-priority ISR
+\emph on
+using
+\emph default
+ the same bank, terrible and bad things can happen.
+ To prevent this, no single register bank should be
+\emph on
+used
+\emph default
+ by both a high priority and a low priority ISR.
+ This is probably most easily done by having all high priority ISRs use
+ one bank and all low priority ISRs use another.
+ If you have an ISR which can change priority at runtime, you're on your
+ own: I suggest using the default bank zero and taking the small performance
+ hit.
+
+\layout Standard
+\added_space_bottom bigskip
+It is most efficient if your ISR calls no other functions.
+ If your ISR must call other functions, it is most efficient if those functions
+ use the same bank as the ISR (see note 1 below); the next best is if the
+ called functions use bank zero.
+ It is very inefficient to call a function using a different, non-zero bank
+ from an ISR.
+
+
+
+
+\layout Section
+Startup Code
+\begin_inset LatexCommand \label{sub:Startup-Code}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{Startup code}
+
+\end_inset
+
+
+
+\layout Subsection
+MCS51/DS390 Startup Code
+
+\layout Standard
+The compiler triggers the linker to link certain initialization modules
+ from the runtime library
+\begin_inset LatexCommand \index{Runtime library}
+
+\end_inset
+
+ called crt<something>.
+ Only the necessary ones are linked, for instance crtxstack.asm (GSINIT1,
+ GSINIT5) is not linked unless the --xstack option is used.
+ These modules are highly entangled by the use of special segments/areas,
+ but a common layout is shown below:
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(main.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area HOME (CODE)
+\newline
+__interrupt_vect:
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ljmp __sdcc_gsinit_startup
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtstart.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT0 (CODE)
+\newline
+__sdcc_gsinit_startup::
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov sp,#__start__stack - 1
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxstack.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT1 (CODE)
+\newline
+__sdcc_init_xstack::
+\newline
+; Need to initialize in GSINIT1 in
+ case the user's __sdcc_external_startup uses the xstack.
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov __XPAGE,#(__start__x
+stack >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov _spx,#__start__xstack
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtstart.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT2 (CODE)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+lcall __sdcc_external_startup
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov a,dpl
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+jz __sdcc_init_data
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ljmp
+ __sdcc_program_startup
+\newline
+__sdcc_init_data:
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxinit.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT3 (CODE)
+\newline
+__mcs51_genXINIT::
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r1,#l_XINIT
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov a,r1
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+orl a,#(l_XINIT
+ >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+jz 00003$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r2,#((l_XINIT+255) >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov dptr,#s_XINIT
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r0,#s_XISEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov
+ __XPAGE,#(s_XISEG >> 8)
+\newline
+00001$:\SpecialChar ~
+clr a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+movc a,@a+dptr
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+movx @r0,a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc dptr
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc
+ r0
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+cjne r0,#0,00002$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc __XPAGE
+\newline
+00002$:\SpecialChar ~
+djnz r1,00001$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz r2,00001$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov __XPAGE,#0
+xFF
+\newline
+00003$:
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtclear.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT4 (CODE)
+\newline
+__mcs51_genRAMCLEAR::
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+clr a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r0,#(l_IRAM-1)
+\newline
+00004$:\SpecialChar ~
+mov
+ @r0,a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz r0,00004$
+\newline
+; _mcs51_genRAMCLEAR() end
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxclear.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT4 (CODE)
+\newline
+__mcs51_genXRAMCLEAR::
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r0,#l_PSEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov a,r0
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+jz 00006$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov
+ r1,#s_PSEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov __XPAGE,#(s_PSEG >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+clr a
+\newline
+00005$:\SpecialChar ~
+movx @r1,a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc r1
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz r0,00005$
+\newline
+0
+0006$:
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r0,#l_XSEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov a,r0
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+orl a,#(l_XSEG >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+jz 00008$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov r1,#((l_XSEG
+ + 255) >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov dptr,#s_XSEG
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+clr a
+\newline
+00007$:\SpecialChar ~
+movx @dptr,a
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+inc dptr
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz r0,00007$
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+djnz
+ r1,00007$
+\newline
+00008$:
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(crtxstack.asm)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT5 (CODE)
+\newline
+; Need to initialize in GSINIT5 because __mcs51_genXINIT
+ modifies __XPAGE
+\newline
+; and __mcs51_genRAMCLEAR modifies _spx.
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov __XPAGE,#(__start__x
+stack >> 8)
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+mov _spx,#__start__xstack
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(application modules)
+
+\layout Verse
+
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSINIT (CODE)
+
+\layout Verse
+
+\family typewriter
+\series bold
+\size footnotesize
+(main.asm)
-\end_inset
+\layout Verse
- bit resource_is_free;
+\family typewriter
+\size footnotesize
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+.area GSFINAL (CODE)
\newline
-
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ljmp __sdcc_program_startup
\newline
-if (resource_is_free)
+;---------------------------------
+-----------------------
+\newline
+; Home
+\newline
+;--------------------------------------------------
+------
\newline
\SpecialChar ~
\SpecialChar ~
-{
-\newline
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-resource_is_free=0;
+\SpecialChar ~
+\SpecialChar ~
+.area HOME (CODE)
\newline
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-...
-
-\newline
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-resource_is_free=1;
+.area CSEG (CODE)
+\newline
+__sdcc_program_startup:
\newline
\SpecialChar ~
\SpecialChar ~
-}
-
-\layout Standard
-Note, mcs51 and ds390 support only an atomic
-\begin_inset LatexCommand \index{atomic}
-
-\end_inset
-
- bit test and
-\emph on
-clear
-\emph default
- instruction (as opposed to atomic bit test and
-\emph on
-set).
-
-\layout Section
-Functions using private register banks
-\begin_inset LatexCommand \label{sub:Functions-using-private-banks}
-
-\end_inset
-
- (mcs51/ds390)
-
-\layout Standard
-Some architectures have support for quickly changing register sets.
- SDCC supports this feature with the
-\emph on
-using
-\begin_inset LatexCommand \index{using (mcs51, ds390 register bank)}
-
-\end_inset
-
-
-\begin_inset LatexCommand \index{\_\_using (mcs51, ds390 register bank)}
-
-\end_inset
-
-
-\emph default
- attribute (which tells the compiler to use a register bank
-\begin_inset LatexCommand \index{register bank (mcs51, ds390)}
-
-\end_inset
-
- other than the default bank zero).
- It should only be applied to
-\emph on
-interrupt
-\begin_inset LatexCommand \index{interrupt}
-
-\end_inset
-
-
-\emph default
- functions (see footnote below).
- This will in most circumstances make the generated ISR code more efficient
- since it will not have to save registers on the stack.
-
-\layout Standard
-The
-\emph on
-using
-\emph default
- attribute will have no effect on the generated code for a
-\emph on
-non-interrupt
-\emph default
- function (but may occasionally be useful anyway
-\begin_inset Foot
-collapsed false
-
-\layout Standard
-possible exception: if a function is called ONLY from 'interrupt' functions
- using a particular bank, it can be declared with the same 'using' attribute
- as the calling 'interrupt' functions.
- For instance, if you have several ISRs using bank one, and all of them
- call memcpy(), it might make sense to create a specialized version of memcpy()
- 'using 1', since this would prevent the ISR from having to save bank zero
- to the stack on entry and switch to bank zero before calling the function
-
-\end_inset
-
-).
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+lcall _main
\newline
-
-\emph on
-(pending: Note, nowadays the
-\emph default
-using
-\emph on
- attribute has an effect on
-\emph default
-
-\emph on
-the generated code for a
-\emph default
-non-interrupt
-\emph on
- function
-\emph default
-.
-\emph on
-)
-
-\layout Standard
-An
-\emph on
-interrupt
-\emph default
- function using a non-zero bank will assume that it can trash that register
- bank, and will not save it.
- Since high-priority interrupts
-\begin_inset LatexCommand \index{interrupts}
-
-\end_inset
-
-
-\begin_inset LatexCommand \index{interrupt priority}
-
-\end_inset
-
- can interrupt low-priority ones on the 8051 and friends, this means that
- if a high-priority ISR
-\emph on
-using
-\emph default
- a particular bank occurs while processing a low-priority ISR
-\emph on
-using
-\emph default
- the same bank, terrible and bad things can happen.
- To prevent this, no single register bank should be
-\emph on
-used
-\emph default
- by both a high priority and a low priority ISR.
- This is probably most easily done by having all high priority ISRs use
- one bank and all low priority ISRs use another.
- If you have an ISR which can change priority at runtime, you're on your
- own: I suggest using the default bank zero and taking the small performance
- hit.
-
-\layout Standard
-\added_space_bottom bigskip
-It is most efficient if your ISR calls no other functions.
- If your ISR must call other functions, it is most efficient if those functions
- use the same bank as the ISR (see note 1 below); the next best is if the
- called functions use bank zero.
- It is very inefficient to call a function using a different, non-zero bank
- from an ISR.
-
-
-
-
-\layout Section
-Startup Code
-\begin_inset LatexCommand \label{sub:Startup-Code}
-
-\end_inset
-
-
-\begin_inset LatexCommand \index{Startup code}
-
-\end_inset
-
-
-
-\layout Subsection
-MCS51/DS390 Startup Code
+;
+ return from main will lock up
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+sjmp .
\layout Standard
-The compiler inserts a call to the C routine
+One of these modules (crtstart.asm) contains a call to the C routine
\emph on
_sdcc_external_startup()
\begin_inset LatexCommand \index{\_sdcc\_external\_startup()}
\series default
at the start of the CODE area.
- This routine is in the runtime library
+ This routine is also in the runtime library
\begin_inset LatexCommand \index{Runtime library}
\end_inset
-.
- By default this routine returns 0, if this routine returns a non-zero value,
- the static & global variable initialization will be skipped and the function
- main will be invoked.
+ and returns 0 by default.
+ If this routine returns a non-zero value, the static & global variable
+ initialization will be skipped and the function main will be invoked.
Otherwise static & global variables will be initialized before the function
main is invoked.
- You could add a
+ You could add an
\emph on
_sdcc_external_startup()
\emph default
\end_inset
or online at
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
\end_inset
not
\emph default
support long variables and field widths).
- Be sure to only use only one of these printf options within a project.
+ Be sure to use only one of these printf options within a project.
\newline
\layout Verse
\family typewriter
-__sfr __at (0x92) _XPAGE; /* Cypress EZ-USB family */
+__sfr __at (0x85) _XPAGE; /* Ramtron VRS51 family a.k.a.
+ MPAGE */
+
+\layout Verse
+
+\family typewriter
+__sfr __at (0x92) _XPAGE; /* Cypress EZ-USB family, Texas Instruments (Chipcon)
+ a.k.a.
+ MPAGE */
+
+\layout Verse
+
+\family typewriter
+__sfr __at (0x91) _XPAGE; /* Infineon (Siemens) C500 family a.k.a.
+ XPAGE */
\layout Verse
\family typewriter
-__sfr __at (0xaf) _XPAGE; /* some Silicon Labs (Cygnal) chips */
+__sfr __at (0xaf) _XPAGE; /* some Silicon Labs (Cygnal) chips a.k.a.
+ EMI0CN */
\layout Verse
\family typewriter
-__sfr __at (0xaa) _XPAGE; /* some Silicon Labs (Cygnal) chips */
+__sfr __at (0xaa) _XPAGE; /* some Silicon Labs (Cygnal) chips a.k.a.
+ EMI0CN */
\layout Standard
For more exotic implementations further customizations may be needed.
inline assembly and so are not yet usable.
\layout Standard
-\added_space_bottom bigskip
\pagebreak_bottom
+\added_space_bottom bigskip
The HC08 port passes the regression test suite (see section
\begin_inset LatexCommand \ref{sec:Quality-control}
pages and there's less page selection overhead.
\layout Enumerate
- And as for any 8 bit micro (especially for PIC 14 as they have a very simple
+And as for any 8 bit micro (especially for PIC 14 as they have a very simple
instruction set), use 'unsigned char' whereever possible instead of 'int'.
\layout Subsection
initialized data
\layout Standard
-Currently, data can only be initialized if it resides in the source file
\pagebreak_bottom
+Currently, data can only be initialized if it resides in the source file
together with
\emph on
main()
\end_inset
+\family default
+
\layout Section
\end_inset
-) and thus the nightly regression tests for the PIC16 target are currently
- disabled for all hosts except for
+) and thus the snapshot build regression tests for the PIC16 target are
+ currently disabled for all hosts
\emph on
-Linux on Opteron.
-
-\emph default
- This means you can see the result of the PIC16 regression tests f.e.
- by checking the log files in
-\begin_inset LatexCommand \url{http://sdcc.sourceforge.net/regression_test_results/amd64-unknown-linux2.3/}
-
-\end_inset
-
- (pick the most up to date file there, scroll down, lend a hand).
+.
\layout Chapter
Debugging
raphics File
\size footnotesize
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/doc/figures/ddd_example.png}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/doc/figures/ddd_example.png}
\end_inset
The following is a list of key mapping for the debugger interface.
\layout Standard
-\SpecialChar ~
\pagebreak_bottom
+\SpecialChar ~
\family typewriter
;;
\newline
+\family default
+
\layout Chapter
\end_inset
>
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/compiler.h?view=markup}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/compiler.h?view=markup}
\end_inset
to allow using common header files.
(see f.e.
cc2510fx.h
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/cc2510fx.h?view=markup}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/cc2510fx.h?view=markup}
\end_inset
\newline
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/ChangeLog}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/ChangeLog}
\end_inset
\newline
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/as/doc/asxhtm.html}
\end_inset
\newline
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/doc/}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/doc/}
\end_inset
:
\newline
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/debugger/README}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/debugger/README}
\end_inset
\newline
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/sim/ucsim/doc/index.html}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/sim/ucsim/doc/index.html}
\end_inset
\emph default
-\begin_inset LatexCommand \url{http://svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/src/pic16/NOTES}
+\begin_inset LatexCommand \url{http://sdcc.svn.sourceforge.net/viewvc/*checkout*/sdcc/trunk/sdcc/src/pic16/NOTES}
\end_inset
in the Subversion repository
\size footnotesize
-\begin_inset LatexCommand \htmlurl{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog}
+\begin_inset LatexCommand \htmlurl{http://sdcc.svn.sourceforge.net/viewcvs.cgi/*checkout*/sdcc/trunk/sdcc/ChangeLog}
\end_inset
\layout Standard
-The compiler is passed through nightly compile and build checks.
+The compiler is passed through snaphot build compile and build checks.
The so called
\shape italic
regression tests
see a world wide impact
\layout Standard
-then SDCC is probably among the first choices.
\pagebreak_bottom
+then SDCC is probably among the first choices.
Well, probably SDCC might be the only choice.