\size normal
-SDCC 2.5.6
+SDCC 2.6.1
\size footnotesize
\newline
, etc.), Dallas DS80C390 variants, Freescale (formerly Motorola) HC08 and
Zilog Z80 based MCUs.
- It can be retargetted for other microprocessors, support for Microchip
- PIC, Atmel AVR is under development.
+ It can be retargeted for other microprocessors, support for Microchip PIC,
+ Atmel AVR is under development.
The entire source code for the compiler is distributed under GPL.
SDCC uses ASXXXX
\begin_inset LatexCommand \index{asXXXX (as-gbz80, as-hc08, asx8051, as-z80)}
\end_inset
-, an open source retargettable assembler & linker.
+, an open source retargetable assembler & linker.
SDCC has extensive language extensions suitable for utilizing various microcont
rollers and underlying hardware effectively.
\newline
SDCC also comes with a companion source level debugger SDCDB, the debugger
currently uses ucSim a freeware simulator for 8051 and other micro-controllers.
- SDCDB and ucSim are currently not available on Win32 platforms.
\newline
\end_inset
.
- More detailled instructions follow below.
+ More detailed instructions follow below.
\layout Section
Configure Options
/
\end_inset
--disable-ucsim
+-host=i586-mingw32msvc
\backslash
\newline
/
\end_inset
--host=i586-mingw32msvc -
-\begin_inset ERT
-status Collapsed
-
-\layout Standard
-
-\backslash
-/
-\end_inset
-
-build=unknown-unknown-linux-gnu
\layout Standard
./configure -C
\backslash
-\newline
-CFLAGS=
-\begin_inset Quotes srd
-\end_inset
-
--mno-cygwin -O2
-\begin_inset Quotes srd
-\end_inset
-
-
-\backslash
-
-\newline
-LDFLAGS=
-\begin_inset Quotes srd
-\end_inset
-
--mno-cygwin
-\begin_inset Quotes srd
-\end_inset
-
-
-\backslash
-
\newline
-
\begin_inset ERT
\backslash
\newline
--
-\begin_inset ERT
-status Collapsed
+CC=
+\begin_inset Quotes srd
+\end_inset
-\layout Standard
+gcc -mno-cygwin
+\begin_inset Quotes srd
+\end_inset
+
\backslash
-/
+
+\newline
+CXX=
+\begin_inset Quotes srd
+\end_inset
+
+g++ -mno-cygwin
+\begin_inset Quotes srd
\end_inset
--disable-ucsim
+
\layout Standard
'configure' is quite slow on Cygwin (at least on windows before Win2000/XP).
See section 'Configure Options'.
\layout Subsection
-Building SDCC on Windows
-\layout Standard
-
-With the exception of Cygwin the SDCC binaries uCsim and sdcdb can't be
- built on Windows.
- They use Unix-sockets, which are not available on Win32.
-\layout Subsection
-
Building SDCC using Cygwin and Mingw32
\layout Standard
\series default
SDCC is distributed with all the projects, workspaces, and files you need
- to build it using Visual C++ 6.0/NET (except for sdcdb.exe which currently
- doesn't build under MSVC).
+ to build it using Visual C++ 6.0/NET (except for SDCDB and ucSim).
The workspace name is 'sdcc.dsw'.
Please note that as it is now, all the executables are created in a folder
called sdcc
From the sdcc directory, run the command "make -f Makefile.bcc".
This should regenerate all the .exe files in the bin directory except for
- sdcdb.exe (which currently doesn't build under Borland C++).
+ SDCDB and ucSim.
\layout Enumerate
If you modify any source files and need to rebuild, be aware that the dependenci
\layout Itemize
s51 - The ucSim 8051 simulator.
- Not available on Win32 platforms.
\layout Itemize
sdcdb - The source debugger.
- Not available on Win32 platforms.
\layout Itemize
packihx - A tool to pack (compress) Intel hex files.
.
It currently supports the core mcs51, the Dallas DS80C390 and the Phillips
XA51 family.
- S51 is currently not available on Win32 platfors.
\layout Subsection
sdcdb - Source Level Debugger
\layout Standard
-Sdcdb
-\begin_inset LatexCommand \index{sdcdb (debugger)}
+SDCDB
+\begin_inset LatexCommand \index{SDCDB (debugger)}
\end_inset
is the companion source level debugger.
- More about sdcdb in section
+ More about SDCDB in section
\begin_inset LatexCommand \ref{cha:Debugging-with-SDCDB}
\end_inset
\end_inset
, but can be easily changed to use other simulators.
- Sdcdb is currently not available on Win32 platfors.
\layout Chapter
Using SDCC
not
\emph default
support long variables and field widths).
+\layout Subsubsection
+
+<malloc.h>
+\begin_inset LatexCommand \index{malloc.h}
+
+\end_inset
+
+
+\layout Standard
+
+Before using dynamic
+\begin_inset LatexCommand \index{dynamic}
+
+\end_inset
+
+ memory allocation with SDCC, you have to provide heap
+\begin_inset LatexCommand \index{heap}
+
+\end_inset
+
+ space for malloc to allocate memory from
+\family typewriter
+.
+
+\family default
+You can acomplish this by including the following code into your source:
+\layout Verse
+
+
+\family typewriter
+#include <malloc.h>
+\begin_inset LatexCommand \index{malloc.h}
+
+\end_inset
+
+ /* calloc
+\begin_inset LatexCommand \index{calloc}
+
+\end_inset
+
+, malloc
+\begin_inset LatexCommand \index{malloc}
+
+\end_inset
+
+, realloc
+\begin_inset LatexCommand \index{realloc}
+
+\end_inset
+
+, and free
+\begin_inset LatexCommand \index{free}
+
+\end_inset
+
+ */
+\newline
+
+\newline
+#define HEAPSIZE 0x1000 /* Adjust depending on available memory */
+\newline
+unsigned char xdata myheap[HEAPSIZE]; /* The actual heap for dynamic memory
+ */
+\newline
+
+\newline
+void main (void)
+\newline
+{
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+/* Your variable declarations come here*/
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+init_dynamic_memory((MEMHEADER xdata *)myheap, HEAPSIZE);
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+...
+ /* Rest of your code*/
+\newline
+}
+\newline
+
\layout Subsection
Math functions (sinf, powf, sqrtf etc.)
(+ | -) - switch _asm _endasm block preprocessing on / off.
Default is on.
+ You use this prama to define multilines of assembly code.
+ This will prevent the preprocessor from changing the formating required
+ by assembly code.
+ Below is an example on how to use this pragma.
+\layout Verse
+
+
+\family typewriter
+#pragma preproc_asm -
+\begin_inset LatexCommand \index{\#pragma preproc\_asm}
+
+\end_inset
+
+
+\newline
+#define MYDELAY _asm
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+nop ;my assembly comment...
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+nop
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+nop
+\newline
+_endasm
+\newline
+#pragma preproc_asm +
+\newline
+
+\newline
+void foo (void)
+\newline
+{
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ ...
+
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ MYDELAY;
+\newline
+\SpecialChar ~
+\SpecialChar ~
+\SpecialChar ~
+ ...
+
+\newline
+}
+\newline
+
\layout Standard
The pragma's are intended to be used to turn-on or off certain optimizations
The compiler will generate a warning message when extra space is allocated.
It is strongly recommended that the save and restore pragma's be used when
changing options for a function.
+\newline
+
+\newline
+
+\newline
+
\layout Section
Defines Created by the Compiler
\begin_inset Tabular
<lyxtabular version="3" rows="11" columns="2">
<features>
-<column alignment="left" valignment="top" leftline="true" width="0">
-<column alignment="left" valignment="top" leftline="true" rightline="true" width="0">
+<column alignment="left" valignment="top" leftline="true" width="3in">
+<column alignment="left" valignment="top" leftline="true" rightline="true" width="3in">
<row topline="true" bottomline="true">
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\end_inset
-, etc
+, etc.
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\layout Standard
-depending on the model used (e.g.: -mds390
+depending on the model used (e.g.: -mds390)
\end_inset
</cell>
</row>
\layout Standard
-descrption
+description
\end_inset
</cell>
</row>
{
\layout LyX-Code
- stdout = STREAM_USER; /* this is not necessery, since stdout points
+ stdout = STREAM_USER; /* this is not necessary, since stdout points
\layout LyX-Code
* by default to STREAM_USER */
\end_inset
-\begin_inset LatexCommand \index{sdcdb (debugger)}
+\begin_inset LatexCommand \index{SDCDB (debugger)}
\end_inset
specified during configuration.
The debugger allows you debug BOTH at the C source and at the ASM source
level.
- Sdcdb is currently not available on Win32 platforms.
\layout Subsection
Compiling for Debugging
execution is controlled by the debugger.
When a command is issued for the debugger, it translates it into appropriate
commands for the simulator.
- (Currently sdcdb only connects to the simulator but
+ (Currently SDCDM only connects to the simulator but
\emph on
newcdb
\emph default
\layout Standard
-uCsim
+ucSsim
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\layout Standard
-sdcdb
+SDCDB
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\layout Standard
-Notes on debugging with sdcdb
-\begin_inset LatexCommand \index{sdcdb (debugger)}
+Notes on debugging with SDCDB
+\begin_inset LatexCommand \index{SDCDB (debugger)}
\end_inset
\layout Standard
-Tools for Silicon Laboratories JTAG debug adapter, partly based on sdcdb
+Tools for Silicon Laboratories JTAG debug adapter, partly based on SDCDB
(Unix only)
\end_inset
</cell>
\layout Standard
-IDE (has anyone tried integrating SDCC & sdcdb? Unix only)
+IDE (has anyone tried integrating SDCC & SDCDB? Unix only)
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\layout Standard
-Debugger, serves nicely as GUI to sdcdb
-\begin_inset LatexCommand \index{sdcdb (debugger)}
+Debugger, serves nicely as GUI to SDCDB
+\begin_inset LatexCommand \index{SDCDB (debugger)}
\end_inset