Update user doc
[fw/sdcc] / doc / SDCCUdoc-2.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4  <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.7">
5  <TITLE>SDCC Compiler User Guide: Installation </TITLE>
6  <LINK HREF="SDCCUdoc-3.html" REL=next>
7  <LINK HREF="SDCCUdoc-1.html" REL=previous>
8  <LINK HREF="SDCCUdoc.html#toc2" REL=contents>
9 </HEAD>
10 <BODY>
11 <A HREF="SDCCUdoc-3.html">Next</A>
12 <A HREF="SDCCUdoc-1.html">Previous</A>
13 <A HREF="SDCCUdoc.html#toc2">Contents</A>
14 <HR>
15 <H2><A NAME="Installation"></A> <A NAME="s2">2. Installation </A> </H2>
16
17 <P>What you need before you start installation of SDCC ? A C Compiler, not
18 just any C Compiler, gcc to be exact, you can get adventurous and try another
19 compiler , I HAVEN'T tried it. GCC is free , and is available for almost all
20 major platforms, if you are using linux you probably already have it, if you
21 are using Windows 95/NT go to www.cygnus.com and download CYGWIN32 you will
22 need the full development version of their tool (full.exe), follow their instructions
23 for installation (this is also free and is very easy to install), Windows 95/NT
24 users be aware that the compiler runs substantially slower on the Windows platform,
25 I am not sure why.
26 <P>After you have installed gcc you are ready to build the compiler (sorry
27 no binary distributions yet). SDCC is native to Linux but can be ported to
28 any platform on which GCC is available . Extract the source file package (.zip
29 or .tar.gz) into some directory , which we shall refer to as SDCCDIR from now
30 on.
31 <H2><A NAME="Components"></A> <A NAME="ss2.1">2.1 Components of SDCC</A>
32  </H2>
33
34 <H3>gc ( a conservative garbage collector) </H3>
35
36 <P>SDCC relies on this component to do all the memory management, this excellent
37 package is copyrighted by Jans J Boehm(boehm@sgi.com) and Alan J Demers but
38 can be used with minimum restrictions. The GC source will be extracted into
39 the directory SDCCDIR/gc. 
40 <H3>cpp ( C-Preprocessor) </H3>
41
42 <P>The preprocessor is extracted into the directory SDCCDIR/cpp, it is a modified
43 version of the GNU preprocessor.
44 <H3>asxxxx &amp; aslink ( The assembler and Linkage Editor) </H3>
45
46 <P>This is retargettable assembler &amp; linkage editor, it was developed
47 by Alan Baldwin, John Hartman created the version for 8051, and I (Sandeep)
48 have some enhancements and bug fixes for it to work properly with the SDCC.
49 This component is extracted into the directory SDCCDIR/asxxxx.
50 <H3>SDCC - The compiler. </H3>
51
52 <P>This is the actual compiler, it uses gc and invokes the assembler and linkage
53 editor. All files with the prefix SDCC are part of the compiler and is extracted
54 into the the directory SDCCDIR.
55 <H3>S51 - Simulator </H3>
56
57 <P>Version 2.1.8 onwards contains s51 a freeware , opensource simulator developed
58 by Daniel Drotos &lt;drdani@mazsola.iit.uni-miskolc.hu&gt;. The executable
59 is built as part of build process, for more information visit Daniel's website
60 at &lt;http://mazsola.iit.uni-miskolc.hu/~drdani/embedded/s51/&gt;.
61 <H3>SDCDB - Source level Debugger. </H3>
62
63 <P>SDCDB is the companion source level debugger . The current version of the
64 debugger uses Daniel's Simulator S51, but can be easily changed to use other
65 simulators.
66 <H2><A NAME="ss2.2">2.2 Installation for Version &lt;= 2.1.7</A>
67  </H2>
68
69 <P>After the package is extracted (Windows 95/NT users start CYGWIN shell),
70 change to the directory where you extracted the package and give the command.
71 <P>
72 <PRE>
73 ./sdccbuild.sh
74  
75 </PRE>
76 <P>This is a bash shell script, it will compile all the above mentioned components
77 and install the executables into the directory SDCCDIR/bin make sure you add
78 this directory to your PATH environment variable. This script will also compile
79 all the support routines ( library routines ) using SDCC. The support routines
80 are all developed in C and need to be compiled.
81 <H2><A NAME="ss2.3">2.3 Installation for Version &gt;= 2.1.8a</A>
82  </H2>
83
84 <P>The distribution method from Version 2.1.8a has been changed to be conforment
85 with the "autoconf" utility. The source is now distributed as <B>sdcc-&lt;version
86 number&gt;.tar.gz format</B> , instead of the older .zip format. The steps for
87 installation are as follows.
88 <H3>Unpack the sources. </H3>
89
90 <P>This is usually done by the following command "<B>gunzip -c sdcc-&lt;version
91 number&gt;.tar.gz | tar -xv -</B>"
92 <H3>Change to the main source directory (usually sdcc or sdcc-&lt;version number&gt;) </H3>
93
94 <H3>Issue command to configure your system </H3>
95
96 <P>The configure command has several options the most commonly used option
97 is --prefix=&lt;directory name&gt;, where &lt;directory name&gt; is the final
98 location for the sdcc executables and libraries, (default location is /usr/local).
99 The installation process will create the following directory structure under
100 the &lt;directory name&gt; specified.
101 <P>
102 <PRE>
103 bin/ - binary exectables (add to PATH environment variable) 
104 share/ 
105       sdcc51inc/
106  - include header files 
107       sdcc51lib/ - 
108              small/ - Object &amp;
109  Library files for small model library 
110              large/ - Object &amp; library
111  files for large model library
112  
113 </PRE>
114 <P>The command 
115 <P><B>'./configure --prefix=/usr/local" </B>
116 <P>will create configure the compiler to be installed in directory /usr/local/bin.
117 <H3>make </H3>
118
119 <P>After configuration step issue the command 
120 <P><B>"make"</B>
121 <P>This will compile the compiler
122 <H3>"make install" </H3>
123
124 <P>Will install the compiler and libraries in the appropriate directories.
125 <H3>Special Notes for Windows Users. Provided by Michael Jamet[ mjamet@computer.org] </H3>
126
127 <P> 
128 <P>  How to install SDCC from source on a Windows 95 or Windows NT 4 system
129 <P>
130 <P> 
131 <P>  This document describes how to install SDCC on a Win 95 or Win NT 4 system.
132 <P>
133 <P>  These instructions probably work for Win 98 as well, but have not been
134 <P>
135 <P>  tested on that platform. 
136 <P> 
137 <P>  There are lots of little differences between UNIX and the Win32 Cygnus
138 <P>
139 <P>  environment which make porting more difficult than it should be.  If
140 <P>
141 <P>  you want the details, please contact me.  Otherwise just follow these
142 <P>
143 <P>  instructions. 
144 <P> 
145 <P>  1. Install the Cygnus Software 
146 <P>  Go to http://sourceware.cygnus.com/cygwin.  Cygnus provides a UNIX like
147 <P>
148 <P>  environment for Win 32 systems.  Download &quot;full.exe&quot; and
149 install.  You 
150 <P>  MUST install it on your C drive.  &quot;full.exe&quot; contains a shell
151 AND many 
152 <P>  common UNIX utilities. 
153 <P> 
154 <P>  2. Download and Extract the Latest SDCC 
155 <P>  The latest version can be found at 
156 <P>   www.geocities.com/ResearchTriange/Forum/1353. 
157 <P>  It can be uncompressed with winzip. 
158 <P> 
159 <P>  3.  Start a Cygnus Shell 
160 <P>  There should be an entry in the Start Menu for Cygnus.  Invoke the shell.
161 <P>
162 <P>  This gives you a UNIX like environment.  FROM THIS POINT ON, DIRECTORIES
163 <P>
164 <P>  MUST BE SPECIFIED WITH FORWARD SLASHES (/) NOT THE DOS STYLE BACK 
165 <P>  SLASHES (\) BECAUSE THIS IS WHAT UNIX EXPECTS.  - 
166 <P>   ex. &quot;\winnt&quot; would be &quot;/winnt&quot; under the
167 shell. 
168 <P> 
169 <P>  4. Change Directory to Where SDCC was extracted (referred to as INSTALLDIR)
170 <P>
171 <P> 
172 <P>  ex. cd /sdcc218Da.  If you extracted to a drive OTHER THAN C, the drive
173 <P>
174 <P>  must be specified as part of the path. For example, if you extracted
175 to 
176 <P>  your &quot;g drive&quot;, type the following: &quot;cd //g/mydir&quot;. 
177 You must use &quot;//&quot; 
178 <P>  to specify the drive. 
179 <P> 
180 <P>  5. Make Dirs Which are Automatically Made During the UNIX Installation
181 <P>
182 <P>  From the INSTALLDIR, 
183 <P> 
184 <P>   mkdir -p bin   (not a typo, just &quot;bin&quot;) 
185 <P>   mkdir -p /bin 
186 <P>   mkdir -p /usr/local/bin 
187 <P>   mkdir -p /usr/local/share 
188 <P>   mkdir -p /usr/local/share/sdcc51lib 
189 <P>   mkdir -p /usr/local/share/sdcc51inc 
190 <P>   mkdir -p /tmp 
191 <P> 
192 <P>  (When a path from the root directory is specified WITHOUT a drive, the
193 <P>
194 <P>  drive defaults to c.  For example /michael/newuser =&gt; c:\michael\newuser)
195 <P>
196 <P> 
197 <P>  6.  Add Programs to /bin Expected by the Installation Process 
198 <P>   - Look at your path: echo $PATH 
199 <P>     One of the fields is the diretory with the CYGNUS programs. 
200 <P>    ex. /CYGNUS/CYGWIN~1/H-I586/BIN 
201 <P> 
202 <P>   - cd to the directory found above.  You may have to fiddle with the
203 <P>
204 <P>     case (upper or lower) here because the PATH is SHOWN as all upper
205 <P>
206 <P>     case, but is actually mixed.  To help you along, you may type 
207 <P>     a letter or 2 followed by the escape key.  The shell will fill 
208 <P>     out the remaining letters IF THEY describe a unique directory. 
209 <P>     If you have problems here, cd one directory and type &quot;ls&quot;. 
210 &quot;ls&quot; 
211 <P>     is the equivalent of &quot;dir/w&quot;. 
212 <P> 
213 <P>   - Copy the following: 
214 <P>    cp sh.exe /bin 
215 <P>    cp pwd.exe /bin 
216 <P>    cp echo.exe /bin 
217 <P> 
218 <P>  7. Go back to the INSTALLDIR 
219 <P>   cd INSTALLDIR 
220 <P>  ex. cd //d/sdcc218Da 
221 <P> 
222 <P>  8. Run the configure Program 
223 <P>   ./configure 
224 <P>  The &quot;./&quot; is important because your current directory is NOT
225 in your path. 
226 <P>  Under DOS, your current directory was implicitly always the first entry
227 <P>
228 <P>  in your path. 
229 <P> 
230 <P>  9. Run make 
231 <P>   make 
232 <P> 
233 <P>  This process takes quite some time under Win 32. 
234 <P> 
235 <P>  10. Install the Newly Built Software 
236 <P>   make install 
237 <P> 
238 <P>  This will partially install the software into the /usr/local directories
239 <P>
240 <P>  created in step 5.  What it actually doing is copying the .c, .h and
241 <P>
242 <P>  library files to directories under /usr/local/share. 
243 <P> 
244 <P>  It will NOT be able to install the actual programs (binaries) because
245 <P>
246 <P>  it does not know programs on Win32 systems have &quot;.exe&quot; extensions.
247 <P>
248 <P>  For example, it tries to install sdcc instead of sdcc.exe. 
249 <P> 
250 <P>  After the automated part is finished, you must manually copy the binaries:
251 <P>
252 <P>   cd bin  (This is the bin directory in your INSTALLDIR) 
253 <P>   cp * /usr/local/bin 
254 <P> 
255 <P>  11. Make sure /usr/local/bin is in Your PATH 
256 <P>  You may add c:\usr\local\bin to your path however your
257 Win32 system allows.  For 
258 <P>  example you may add it to the PATH statement in autoexec.bat. 
259 <P> 
260 <P>  Good luck.  If you have any questions send them to me or post them 
261 <P>  to the list. 
262 <HR>
263 <A HREF="SDCCUdoc-3.html">Next</A>
264 <A HREF="SDCCUdoc-1.html">Previous</A>
265 <A HREF="SDCCUdoc.html#toc2">Contents</A>
266 </BODY>
267 </HTML>