@nataliapc/mcp-openmsx 1.2.9 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -2
- package/bin/win-x64/mcp-openmsx-sspi-proxy.exe +0 -0
- package/dist/chunker.js +187 -0
- package/dist/embedder.js +250 -0
- package/dist/openmsx.js +113 -248
- package/dist/openmsx_windows.js +316 -0
- package/dist/server.js +6 -1
- package/dist/server_tools.js +6 -5
- package/dist/vectordb.js +94 -35
- package/package.json +16 -18
- package/resources/audio/chipsfmpacpr1_en.md +209 -0
- package/resources/audio/chipsfmpacpr2_en.md +170 -0
- package/resources/audio/toc.json +12 -0
- package/resources/book--msx-top-secret-3/MTS3-Appendix-English-Upd2.pdf +0 -0
- package/resources/book--msx-top-secret-3/MTS3-Complete-English.pdf +0 -0
- package/resources/book--msx2-technical-handbook/toc.json +1 -1
- package/resources/book--the-msx-red-book/Chapter1_Programmable_Peripheral_Interface.md +112 -0
- package/resources/book--the-msx-red-book/Chapter2_Video_Display_Processor.md +308 -0
- package/resources/book--the-msx-red-book/Chapter3_Programmable_Sound_Generator.md +168 -0
- package/resources/book--the-msx-red-book/Chapter4_ROM_BIOS.md +2528 -0
- package/resources/book--the-msx-red-book/Chapter5_ROM_BASIC_Interpreter.md +3975 -0
- package/resources/book--the-msx-red-book/Chapter6_Memory_Map.md +1963 -0
- package/resources/book--the-msx-red-book/Chapter7_Machine_Code_Programs.md +1238 -0
- package/resources/book--the-msx-red-book/Introduction.md +104 -0
- package/resources/book--the-msx-red-book/toc.json +38 -3
- package/resources/processors/toc.json +3 -3
- package/resources/processors/z80-undocumented.md +141 -0
- package/resources/sdcc/1_Introduction.md +199 -0
- package/resources/sdcc/2_Installing_SDCC.md +533 -0
- package/resources/sdcc/3_Using_SDCC.md +1758 -0
- package/resources/sdcc/4_Notes_on_supported_Processors.md +1638 -0
- package/resources/sdcc/5_Debugging.md +210 -0
- package/resources/sdcc/6_Tips_and_Support.md +258 -0
- package/resources/sdcc/7_SDCC_Technical_Data.md +489 -0
- package/resources/sdcc/8_Compiler_internals.md +477 -0
- package/resources/sdcc/toc.json +44 -2
- package/vector-db/msxdocs.lance/_indices/4d3bd360-e3c6-408d-b0ff-a4d6bd9580cb/metadata.lance +0 -0
- package/vector-db/msxdocs.lance/_indices/4d3bd360-e3c6-408d-b0ff-a4d6bd9580cb/part_0_docs.lance +0 -0
- package/vector-db/msxdocs.lance/_indices/4d3bd360-e3c6-408d-b0ff-a4d6bd9580cb/part_0_invert.lance +0 -0
- package/vector-db/msxdocs.lance/_indices/4d3bd360-e3c6-408d-b0ff-a4d6bd9580cb/part_0_tokens.lance +0 -0
- package/vector-db/msxdocs.lance/_transactions/0-6f47c9fc-3657-40f0-9dd4-c7226b2a4805.txn +0 -0
- package/vector-db/msxdocs.lance/_transactions/1-2bb7426e-a4b0-40ea-9a58-00c4985fc6a9.txn +0 -0
- package/vector-db/msxdocs.lance/_versions/18446744073709551613.manifest +0 -0
- package/vector-db/msxdocs.lance/_versions/18446744073709551614.manifest +0 -0
- package/vector-db/msxdocs.lance/_versions/latest_version_hint.json +1 -0
- package/vector-db/msxdocs.lance/data/110001110001011010001000876c134b8296fbc47762d1e1ab.lance +0 -0
- package/resources/book--the-msx-red-book/the_msx_red_book.md +0 -10349
- package/resources/processors/z80-undocumented.tex +0 -5617
- package/resources/sdcc/lyx2md.py +0 -745
- package/resources/sdcc/sdccman.lyx +0 -81574
- package/resources/sdcc/sdccman.md +0 -5557
- package/vector-db/index.json +0 -1
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
# SDCC Compiler User Guide
|
|
2
|
+
|
|
3
|
+
## Installing SDCC range none pageformat default Installation
|
|
4
|
+
|
|
5
|
+
For most users it is sufficient to skip to either section Building SDCC on Linux (Unix) or section Windows Install Using the Setup Program (Windows). More detailed instructions follow below.
|
|
6
|
+
|
|
7
|
+
### Configure Options range none pageformat default Options SDCC configuration
|
|
8
|
+
|
|
9
|
+
The install paths, search paths and other options are defined when running 'configure'. The defaults can be overridden by:
|
|
10
|
+
|
|
11
|
+
--prefix see table below
|
|
12
|
+
|
|
13
|
+
--exec_prefix see table below
|
|
14
|
+
|
|
15
|
+
--bindir see table below
|
|
16
|
+
|
|
17
|
+
--datadir see table below
|
|
18
|
+
|
|
19
|
+
--datarootdir see table below
|
|
20
|
+
|
|
21
|
+
docdir environment variable, see table below
|
|
22
|
+
|
|
23
|
+
include_dir_suffix environment variable, see table below
|
|
24
|
+
|
|
25
|
+
non_free_include_dir_suffix environment variable, see table below
|
|
26
|
+
|
|
27
|
+
lib_dir_suffix environment variable, see table below
|
|
28
|
+
|
|
29
|
+
non_free_lib_dir_suffix environment variable, see table below
|
|
30
|
+
|
|
31
|
+
sdccconf_h_dir_separator environment variable, either / or\\ makes sense here. This character will only be used in sdccconf.h; don't forget it's a C-header, therefore a double-backslash is needed there.
|
|
32
|
+
|
|
33
|
+
--disable-mcs51-port Excludes the Intel mcs51 port
|
|
34
|
+
|
|
35
|
+
--disable-z80-port Excludes the z80 port
|
|
36
|
+
|
|
37
|
+
--disable-z180-port Excludes the z180 port
|
|
38
|
+
|
|
39
|
+
--disable-ez80_z80-port Excludes the e80_z80 port
|
|
40
|
+
|
|
41
|
+
--disable-z80n-port Excludes the z80n port
|
|
42
|
+
|
|
43
|
+
--disable-r800-port Excludes the r800 port
|
|
44
|
+
|
|
45
|
+
--disable-r2k-port Excludes the r2k port
|
|
46
|
+
|
|
47
|
+
--disable-r2ka-port Excludes the r2ka port
|
|
48
|
+
|
|
49
|
+
--disable-r3ka-port Excludes the r3ka port
|
|
50
|
+
|
|
51
|
+
--disable-sm83-port Excludes the SM83 port
|
|
52
|
+
|
|
53
|
+
--disable-tlcs90-port Excludes the TLCS-90 port
|
|
54
|
+
|
|
55
|
+
--disable-ds390-port Excludes the DS390 port
|
|
56
|
+
|
|
57
|
+
--disable-ds400-port Excludes the DS400 port
|
|
58
|
+
|
|
59
|
+
--disable-hc08-port Excludes the HC08 port
|
|
60
|
+
|
|
61
|
+
--disable-s08-port Excludes the S08 port
|
|
62
|
+
|
|
63
|
+
--disable-stm8-port Excludes the STM8 port
|
|
64
|
+
|
|
65
|
+
--disable-pdk13-port Excludes the PDK13 port
|
|
66
|
+
|
|
67
|
+
--disable-pdk14-port Excludes the PDK14 port
|
|
68
|
+
|
|
69
|
+
--disable-pdk15-port Excludes the PDK15 port
|
|
70
|
+
|
|
71
|
+
--disable-pic14-port Excludes the PIC14 port
|
|
72
|
+
|
|
73
|
+
--disable-pic16-port Excludes the PIC16 port
|
|
74
|
+
|
|
75
|
+
--disable-mos6502-port Excludes the MOS6502
|
|
76
|
+
|
|
77
|
+
--disable-mos65c02-port Excludes the MOS65C02
|
|
78
|
+
|
|
79
|
+
--disable-ucsim Disables configuring and building of ucsim
|
|
80
|
+
|
|
81
|
+
--disable-device-lib Disables automatically building device libraries
|
|
82
|
+
|
|
83
|
+
--disable-packihx Disables building packihx
|
|
84
|
+
|
|
85
|
+
--enable-doc Build pdf, html and txt files from the lyx sources
|
|
86
|
+
|
|
87
|
+
--enable-libgc Use the Bohem memory allocator. Lower runtime footprint.
|
|
88
|
+
|
|
89
|
+
--without-ccache Do not use ccache even if available
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
The names of the standard libraries STD_LIB, STD_INT_LIB, STD_LONG_LIB, STD_FP_LIB, STD_DS390_LIB, STD_XA51_LIB and the environment variables SDCC_DIR_NAME, SDCC_INCLUDE_NAME, SDCC_LIB_NAME are defined by `configure' too. At the moment it's not possible to change the default settings (it was simply never required).
|
|
94
|
+
|
|
95
|
+
These configure options are compiled into the binaries, and can only be changed by rerunning 'configure' and recompiling SDCC. The configure options are written in *italics* to distinguish them from run time environment variables (see section search paths).
|
|
96
|
+
|
|
97
|
+
The settings for" Win32 builds" are used by the SDCC team to build the official Win32 binaries. The SDCC team uses Mingw32 to build the official Windows binaries, because it's
|
|
98
|
+
|
|
99
|
+
1. open source,
|
|
100
|
+
2. a gcc compiler and last but not least
|
|
101
|
+
3. the binaries can be built by cross compiling on SDCC Distributed Compile Farm.
|
|
102
|
+
See the examples, how to pass the Win32 settings to 'configure'. The other Win32 builds using VC or whatever don't use 'configure', but a header file sdcc_vc.h.in is the same as sdccconf.h built by 'configure' for Win32.
|
|
103
|
+
|
|
104
|
+
These defaults are:
|
|
105
|
+
|
|
106
|
+
| Variable | default | Win32 builds |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
| PREFIX | /usr/local | sdcc |
|
|
109
|
+
| EXEC_PREFIX | $PREFIX | $PREFIX |
|
|
110
|
+
| BINDIR | $EXEC_PREFIX /bin | $EXEC_PREFIX bin |
|
|
111
|
+
| DATADIR | $DATAROOTDIR | $DATAROOTDIR |
|
|
112
|
+
| DATAROOTDIR | $PREFIX /share | $PREFIX |
|
|
113
|
+
| DOCDIR | $DATAROOTDIR /sdcc/doc | $DATAROOTDIR doc |
|
|
114
|
+
| INCLUDE_DIR_SUFFIX | sdcc/include | include |
|
|
115
|
+
| NON_FREE_INCLUDE_DIR_SUFFIX | sdcc/non-free/include | non-free/include |
|
|
116
|
+
| LIB_DIR_SUFFIX | sdcc/lib | lib |
|
|
117
|
+
| NON_FREE_LIB_DIR_SUFFIX | sdcc/non-free/lib | non-free/lib |
|
|
118
|
+
| NON_FREE_LIB_DIR_SUFFIX | sdcc/non-free/lib | non-free/lib |
|
|
119
|
+
|
|
120
|
+
'configure' also computes relative paths. This is needed for full relocatability of a binary package and to complete search paths (see section search paths below):
|
|
121
|
+
|
|
122
|
+
| Variable (computed) | default | Win32 builds |
|
|
123
|
+
| --- | --- | --- |
|
|
124
|
+
| BIN2DATA_DIR |../share |.. |
|
|
125
|
+
| PREFIX2BIN_DIR | bin | bin |
|
|
126
|
+
| PREFIX2DATA_DIR | share/sdcc | |
|
|
127
|
+
| PREFIX2DATA_DIR | share/sdcc | |
|
|
128
|
+
|
|
129
|
+
Examples:
|
|
130
|
+
|
|
131
|
+
./configure
|
|
132
|
+
./configure --prefix=" /usr/bin"--datarootdir=" /usr/share"
|
|
133
|
+
./configure --disable-avr-port --disable-xa51-port
|
|
134
|
+
|
|
135
|
+
To cross compile on linux for Mingw32 (see also 'sdcc/support/scripts/sdcc_mingw32'):
|
|
136
|
+
|
|
137
|
+
./configure\
|
|
138
|
+
CC=" i586-mingw32msvc-gcc" CXX=" i586-mingw32msvc-g++"\
|
|
139
|
+
RANLIB=" i586-mingw32msvc-ranlib"\
|
|
140
|
+
STRIP=" i586-mingw32msvc-strip"\
|
|
141
|
+
--prefix=" /sdcc"\
|
|
142
|
+
--datarootdir=" /sdcc"\
|
|
143
|
+
docdir="\ ${datarootdir}/doc"\
|
|
144
|
+
include_dir_suffix=" include"\
|
|
145
|
+
non_free_include_dir_suffix=" non-free/include"\
|
|
146
|
+
lib_dir_suffix=" lib"\
|
|
147
|
+
non_free_lib_dir_suffix=" non-free/lib"\
|
|
148
|
+
sdccconf_h_dir_separator="\\\\"\
|
|
149
|
+
--disable-device-lib\
|
|
150
|
+
--host=i586-mingw32msvc\
|
|
151
|
+
--build=unknown-unknown-linux-gnu
|
|
152
|
+
|
|
153
|
+
To" cross" compile on Cygwin for Mingw32 (see also sdcc/support/scripts/sdcc_cygwin_mingw32):
|
|
154
|
+
|
|
155
|
+
./configure\
|
|
156
|
+
--prefix=" /sdcc"\
|
|
157
|
+
--datarootdir=" /sdcc"\
|
|
158
|
+
docdir="\ ${datarootdir}/doc"\
|
|
159
|
+
include_dir_suffix=" include"\
|
|
160
|
+
non_free_include_dir_suffix=" non-free/include"\
|
|
161
|
+
lib_dir_suffix=" lib"\
|
|
162
|
+
non_free_lib_dir_suffix=" non-free/lib"\
|
|
163
|
+
sdccconf_h_dir_separator="\\\\"\
|
|
164
|
+
CC=" gcc -mno-cygwin"\
|
|
165
|
+
CXX=" g++ -mno-cygwin"
|
|
166
|
+
|
|
167
|
+
### Install paths range none pageformat default Install paths
|
|
168
|
+
|
|
169
|
+
| Description | Path | Default | Win32 builds |
|
|
170
|
+
| --- | --- | --- | --- |
|
|
171
|
+
| Binary files* | $EXEC_PREFIX | /usr/local/bin | sdcc bin |
|
|
172
|
+
| Include files | $DATADIR/ $INCLUDE_DIR_SUFFIX | /usr/local/share/ sdcc/include | sdcc include |
|
|
173
|
+
| Non-free include files | $DATADIR/non-free/ $INCLUDE_DIR_SUFFIX | /usr/local/share/ sdcc/non-free/include | sdcc non-free include |
|
|
174
|
+
| Library file** | $DATADIR/ $LIB_DIR_SUFFIX | /usr/local/share/ sdcc/lib | sdcc lib |
|
|
175
|
+
| Library file** | $DATADIR/non-free/ $LIB_DIR_SUFFIX | /usr/local/share/ sdcc/non-free/lib | sdcc non-free lib |
|
|
176
|
+
| Documentation | $DOCDIR | /usr/local/share/ sdcc/doc | sdcc doc |
|
|
177
|
+
| Documentation | $DOCDIR | /usr/local/share/ sdcc/doc | sdcc doc |
|
|
178
|
+
|
|
179
|
+
*compiler, preprocessor, assembler, and linker
|
|
180
|
+
**the *model* is auto-appended by the compiler, e.g. small, large, z80, ds390 etc
|
|
181
|
+
|
|
182
|
+
The install paths can still be changed during `make install' with e.g.:
|
|
183
|
+
|
|
184
|
+
make install prefix=$(HOME)/local/sdcc
|
|
185
|
+
|
|
186
|
+
Of course this doesn't change the search paths compiled into the binaries.
|
|
187
|
+
|
|
188
|
+
Moreover the install path can be changed by defining DESTDIR range none pageformat default DESTDIR:
|
|
189
|
+
|
|
190
|
+
make install DESTDIR=$(HOME)/sdcc.rpm/
|
|
191
|
+
|
|
192
|
+
Please note that DESTDIR must have a trailing slash!
|
|
193
|
+
|
|
194
|
+
### Search Paths range none pageformat default Search path
|
|
195
|
+
|
|
196
|
+
Some search paths or parts of them are determined by configure variables (in *italics*, see section above). Further search paths are determined by environment variables during runtime.
|
|
197
|
+
The paths searched when running the compiler are as follows (the first catch wins):
|
|
198
|
+
|
|
199
|
+
1. Binary files (preprocessor, assembler and linker)
|
|
200
|
+
|
|
201
|
+
| Search path | default | Win32 builds |
|
|
202
|
+
| --- | --- | --- |
|
|
203
|
+
| $SDCC_HOME/ $PPREFIX2BIN_DIR | $SDCC_HOME/bin | $SDCC_HOME bin |
|
|
204
|
+
| Path of argv[0] (if available) | Path of argv[0] | Path of argv[0] |
|
|
205
|
+
| $PATH | $PATH | $PATH |
|
|
206
|
+
| $PATH | $PATH | $PATH |
|
|
207
|
+
|
|
208
|
+
2. Include files
|
|
209
|
+
|
|
210
|
+
| # | Search path | default | Win32 builds |
|
|
211
|
+
| --- | --- | --- | --- |
|
|
212
|
+
| 1 | - -I dir | - -I dir | - -I dir |
|
|
213
|
+
| 2 | $SDCC_INCLUDE | $SDCC_INCLUDE | $SDCC_INCLUDE |
|
|
214
|
+
| 3 | $SDCC_HOME/ $PREFIX2DATA_DIR/ $INCLUDE_DIR_SUFFIX | $SDCC_HOME/ share/sdcc/include | $SDCC_HOME include |
|
|
215
|
+
| 4 | path(argv[0])/ $BIN2DATADIR/ $INCLUDE_DIR_SUFFIX | path(argv[0])/../ sdcc/include | path(argv[0]).. include |
|
|
216
|
+
| 5 | $DATADIR/ $INCLUDE_DIR_SUFFIX | /usr/local/share/ sdcc/include | (not on Win32) |
|
|
217
|
+
| 6 | $SDCC_HOME/ $PREFIX2DATA_DIR/ non-free/ $INCLUDE_DIR_SUFFIX | $SDCC_HOME/share/ sdcc/non-free/include | $SDCC_HOME non-free include |
|
|
218
|
+
| 7 | path(argv[0])/ $BIN2DATADIR/ non-free/ $INCLUDE_DIR_SUFFIX | path(argv[0])/../ sdcc/non-free/include | path(argv[0]).. non-free include |
|
|
219
|
+
| 8 | $DATADIR/ non-free/ $INCLUDE_DIR_SUFFIX | /usr/local/share/ sdcc/non-free/include | (not on Win32) |
|
|
220
|
+
| 8 | $DATADIR/ non-free/ $INCLUDE_DIR_SUFFIX | /usr/local/share/ sdcc/non-free/include | (not on Win32) |
|
|
221
|
+
|
|
222
|
+
The option --nostdinc disables all search paths except #1 and #2.
|
|
223
|
+
|
|
224
|
+
3. Library files
|
|
225
|
+
|
|
226
|
+
With the exception of"--L dir" the *model* is auto-appended by the compiler (e.g. small, large, z80, ds390 etc.).
|
|
227
|
+
|
|
228
|
+
| # | Search path | default | Win32 builds |
|
|
229
|
+
| --- | --- | --- | --- |
|
|
230
|
+
| 1 | - -L dir | - -L dir | - -L dir |
|
|
231
|
+
| 2 | $SDCC_LIB/ | $SDCC_LIB/ | $SDCC_LIB/ |
|
|
232
|
+
| 3 | $SDCC_LIB | $SDCC_LIB | $SDCC_LIB |
|
|
233
|
+
| 4 | $SDCC_HOME/ $PREFIX2DATA_DIR/ $LIB_DIR_SUFFIX/ | $SDCC_HOME/ share/sdcc/lib/< model> | $SDCC_HOME lib |
|
|
234
|
+
| 5 | path(argv[0])/ $BIN2DATADIR/ $LIB_DIR_SUFFIX/ | path(argv[0])/../sdcc/ lib/ | path(argv[0]).. lib |
|
|
235
|
+
| 6 | $DATADIR/non-free/ $LIB_DIR_SUFFIX/ | /usr/local/share/sdcc/ lib/ | (not on Win32) |
|
|
236
|
+
| 7 | $SDCC_HOME/ $PREFIX2DATA_DIR/ non-free/ $LIB_DIR_SUFFIX/ | $SDCC_HOME/share/sdcc/ non-free/lib/ | $SDCC_HOME lib non-free |
|
|
237
|
+
| 8 | path(argv[0])/ $BIN2DATADIR/ non-free/ $LIB_DIR_SUFFIX/ | path(argv[0])/../sdcc/ non-free/lib/ | path(argv[0]).. lib non-free |
|
|
238
|
+
| 9 | $DATADIR/non-free/ $LIB_DIR_SUFFIX/ | /usr/local/share/sdcc/ non-free/lib/ | (not on Win32) |
|
|
239
|
+
| 9 | $DATADIR/non-free/ $LIB_DIR_SUFFIX/ | /usr/local/share/sdcc/ non-free/lib/ | (not on Win32) |
|
|
240
|
+
|
|
241
|
+
Don't delete any of the stray spaces in the table above without checking the HTML output (last line)!
|
|
242
|
+
|
|
243
|
+
The option --nostdlib disables all search paths except #1 and #2.
|
|
244
|
+
|
|
245
|
+
### Building SDCC range none pageformat default Building SDCC
|
|
246
|
+
|
|
247
|
+
SDCC can be built for various host platforms using the instructions provided below. Note that the PIC14 and PIC16 library folders in the source distribution contain Autotools-generated files. These are included for convenience and to avoid introducing Autotools as an additional dependency. They have to be regenerated in case of a version mismatch. Alternatively, the PIC backends can be disabled.
|
|
248
|
+
|
|
249
|
+
#### Building SDCC on Linux
|
|
250
|
+
|
|
251
|
+
1. ** Download the source package** either from the SDCC Subversion repository or from snapshot builds**, it will be named something like sdcc**-src**-yyyymmdd-rrrr.t** ar.** bz2** http://sdcc.sourceforge.net/snap.php.
|
|
252
|
+
2. ** Bring up a command line terminal, such as xterm.
|
|
253
|
+
3. ** Unpack the file using a command like:"tar -xvjf sdcc-src-yyyymmdd-rrrr.tar.bz2"**, this will create a sub-directory called sdcc with all of the sources.
|
|
254
|
+
4. Change directory into the main SDCC directory, for example type: **"cd sdcc** ".
|
|
255
|
+
5. ** Type"./configure** ". This configures the package for compilation on your system. When the treedec library is available, it should be found and used automatically (improving the compilation time / code quality trade-off). As of SDCC 3.7.0, the current develop branch from https://github.com/freetdi/tdlib is a suitable version of treedec.
|
|
256
|
+
6. ** Type"make** "**.** All of the source packages will compile, this can take a while.
|
|
257
|
+
7. ** Type"make install"** as root**.** This copies the binary executables, the include files, the libraries and the documentation to the install directories. Proceed with section Testing the SDCC Compiler.
|
|
258
|
+
|
|
259
|
+
#### Building SDCC on Mac OS X
|
|
260
|
+
|
|
261
|
+
Follow the instruction for Linux.
|
|
262
|
+
|
|
263
|
+
On Mac OS X 10.2.x it was reported, that the default gcc (version 3.1 20020420 (prerelease)) fails to compile SDCC. Fortunately there's also gcc 2.9.x installed, which works fine. This compiler can be selected by running 'configure' with:
|
|
264
|
+
|
|
265
|
+
./configure CC=gcc2 CXX=g++2
|
|
266
|
+
|
|
267
|
+
Universal (ppc and i386) binaries can be produced on Mac OS X 10.4.x with Xcode. Run 'configure' with:
|
|
268
|
+
|
|
269
|
+
./configure\
|
|
270
|
+
|
|
271
|
+
LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"\
|
|
272
|
+
|
|
273
|
+
CXXFLAGS = "-O2 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"\
|
|
274
|
+
|
|
275
|
+
CFLAGS = "-O2 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
|
|
276
|
+
|
|
277
|
+
#### Cross compiling SDCC on Linux for Windows
|
|
278
|
+
|
|
279
|
+
With the MinGW gcc cross compiler SDCC can be cross-compiled for Win32. See section 'Configure Options'. SDCC requires boost, but the header-only parts should be sufficient: Get a current boost tarball from www.boost.org, unpack it, and choose suitable configure options so the headers are found by the C++ compiler.
|
|
280
|
+
|
|
281
|
+
#### Building SDCC using Cygwin and Mingw32
|
|
282
|
+
|
|
283
|
+
For building and installing a Cygwin executable follow the instructions for Linux.
|
|
284
|
+
|
|
285
|
+
On Cygwin a" native" Win32-binary can be built, which will not need the Cygwin-DLL. For the necessary 'configure' options see section 'configure options' or the script 'sdcc/support/scripts/sdcc_cygwin_mingw32'.
|
|
286
|
+
|
|
287
|
+
In order to install Cygwin on Windows download setup.exe from www.cygwin.com http://www.cygwin.com/. Run it, set the" default text file type" to" unix" and download/install at least the following packages. Some packages are selected by default, others will be automatically selected because of dependencies with the manually selected packages. Never deselect these packages!
|
|
288
|
+
|
|
289
|
+
- flex
|
|
290
|
+
- bison
|
|
291
|
+
- gcc; version 3.x is fine, no need to use the old 2.9x
|
|
292
|
+
- binutils; selected with gcc
|
|
293
|
+
- make
|
|
294
|
+
- libboost-dev
|
|
295
|
+
- rxvt; a nice console, which makes life much easier under windoze (see below)
|
|
296
|
+
- man; not really needed for building SDCC, but you'll miss it sooner or later
|
|
297
|
+
- less; not really needed for building SDCC, but you'll miss it sooner or later
|
|
298
|
+
- svn; only if you use Subversion access
|
|
299
|
+
If you want to develop something you'll need:
|
|
300
|
+
|
|
301
|
+
- python; for the regression tests
|
|
302
|
+
- gdb; the gnu debugger, together with the nice GUI" insight"
|
|
303
|
+
- openssh; to access the CF or commit changes
|
|
304
|
+
- autoconf and autoconf-devel; if you want to fight with 'configure', don't use autoconf-stable!
|
|
305
|
+
rxvt is a nice console with history. Replace in your cygwin.bat the line
|
|
306
|
+
|
|
307
|
+
bash --login -i
|
|
308
|
+
|
|
309
|
+
with (one line):
|
|
310
|
+
|
|
311
|
+
rxvt -sl 1000 -fn "Lucida Console-12" -sr -cr red
|
|
312
|
+
|
|
313
|
+
-bg black -fg white -geometry 100x65 -e bash --login
|
|
314
|
+
|
|
315
|
+
Text selected with the mouse is automatically copied to the clipboard, pasting works with shift-insert.
|
|
316
|
+
|
|
317
|
+
The other good tip is to make sure you have no //c/-style paths anywhere, use /cygdrive/c/ instead. Using // invokes a network lookup which is very slow. If you think" cygdrive" is too long, you can change it with e.g.
|
|
318
|
+
|
|
319
|
+
mount -s -u -c /mnt
|
|
320
|
+
|
|
321
|
+
SDCC sources use the unix line ending LF. Life is much easier, if you store the source tree on a drive which is mounted in binary mode. And use an editor which can handle LF-only line endings. Make sure not to commit files with Windows line endings. The tabulator spacing range none pageformat default tabulator spacing (8 columns) used in the project is 8. Although a tabulator spacing of 8 is a sensible choice for programmers (it's a power of 2 and allows to display 8/16 bit signed variables without loosing columns) the plan is to move towards using only spaces in the source.
|
|
322
|
+
|
|
323
|
+
#### Building SDCC Using Microsoft Visual C++ 2010 (MSVC)
|
|
324
|
+
|
|
325
|
+
TODO: This section is outdated. Current SDCC requires features noit present in MSVC++ 2010. MSVC++ 2019 or newer is required.
|
|
326
|
+
|
|
327
|
+
** Download the source package** either from the SDCC Subversion repository or from the snapshot builds http://sdcc.sourceforge.net/snap.php**, it will be named something like sdcc**-src**-yyyymmdd-rrrr.tar.bz2.** SDCC is distributed with all the project, solution and other files you need to build it using Visual C++ 2010 (except for ucSim). The solution name is 'sdcc.sln'. Please note that as it is now, all the executables are created in a folder called sdcc\ bin_vc. Once built you need to copy the executables from sdcc\ bin_vc to sdcc\ bin before running SDCC.
|
|
328
|
+
|
|
329
|
+
Apart from the SDCC sources you also need to have the BOOST libraries installed for MSVC. Get it here http://www.boost.org/
|
|
330
|
+
|
|
331
|
+
In order to build SDCC with MSVC you need win32 executables of bison.exe, flex.exe, and gawk.exe. One good place to get them is here http://unxutils.sourceforge.net
|
|
332
|
+
|
|
333
|
+
If UnxUtils didn't work well, range none pageformat default msys msys (http://www.mingw.org/wiki/msys) or msys2 range none pageformat default msys2 (https://msys2.github.io) can be an alternative.
|
|
334
|
+
|
|
335
|
+
Download the file UnxUtils range none pageformat default UnxUtils.zip. Now you have to install the utilities and setup MSVC so it can locate the required programs. Here there are two alternatives (choose one!):
|
|
336
|
+
|
|
337
|
+
1. The easy way:
|
|
338
|
+
|
|
339
|
+
a) Extract UnxUtils.zip to your C:\ hard disk PRESERVING the original paths, otherwise bison won't work. (If you are using WinZip make certain that 'Use folder names' is selected)
|
|
340
|
+
|
|
341
|
+
b) Add 'C:\ user\ local\ wbin' to VC++ Directories / Executable Directories.
|
|
342
|
+
|
|
343
|
+
(As a side effect, you get a bunch of Unix utilities that could be useful, such as diff and patch.)
|
|
344
|
+
2. A more compact way:
|
|
345
|
+
|
|
346
|
+
This one avoids extracting a bunch of files you may not use, but requires some extra work:
|
|
347
|
+
|
|
348
|
+
a) Create a directory were to put the tools needed, or use a directory already present. Say for example 'C:\ util'.
|
|
349
|
+
|
|
350
|
+
b) Extract 'bison.exe', 'bison.hairy', 'bison.simple', 'flex.exe', and gawk.exe to such directory WITHOUT preserving the original paths. (If you are using WinZip make certain that 'Use folder names' is not selected)
|
|
351
|
+
|
|
352
|
+
c) Rename bison.exe to '_bison.exe'.
|
|
353
|
+
|
|
354
|
+
d) Create a batch file 'bison.bat' in 'C:\ util\ ' and add these lines:
|
|
355
|
+
set BISON_SIMPLE=C:\ util\ bison.simple
|
|
356
|
+
set BISON_HAIRY=C:\ util\ bison.hairy
|
|
357
|
+
_bison %1 %2 %3 %4 %5 %6 %7 %8 %9
|
|
358
|
+
|
|
359
|
+
Steps 'c' and 'd' are needed because bison requires by default that the files 'bison.simple' and 'bison.hairy' reside in some weird Unix directory, '/usr/local/share/' I think. So it is necessary to tell bison where those files are located if they are not in such directory. That is the function of the environment variables BISON_SIMPLE and BISON_HAIRY.
|
|
360
|
+
|
|
361
|
+
e) Add 'C:\ util' to VC++ Directories / Executable Directories. Note that you can use any other path instead of 'C:\ util', even the path where the Visual C++ tools are, probably: 'C:\ Program Files\ Microsoft Visual Studio\ Common\ Tools'. So you don't have to execute step 'e':)
|
|
362
|
+
That is it. Open 'sdcc.sln' in Visual Studio, click 'build all', when it finishes copy the executables from sdcc\ bin_vc to sdcc\ bin, and you can compile using SDCC.
|
|
363
|
+
|
|
364
|
+
#### Windows Install Using a ZIP Package
|
|
365
|
+
|
|
366
|
+
1. Download the binary zip package from http://sdcc.sf.net/snap.php and unpack it using your favorite unpacking tool (gunzip, WinZip, etc). This should unpack to a group of sub-directories. An example directory structure after unpacking the mingw32 package is: C:\ sdcc\ bin for the executables, C:\ sdcc\ include and C:\ sdcc\ lib for the include and libraries.
|
|
367
|
+
2. Adjust your environment variable PATH to include the location of the bin directory or start sdcc using the full path.
|
|
368
|
+
|
|
369
|
+
#### Windows Install Using the Setup Program
|
|
370
|
+
|
|
371
|
+
Download the setup program *sdcc-x.y.z-setup.exe* for an official release from
|
|
372
|
+
http://sourceforge.net/projects/sdcc/files/ or a setup program for one of the snapshots *sdcc-yyyymmdd-xxxx-setup.exe* from http://sdcc.sourceforge.net/snap.php and execute it. A Windows typical installer will guide you through the installation process.
|
|
373
|
+
|
|
374
|
+
#### VPATH range none pageformat default VPATH feature
|
|
375
|
+
|
|
376
|
+
SDCC supports the VPATH feature provided by configure and make. It allows to separate the source and build trees. Here's an example:
|
|
377
|
+
|
|
378
|
+
cd ~ # cd $HOME
|
|
379
|
+
|
|
380
|
+
tar -xjf sdcc-src-yyyymmdd-rrrr.tar.bz2 # extract source to directory sdcc
|
|
381
|
+
|
|
382
|
+
mkdir sdcc.build # put output in sdcc.build
|
|
383
|
+
|
|
384
|
+
cd sdcc.build
|
|
385
|
+
|
|
386
|
+
../sdcc/configure # configure is doing all the magic!
|
|
387
|
+
|
|
388
|
+
make
|
|
389
|
+
|
|
390
|
+
That's it! **configure** will create the directory tree will all the necessary Makefiles in ~/sdcc.build. It automagically computes the variables srcdir, top_srcdir and top_buildir for each directory. After running **make** the generated files will be in ~/sdcc.build, while the source files stay in ~/sdcc.
|
|
391
|
+
This is not only usefull for building different binaries, e.g. when cross compiling. It also gives you a much better overview in the source tree when all the generated files are not scattered between the source files. And the best thing is: if you want to change a file you can leave the original file untouched in the source directory. Simply copy it to the build directory, edit it, enter `make clean', `rm Makefile.dep' and `make'. **make** will do the rest for you!
|
|
392
|
+
|
|
393
|
+
### Building the Documentation
|
|
394
|
+
|
|
395
|
+
Add --enable-doc to the configure arguments to build the documentation together with all the other stuff. You will need several tools (\SpecialChar LyX,, 2HTML, pdflatex, dvipdf, dvips and makeindex) to get the job done. Another possibility is to change to the doc directory and to type **" make"** there. You're invited to make changes and additions to this manual (sdcc/doc/sdccman.lyx). Using \SpecialChar LyX http://www.lyx.org as editor is straightforward. Prebuilt documentation is available from http://sdcc.sourceforge.net/snap.php.
|
|
396
|
+
|
|
397
|
+
### Reading the Documentation range none pageformat default Documentation
|
|
398
|
+
|
|
399
|
+
Currently, reading the document in PDF format is recommended, as for unknown reason the hyperlinks are working there whereas in the HTML version they are not If you should know why please drop us a note.
|
|
400
|
+
You'll find the PDF version range none pageformat default PDF version of this document at http://sdcc.sourceforge.net/doc/sdccman.pdf.
|
|
401
|
+
This documentation is in some aspects different from a commercial documentation:
|
|
402
|
+
|
|
403
|
+
- It tries to document SDCC for several processor architectures in one document (commercially these probably would be separate documents/products). This document range none pageformat default Status of documentation currently matches SDCC for mcs51 and DS390 best and does give too few information about f.e. Z80, PIC14, PIC16 and HC08.
|
|
404
|
+
- There are many references pointing away from this documentation. Don't let this distract you. If there f.e. was a reference like http://www.opencores.org together with a statement" some processors which are targeted by SDCC can be implemented in a *f* ield *p* rogrammable *g* ate *a* rray range none pageformat default FPGA (field programmable gate array)" or http://sourceforge.net/projects/fpgac/ range none pageformat default FpgaC ((subset of) C to FPGA compiler)" have you ever heard of an open source compiler that compiles a subset of C for an FPGA?" we expect you to have a quick look there and come back. If you read this you are on the right track.
|
|
405
|
+
- Some sections attribute more space to problems, restrictions and warnings than to the solution.
|
|
406
|
+
- The installation section and the section about the debugger is intimidating.
|
|
407
|
+
- There are still lots of typos and there are more different writing styles than pictures.
|
|
408
|
+
|
|
409
|
+
### Testing the SDCC Compiler
|
|
410
|
+
|
|
411
|
+
The first thing you should do after installing your SDCC compiler is to see if it runs. Type **"sdcc --version" range none pageformat default version** at the prompt, and the program should run and output its version like:
|
|
412
|
+
SDCC: mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/r800/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502/mos65c02 4.4.0 #14546 (Linux)
|
|
413
|
+
|
|
414
|
+
If it doesn't run, or gives a message about not finding sdcc program, then you need to check over your installation. Make sure that the sdcc bin directory is in your executable search path defined by the PATH environment setting (** see** section Install Trouble-shooting** Install trouble-shooting for suggestions**). Make sure that the sdcc program is in the bin folder, if not perhaps something did not install correctly.
|
|
415
|
+
|
|
416
|
+
** SDCC** is commonly installed as described in section" Install and search paths".
|
|
417
|
+
|
|
418
|
+
** Make sure the compiler works on a very simple example. Type in the following test.c program using your favorite** ASCII** editor:
|
|
419
|
+
```c
|
|
420
|
+
char test;
|
|
421
|
+
|
|
422
|
+
void main(void) {
|
|
423
|
+
test=0;
|
|
424
|
+
}
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
** Compile this using the following command:"sdcc -c test.c". If all goes well, the compiler will generate a test.asm and test.rel file. Congratulations, you've just compiled your first program with SDCC. We used the -c option to tell SDCC not to link the generated code, just to keep things simple for this step.**
|
|
428
|
+
|
|
429
|
+
** The next step is to try it with the linker. Type in"sdcc test.c** "**. If all goes well the compiler will link with the libraries and produce a test.ihx output file. If this step fails (no test.ihx, and the linker generates warnings), then the problem is most likely that** SDCC** cannot find the** /** usr/local/share/sdcc/lib directory (see** section Install Trouble-shooting** Install trouble-shooting for suggestions).**
|
|
430
|
+
|
|
431
|
+
** The final test is to ensure** SDCC** can use the** standard** header files and libraries. Edit test.c and change it to the following:
|
|
432
|
+
```c
|
|
433
|
+
#include <string.h>
|
|
434
|
+
|
|
435
|
+
char str1[10];
|
|
436
|
+
|
|
437
|
+
void main(void) {
|
|
438
|
+
strcpy(str1, "testing");
|
|
439
|
+
}
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
** Compile this by typing"sdcc test.c"**. This should generate a test.ihx output file, and it should give no warnings such as not finding the string.h file. If it cannot find the string.h file, then the problem is that** SDCC** cannot find the /usr/local/share/sdcc/include directory (see the** section Install Trouble-shooting** Install trouble-shooting section for suggestions).** Use option **--print-search-dirs** range none pageformat default --print-search-dirs to find exactly where SDCC is looking for the include and lib files.
|
|
443
|
+
|
|
444
|
+
### Install Trouble-shooting range none pageformat default Install trouble-shooting
|
|
445
|
+
|
|
446
|
+
#### If SDCC does not build correctly
|
|
447
|
+
|
|
448
|
+
A thing to try is starting from scratch by unpacking the.tgz source package again in an empty directory. Configure it like:
|
|
449
|
+
|
|
450
|
+
**`./configure 2>&1 | tee configure.log`**
|
|
451
|
+
|
|
452
|
+
and build it like:
|
|
453
|
+
|
|
454
|
+
**`make 2>&1 | tee make.log`**
|
|
455
|
+
|
|
456
|
+
If anything goes wrong, you can review the log files to locate the problem. Or a relevant part of this can be attached to an email that could be helpful when requesting help from the mailing list.
|
|
457
|
+
|
|
458
|
+
#### What the"./configure" does
|
|
459
|
+
|
|
460
|
+
The"./configure" command is a script that analyzes your system and performs some configuration to ensure the source package compiles on your system. It will take a few minutes to run, and will compile a few tests to determine what compiler features are installed.
|
|
461
|
+
|
|
462
|
+
#### What the" make" does
|
|
463
|
+
|
|
464
|
+
This runs the GNU make tool, which automatically compiles all the source packages into the final installed binary executables.
|
|
465
|
+
|
|
466
|
+
#### What the" make install” command does.
|
|
467
|
+
|
|
468
|
+
This will install the compiler, other executables libraries and include files into the appropriate directories. See sections Install paths, Search Paths about install and search paths.
|
|
469
|
+
On most systems you will need super-user privileges to do this.
|
|
470
|
+
|
|
471
|
+
### Components of SDCC
|
|
472
|
+
|
|
473
|
+
SDCC is not just a compiler, but a collection of tools by various developers. These include linkers, assemblers, simulators and other components. Here is a summary of some of the components. Note that the included simulator and assembler have separate documentation which you can find in the source package in their respective directories. As SDCC grows to include support for other processors, other packages from various developers are included and may have their own sets of documentation.
|
|
474
|
+
|
|
475
|
+
You might want to look at the files which are installed in <installdir>. At the time of this writing, we find the following programs, among others, for gcc-builds:
|
|
476
|
+
|
|
477
|
+
In <installdir>/bin:
|
|
478
|
+
|
|
479
|
+
- sdcc - The compiler.
|
|
480
|
+
- sdcpp - The C preprocessor.
|
|
481
|
+
- sdas8051 - The assembler for 8051 type processors.
|
|
482
|
+
- sdas390 - The assembler for DS80C390 processor.
|
|
483
|
+
- sdasz80 **,** sdasgb - The Z80 and GameBoy Z80 assemblers.
|
|
484
|
+
- sdas6808 - The 6808 assembler.
|
|
485
|
+
- sdasstm8 - The STM8 assembler.
|
|
486
|
+
- sdld -The linker for 8051 and STM8 type processors.
|
|
487
|
+
- sdldz80 **,** sdldgb - The Z80 and GameBoy Z80 linkers.
|
|
488
|
+
- sdld6808 - The 6808 linker.
|
|
489
|
+
- ucsim_51, s51 - The ucSim 8051 simulator.
|
|
490
|
+
- ucsim_m68hc08 - The ucSim 6808 simulator.
|
|
491
|
+
- ucsim_stm8 - The ucSim STM8 simulator.
|
|
492
|
+
- ucsim_z80 - The ucSim Z80 simulator.
|
|
493
|
+
- sdcdb - The source debugger.
|
|
494
|
+
- sdar, sdranlib, sdnm, sdobjcopy - The sdcc archive managing and indexing utilites.
|
|
495
|
+
- packihx - A tool to pack (compress) Intel hex files.
|
|
496
|
+
- makebin - A tool to convert Intel Hex file to a binary and GameBoy binary image file format.
|
|
497
|
+
In <installdir>/share/sdcc/include
|
|
498
|
+
|
|
499
|
+
- the include files
|
|
500
|
+
In <installdir>/share/sdcc/non-free/include
|
|
501
|
+
|
|
502
|
+
- the non-free include files
|
|
503
|
+
In <installdir>/share/sdcc/lib
|
|
504
|
+
|
|
505
|
+
- the src and target subdirectories with the precompiled relocatables.
|
|
506
|
+
In <installdir>/share/sdcc/non-free/lib
|
|
507
|
+
|
|
508
|
+
- the src and target subdirectories with the non-free precompiled relocatables.
|
|
509
|
+
In <installdir>/share/sdcc/doc
|
|
510
|
+
|
|
511
|
+
- the documentation
|
|
512
|
+
|
|
513
|
+
#### sdcc - The Compiler
|
|
514
|
+
|
|
515
|
+
This is the actual compiler, it in turn uses the C-preprocessor and invokes the assembler and linkage editor.
|
|
516
|
+
|
|
517
|
+
#### sdcpp - The C-Preprocessor range none pageformat default Preprocessor
|
|
518
|
+
|
|
519
|
+
The preprocessor range none pageformat default sdcpp (preprocessor) is a modified version of the GNU cpp range none pageformat default cpp|see sdcpp preprocessor http://gcc.gnu.org/. The C preprocessor is used to pull in #include sources, process #ifdef statements, #defines and so on.
|
|
520
|
+
|
|
521
|
+
#### sdas, sdld - The Assemblers and Linkage Editors
|
|
522
|
+
|
|
523
|
+
This is a set of retargettable assemblers and linkage editors, which was developed by Alan Baldwin. John Hartman created the version for 8051, and I (Sandeep) have made some enhancements and bug fixes for it to work properly with SDCC.
|
|
524
|
+
|
|
525
|
+
SDCC used an about 1998 branch of asxxxx version 2.0 which unfortunately is not compatible with the more advanced (f.e. macros, more targets) ASxxxx Cross Assemblers nowadays available from Alan Baldwin https://shop-pdp.net/. In 2009 Alan made his ASxxxx Cross Assemblers version 5.0 available under the GPL license (GPLv3 or later), so a reunion is now a work in progress. Thanks Alan!
|
|
526
|
+
|
|
527
|
+
#### ucsim_51, ucsim_z80, ucsim_stm8 etc.- The Simulators
|
|
528
|
+
|
|
529
|
+
ucsim_51 (or s51) range none pageformat default s51 (simulator), ucsim_z80 range none pageformat default sz80 (simulator) ucsim_m68hc08 range none pageformat default shc08 (simulator) and ucsim_stm8 range none pageformat default sstm8 (simulator), as well as similarly named programs provided with SDCC, are free open source simulators developed by Daniel Drotos. The simulators are built as part of the build process. For more information visit Daniel's web site at: http://mazsola.iit.uni-miskolc.hu/~drdani/embedded/s51. It currently supports the core mcs51, the Dallas DS80C390, the Phillips XA51 family, the Z80, 6808 the STM8 and various others.
|
|
530
|
+
|
|
531
|
+
#### sdcdb - Source Level Debugger
|
|
532
|
+
|
|
533
|
+
SDCDB range none pageformat default SDCDB (debugger) is the companion source level debugger. More about SDCDB in section Debugging with SDCDB. The current version of the debugger uses Daniel's Simulator S51 range none pageformat default s51 (simulator), but can be easily changed to use other simulators.
|