and on how to add support for new devices, and documented known
problems with the extended instruction set including a workaround
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5256
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2008-11-02 Raphael Neider <rneider AT web.de>
+
+ * doc/sdccman.lyx: updated the sections on the library build process
+ and on how to add support for new devices, and documented known
+ problems with the extended instruction set including a workaround
+
2008-11-01 Raphael Neider <rneider AT web.de>
* device/include/pic16/adc.h,
2008-11-01 Raphael Neider <rneider AT web.de>
* device/include/pic16/adc.h,
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
Currently supported devices include:
\end_layout
Currently supported devices include:
\end_layout
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
An up-to-date list of currently supported devices can be obtained via
\family typewriter
sdcc -mpic14 -phelp foo.c
An up-to-date list of currently supported devices can be obtained via
\family typewriter
sdcc -mpic14 -phelp foo.c
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
-18F: 2220, 2221, 2320, 2321, 2331, 2410, 2420, 2423, 2431, 2450, 2455, 2480, 24j10
+18F: 2220, 2221, 2320, 2321, 2331, 2410, 2420, 2423, 2431, 2450, 2455, 2480,
+ 24j10
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
-18F: (2510,) 2515, 2520, 2523, 2525, 2550, 2580, 2585, 25j10, 2610, 2620, 2680, 2682, 2685
+18F: (2510,) 2515, 2520, 2523, 2525, 2550, 2580, 2585, 25j10, 2610, 2620,
+ 2680, 2682, 2685
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
-18F: 4220, 4221, 4320, 4321, 4331, 4410, 4420, 4423, 4431, 4450, 4455, 4480, 44j10
+18F: 4220, 4221, 4320, 4321, 4331, 4410, 4420, 4423, 4431, 4450, 4455, 4480,
+ 44j10
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
-18F: 4510, 4515, 4520, 4523, 4525, 4550, 4580, 4585, 45j10, 4610, 4620, 4680, 4682, 4685
+18F: 4510, 4515, 4520, 4523, 4525, 4550, 4580, 4585, 45j10, 4610, 4620,
+ 4680, 4682, 4685
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
-A list of supported devices is also available via '
+\noindent
+An up-to-date list of supported devices is also available via '
\family typewriter
sdcc -mpic16 -plist
\family default
\family typewriter
sdcc -mpic16 -plist
\family default
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
In addition the following macros are defined when calling assembler:
\end_layout
In addition the following macros are defined when calling assembler:
\end_layout
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
This feature allows for linking with specific libraries withoug having to
explicit name them in the command line.
Note that the
This feature allows for linking with specific libraries withoug having to
explicit name them in the command line.
Note that the
\begin_layout Subsection
Libraries
\begin_layout Subsection
Libraries
+\begin_inset LatexCommand \label{sub:pic16Libraries}
+
+\end_inset
+
+
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
Libraries are created with gplib which is part of the gputils package
\begin_inset LatexCommand \url{http://sourceforge.net/projects/gputils}
Libraries are created with gplib which is part of the gputils package
\begin_inset LatexCommand \url{http://sourceforge.net/projects/gputils}
\begin_layout Standard
Before using SDCC/pic16 there are some libraries that need to be compiled.
\begin_layout Standard
Before using SDCC/pic16 there are some libraries that need to be compiled.
- This process is not done automatically by SDCC since not all users use
- SDCC for pic16 projects.
- So each user should compile the libraries separately.
-\end_layout
-
-\begin_layout Standard
-The steps to compile the pic16 libraries under Linux and Mac OS X are:
+ This process is done automatically if gputils are found at SDCC's compile
+ time.
+ Should you require to rebuild the pic16 libraries manually, these are the
+ steps required to do so under Linux or Mac OS X (cygwin might work as well,
+ but is untested):
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
-./configure
-\end_layout
-
-\begin_layout LyX-Code
-make
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
su -c 'make install' # install the libraries, you need the root password
\end_layout
su -c 'make install' # install the libraries, you need the root password
\end_layout
+\begin_layout LyX-Code
+cd ../..
+\end_layout
+
\begin_layout Standard
If you need to install the headers too, do:
\end_layout
\begin_layout Standard
If you need to install the headers too, do:
\end_layout
su -c 'make install' # install the headers, you need the root password
\end_layout
su -c 'make install' # install the headers, you need the root password
\end_layout
-\begin_layout Standard
-There exist a special target to build the I/O libraries.
- This target is not automatically build because it will build the I/O library
- for
-\emph on
-every
-\emph default
- supported device.
- This way building will take quite a lot of time.
- Users are advised to edit the
-\series bold
-device/lib/pic16/pics.build
-\series default
- file and then execute:
-\end_layout
-
-\begin_layout LyX-Code
-make lib-io
-\end_layout
-
\begin_layout Subsection
Adding New Devices to the Port
\end_layout
\begin_layout Subsection
Adding New Devices to the Port
\end_layout
\begin_layout Standard
Adding support for a new 16
\begin_inset ERT
\begin_layout Standard
Adding support for a new 16
\begin_inset ERT
\family typewriter
/path/to/sdcc/device/lib/pic16/pics.all
\family default
\family typewriter
/path/to/sdcc/device/lib/pic16/pics.all
\family default
- (and
-\family typewriter
-.build
-\family default
-).
\newline
Note: No 18f prefix here!
\end_layout
\begin_layout Enumerate
\newline
Note: No 18f prefix here!
\end_layout
\begin_layout Enumerate
-Set up the I/O library by doing
-\series bold
-one
-\series default
- of the following:
+Edit
+\family typewriter
+/path/to/sdcc/device/include/pic16/adc.h
+\newline
+
+\family default
+Add the new devices to the correct ADC style class (depending on the number
+ of ADC channels).
+\newline
+Do not touch
+\family typewriter
+adc.h
+\family default
+ if the device does not offer any ADC at all.
-/path/to/sdcc/device/lib/pic16/libio/*.ignore
+/path/to/sdcc/device/include/pic16/pic18fregs.h
-Add your DEVICE if it does not compile in
-\family typewriter
-adc
-\family default
-,
+The file format is self-explanatory, just add
+\newline
+
-i2c
-\family default
-, or
+#elif defined(picDEVICE)
+\newline
+#
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+
+\backslash
+
+\end_layout
+
+\end_inset
+
+include <picDEVICE.h>
+
+\newline
+at the right place (keep the file sorted, please).
\end_layout
\begin_layout Enumerate
\end_layout
\begin_layout Enumerate
-/path/to/sdcc/device/include/pic16/adc.h
+/path/to/sdcc/device/include/pic16devices.txt
-Add the new devices to the correct ADC style class.
+Copy and modify an existing entry or create a new one and insert it at the
+ correct place (keep the file sorted, please).
-/path/to/sdcc/device/include/pic16/pic18fregs.h
+/path/to/sdcc/device/lib/pic16/libdev/Makefile.am
-.
-\newline
-The file format is self-explanatory, just add
+Copy an existing entry and adjust the device name.
+\end_layout
+\begin_layout Enumerate
+Add the device to
-#elif defined(picDEVICE)
-\newline
-# include <picDEVICE.h>
+/path/to/sdcc/device/lib/pic16/libio/Makefile.am
-at the right place (keep it sorted).
+Copy the record from the 18f2220 and adjust the device name.
+\newline
+If the new device
+ does not offer ADC, I
+\begin_inset Formula $^{\text{2}}$
+\end_inset
+
+C, and/or (E)USART functionality as assumed by the library, remove the lines
+ with references to
+\family typewriter
+adc/*.c
+\family default
+,
+\family typewriter
+usart/*.c
+\family default
+, or
+\family typewriter
+usart/*.c
+\family default
+, respectively.
\end_layout
\begin_layout Enumerate
\end_layout
\begin_layout Enumerate
-/path/to/sdcc/device/include/pic16devices.txt
+libdev/Makefile.in
+\family default
+ and
+\family typewriter
+libio/Makefile.in
+\family default
+ using
+\family typewriter
+./bootstrap.sh
-Copy and modify an existing entry or create a new one and insert it at the
- correct place (keep the file sorted).
+
+\newline
+in
+\family typewriter
+/path/to/sdcc/device/lib/pic16
+\family default
+.
\end_layout
\begin_layout Enumerate
\end_layout
\begin_layout Enumerate
-Recompile the pic16 libraries.
+Recompile the pic16 libraries as described in
+\begin_inset LatexCommand \ref{sub:pic16Libraries}
+
+\end_inset
+
+.
\end_layout
\begin_layout Subsection
\end_layout
\begin_layout Subsection
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
Generic pointer are read and written with a set of library functions which
read/write 1, 2, 3, 4 bytes.
\end_layout
Generic pointer are read and written with a set of library functions which
read/write 1, 2, 3, 4 bytes.
\end_layout
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="7">
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="7">
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
Currently implemented there are 3 types of streams defined:
\end_layout
\begin_layout Standard
Currently implemented there are 3 types of streams defined:
\end_layout
\begin_layout Standard
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="4">
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="4" columns="4">
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
The stream identifiers are declared as macros in the stdio.h header.
\end_layout
\begin_layout Standard
The stream identifiers are declared as macros in the stdio.h header.
\end_layout
\begin_layout Standard
In the libc library there exist the functions that are used to write to
each of the above streams.
These are
In the libc library there exist the functions that are used to write to
each of the above streams.
These are
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
The prototypes for these names are defined in the header file
\emph on
signal.h
The prototypes for these names are defined in the header file
\emph on
signal.h
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
In order to simplify signal handling, a number of macros is provided:
\end_layout
In order to simplify signal handling, a number of macros is provided:
\end_layout
+\begin_layout Subsubsection
+Extended Instruction Set
+\end_layout
+
+\begin_layout Standard
+The PIC16 port emits code which is incompatible with the extended instruction
+ set available with many newer devices.
+ Make sure to always explicitly disable it, usually using
+\end_layout
+
+\begin_layout Standard
+
+\family typewriter
+static __code char __at(__CONFIG4L) conf4l = /* more flags & */ _XINST_OFF_4L;
+\end_layout
+
-The PIC16 Port currently does not pass SDCC's regression test
+\noindent
+Some devices (namely 18f2455, 18f2550, 18f4455, and 18f4550) use _ENHCPU_OFF_4L
+ instead of _XINST_OFF_4L.
+\end_layout
+
+\begin_layout Subsubsection
+Regression Tests
+\end_layout
+
+\begin_layout Standard
+The PIC16 port currently passes most but not all of the tests in SDCC's
+ regression test
\begin_inset LatexCommand \index{Regression test (PIC16)}
\end_inset
\begin_inset LatexCommand \index{Regression test (PIC16)}
\end_inset
-) and thus the snapshot build regression tests for the PIC16 target are
- currently disabled for all hosts
-\emph on
-.
+), thus no automatic regression tests are currently performed for the PIC16
+ target.
\end_layout
\begin_layout Chapter
\end_layout
\begin_layout Chapter