\lyxformat 221
\textclass book
\begin_preamble
+\pdfoptionpdfminorversion=3
\usepackage[
pdftitle={SDCC Compiler User Guide},
pdfauthor={SDCC development team},
\size normal
-SDCC 2.5.0
+SDCC 2.5.1
\size footnotesize
\newline
\end_inset
(jwk burps: please be more specific here, please!).
- If you want rather more than less warnings you should consider using a
- separate tool dedicated to syntax checking like splint
-\begin_inset LatexCommand \url{http://www.splint.org}
-
-\end_inset
-
-.
\layout List
\labelwidthstring 00.00.0000
\end_inset
.
- See file sdcc/as/doc/asxhtm.html for assembler options.
+ See file sdcc/as/doc/asxhtm.html for assembler options.cd
\layout List
\labelwidthstring 00.00.0000
\series default
Follow the C99 standard and disable SDCC features that conflict with the
standard (incomplete support).
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+more-pedantic
+\series default
+ Actually this is
+\series bold
+\emph on
+not
+\series default
+\emph default
+ a SDCC compiler option but if you want
+\emph on
+more
+\emph default
+ warnings you can use a separate tool dedicated to syntax checking like
+ splint
+\begin_inset LatexCommand \label{lyx:more-pedantic-SPLINT}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{lint (syntax checking tool)}
+
+\end_inset
+
+
+\begin_inset LatexCommand \url{http://www.splint.org}
+
+\end_inset
+
+.
+ To make your source files parseable by splint you will have to include
+
+\family sans
+lint.h
+\family default
+
+\begin_inset LatexCommand \index{splint (syntax checking tool)}
+
+\end_inset
+
+ in your source file and add brackets around extended keywords (like
+\family sans
+
+\begin_inset Quotes sld
+\end_inset
+
+__at\SpecialChar ~
+
+\series bold
+(
+\series default
+0xab
+\series bold
+)
+\series default
+
+\begin_inset Quotes srd
+\end_inset
+
+
+\family default
+ and
+\family sans
+
+\begin_inset Quotes sld
+\end_inset
+
+__interrupt\SpecialChar ~
+(2)
+\begin_inset Quotes srd
+\end_inset
+
+
+\family default
+).
+
+\newline
+Splint has an excellent on line manual at
+\begin_inset LatexCommand \url{http://www.splint.org/manual/}
+
+\end_inset
+
+ 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:
+\newline
+
+\family sans
+splint\SpecialChar ~
+-I\SpecialChar ~
+/usr/local/share/sdcc/include/mcs51/\SpecialChar ~
+\SpecialChar ~
+myprogram.c
\layout Subsection
Intermediate Dump Options
modes of a 8051.
It is typically located at the start of xdata and has a maximum size of
256 bytes.
- The following example writes 0x01 to the address pointed to.
+ The following example writes 0x01 to the pdata variable.
Please note, pdata access physically accesses xdata memory.
The high byte of the address is determined by port P2
\begin_inset LatexCommand \index{P2 (mcs51 sfr)}
\family typewriter
-pdata unsigned char *test_pdata_ptr;
-\newline
-
-\newline
-void main()
-\newline
-{
-\newline
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-test_pdata_ptr = (pdata *)0xfe;
-\newline
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-*test_pdata_ptr = 1;
-\newline
-}
+pdata unsigned char test_pdata;
\layout Standard
-Generates the assembly code:
+Writing 0x01 to this variable generates the assembly code:
\layout Verse
\family typewriter
-75*01 FE\SpecialChar ~
-\SpecialChar ~
-\SpecialChar ~
-mov\SpecialChar ~
- _test_pdata_ptr,#0xFE
-\newline
-78 FE\SpecialChar ~
+78r00\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-mov\SpecialChar ~
- r0,#0xFE
+mov r0,#_test_pdata
\newline
74 01\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-mov\SpecialChar ~
- a,#0x01
+mov a,#0x01
\newline
F2\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
-movx @r0,a
+movx @r0,a
\layout Standard
If the -
\begin_inset LatexCommand \index{\_\_sfr}
+\end_inset
+
+ / sfr16
+\begin_inset LatexCommand \index{sfr16}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_sfr16}
+
+\end_inset
+
+ / sfr32
+\begin_inset LatexCommand \index{sfr32}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_sfr32}
+
\end_inset
/ sbit
Like the bit keyword,
\emph on
-sfr / sbit
+sfr / sfr16 / sfr32 / sbit
\emph default
-signifies both a data-type and storage class, they are used to describe
- the
+signify both a data-type and storage class, they are used to describe the
+
\emph on
s
\emph default
0x80 P0;\SpecialChar ~
/* special function register P0 at location 0x80 */
\newline
+/* 16 bit special function register combination for timer 0 */
+\newline
+/* with the high byte at location 0x8C and the low byte at location 0x8A
+ */
+\newline
+sfr16 at
+\begin_inset LatexCommand \index{at}
+
+\end_inset
+
+
+\begin_inset LatexCommand \index{\_\_at}
+
+\end_inset
+
+ 0x8C8A TMR0;
+\newline
sbit at 0xd7 CY; /* CY (Carry Flag
\begin_inset LatexCommand \index{Flags}
sbit
\emph default
addresses a specific bit within these sfr.
+\newline
+16 Bit and 32 bit special function register combinations which require a
+ certain access order are better not declared using
+\emph on
+sfr16
+\emph default
+ or
+\emph on
+sfr32.
+
+\emph default
+ Allthough SDCC usually accesses them Least Significant Byte (LSB) first,
+ this is not guaranteed.
\layout Subsubsection
Pointers
*/
\newline
char * xdata p;
+\newline
+
+\newline
+/* the following is a function pointer physically located in data space
+ */
+\newline
+char (* data fp)(void);
\layout Standard
Well you get the idea.
object file.
\layout Section
-Command Line Options.
+Command Line Options
\layout Itemize
-
-k <port number> passed to simulator see the simulator docs for details.
\layout Section
-Debugger Commands.
+Debugger Commands
\layout Standard
As mentioned earlier the command interface for the debugger has been deliberatel
y kept as close the GNU debugger gdb, as possible.
This will help the integration with existing graphical user interfaces
(like ddd, xxgdb or xemacs) existing for the GNU debugger.
- If you use a graphical user interface for the debugger you can skip the
- next sections.
+ If you use a graphical user interface for the debugger you can skip this
+ section.
\layout Subsubsection*
break [line | file:line | function | file:function]
My name is Bobby Brown"
\layout Section
+Interfacing with DDD
+\layout Comment
+
+The screenshot was converted from png to eps with:
+\begin_inset Quotes sld
+\end_inset
+
+bmeps -c -e8f -p3 ddd_example.png >ddd_example.eps
+\begin_inset Quotes srd
+\end_inset
+
+ which produces a pretty compact eps file which is free from compression
+ artifacts.
+\layout Comment
+
+The screenshot was included in sdccman.lyx cvs version 1.120 but later removed
+ as this broke the build system on Sourceforge (pdf-file was broken).
+\layout Standard
+
+The .eps File
+\size footnotesize
+
+\begin_inset LatexCommand \url{http://cvs.sourceforge.net/viewcvs.py/*checkout*/sdcc/sdcc/doc/figures/ddd_example.eps}
+
+\end_inset
+
+
+\size default
+ shows a screenshot of a debugging session with DDD
+\begin_inset LatexCommand \index{DDD (debugger)}
+
+\end_inset
+
+ (Unix only) on a simulated 8032.
+ The debugging session might not run as smoothly as the screenshot suggests.
+ The debugger allows setting of breakpoints, displaying and changing variables,
+ single stepping through C and assembler code.
+
+\newline
+The source was compiled with
+\family sans
+\series bold
+
+\newline
+
+\newline
+sdcc -
+\family default
+\series default
+
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+
+\family sans
+\series bold
+-debug ddd_example.c
+\family default
+\series default
+
+\family sans
+\series bold
+
+\newline
+
+\family default
+\series default
+
+\newline
+and DDD was invoked with
+\family sans
+\series bold
+
+\newline
+
+\newline
+ddd -debugger 'sdcdb -cpu 8032 ddd_example'
+\layout Section
+
Interfacing with XEmacs
\begin_inset LatexCommand \index{XEmacs}
\end_inset
-.
+
\layout Standard
Two files (in emacs lisp) are provided for the interfacing with XEmacs,
<features>
<column alignment="center" valignment="top" leftline="true" width="0pt">
<column alignment="center" valignment="top" leftline="true" width="0pt">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0pt">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
<features>
<column alignment="center" valignment="top" leftline="true" width="0pt">
<column alignment="block" valignment="top" leftline="true" width="30line%">
-<column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="0pt">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\layout Standard
-Statically checks c sources (has anyone adapted splint for SDCC?)
+Statically checks c sources (see
+\begin_inset LatexCommand \ref{lyx:more-pedantic-SPLINT}
+
+\end_inset
+
+)
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">