* support/regression/tests/bug1057979.c:
[fw/sdcc] / doc / sdccman.lyx
index cebe9bfd2a6c9d359a476c21d3592ffe1ff920cd..38436d89dcbbdda8adad09f1efc17ba1e055ee0b 100644 (file)
@@ -104,11 +104,11 @@ SDCC Compiler User Guide
 \begin_layout Date
 
 \size normal
-SDCC 2.8.0
+SDCC 2.8.4
 \size footnotesize
 
 \newline
-$Date::             
+$Date::            $ 
 \newline
 $Revision$
 \end_layout
@@ -1158,10 +1158,22 @@ b = !b; /* toggles b */
 In previous versions, both forms would have toggled the bit.
 \end_layout
 
-\begin_layout Standard
+\begin_layout Itemize
+in older versions, the preprocessor was always called with -std=c99 regardless
+ of the --std-xxx setting.
+ This is no longer true, and can cause compilation failures on code built
+ with --std-c89 but using c99 preprocessor features, such as one-line (//)
+ comments
+\end_layout
 
-\emph on
-<pending: more incompatibilities?>
+\begin_layout Itemize
+in versions older then 2.8.4 the pic16 *printf() and printf_tiny() library
+ functions supported undocumented and not standard compliant 'b' binary
+ format specifier ("%b", "%hb" and "%lb").
+ The 'b' specifier is now disabled by default.
+ It can be enabled by defining BINARY_SPECIFIER macro in files device/lib/pic16/
+libc/stdio/vfprintf.c and device/lib/pic16/libc/stdio/printf_tiny.c and recompilin
+g the library.
 \end_layout
 
 \begin_layout Section
@@ -1682,6 +1694,24 @@ status collapsed
  Lower runtime footprint.
 \end_layout
 
+\begin_layout List
+\labelwidthstring 00.00.0000
+-
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-without-ccache Do not use ccache even if available
+\end_layout
+
 \begin_layout Standard
 Furthermore the environment variables CC, CFLAGS, ...
  the tools and their arguments can be influenced.
@@ -8028,6 +8058,11 @@ linkOption[,linkOption]
 
 \end_inset
 
+
+\begin_inset LatexCommand \label{lyx:-Wl option}
+
+\end_inset
+
 ...
  Pass the linkOption to the linker.
  If a bootloader is used an option like 
@@ -8040,6 +8075,8 @@ linkOption[,linkOption]
 \end_inset
 
  would be typical to set the start of the code segment.
+ Either use the double quotes around this option or use no space (e.g.
+ -Wl-bCSEG=0x1000).
  See also #pragma constseg and #pragma codeseg in section 
 \begin_inset LatexCommand \ref{sec:Pragmas}
 
@@ -10828,6 +10865,11 @@ status collapsed
 
 \end_inset
 
+
+\begin_inset LatexCommand \label{lyx:-codeseg}
+
+\end_inset
+
 \InsetSpace ~
 <Name> The name to be used for the code
 \begin_inset LatexCommand \index{code}
@@ -13203,6 +13245,31 @@ The xdata storage class declares a variable that can reside anywhere in
 \end_inset
 
 
+\end_layout
+
+\begin_layout Section
+Other SDCC language extensions
+\begin_inset LatexCommand \index{Other SDCC language extensions}
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Binary constants
+\end_layout
+
+\begin_layout Standard
+SDCC supports the use of binary constants, such as 0b01100010.
+ This feature is only enabled when the compiler is invoked using --std-sdccxx.
+\end_layout
+
+\begin_layout Standard
+\begin_inset VSpace bigskip
+\end_inset
+
+
 \end_layout
 
 \begin_layout Section
@@ -23592,9 +23659,11 @@ SiLabs C8051F120 example
 \newline
 Usually the hardware uses some sfr (an output port or an internal sfr) to
  select a bank and put it in the banked area of the memory map.
- Because the selected bank usually becomes active immediately you cannot
- jump call directly from one bank to another and need to use a so-called
- trampoline in the common area.
+ The selected bank usually becomes active immediately upon assignment to
+ this sfr and when running inside a bank it will switch out this code it
+ is currently running.
+ Therefor you cannot jump or call directly from one bank to another and
+ need to use a so-called trampoline in the common area.
  For SDCC an example trampoline is in crtbank.asm and you may need to change
  it to your 8051 derivative or schematic.
  The presented code is written for the C8051F120.
@@ -23603,11 +23672,18 @@ Usually the hardware uses some sfr (an output port or an internal sfr) to
 \newline
 When calling a banked function
  SDCC will put the LSB of the functions address in register R0, the MSB
- in R1 and the bank in R2 and then call this trampoline __sdcc_banked_call.
+ in R1 and the bank in R2 and then call this trampoline 
+\emph on
+__sdcc_banked_call
+\emph default
+.
  The current selected bank is saved on the stack, the new bank is selected
  and an indirect jump is made.
- When the banked function returns it jumps to __sdcc_banked_ret which restores
- the previous bank and returns to the caller.
+ When the banked function returns it jumps to 
+\emph on
+__sdcc_banked_ret
+\emph default
+ which restores the previous bank and returns to the caller.
 \end_layout
 
 \begin_layout Subsubsection
@@ -23622,10 +23698,22 @@ When writing banked software using SDCC you need to use some special keywords
 
 \newline
 To create a function
- that can be called from another bank it requires the keyword banked.
+ that can be called from another bank it requires the keyword 
+\emph on
+banked
+\emph default
+
+\begin_inset LatexCommand \index{banked}
+
+\end_inset
+
+.
  The caller must see this in the prototype of the callee and the callee
  needs it for a proper return.
- Called functions within the same bank as the caller do not need the banked
+ Called functions within the same bank as the caller do not need the 
+\emph on
+banked
+\emph default
  keyword nor do functions in the common area.
  Beware: SDCC does not know or check if functions are in the same bank.
  This is your responsibility!
@@ -23644,8 +23732,30 @@ Normally all functions you write end up in
 Functions that need to be in a switched bank must be put in a named segment.
  The name can be mostly anything upto eight characters (e.g.
  BANK1).
- To do this you either use --codeseg BANK1 on the command line when compiling
- or #pragma codeseg BANK1 at the top of the C source file.
+ To do this you either use -
+\begin_inset ERT
+status collapsed
+
+\begin_layout Standard
+
+
+\backslash
+/
+\end_layout
+
+\end_inset
+
+-codeseg BANK1 (See 
+\begin_inset LatexCommand \ref{lyx:-codeseg}
+
+\end_inset
+
+) on the command line when compiling or #pragma codeseg BANK1 (See 
+\begin_inset LatexCommand \ref{sec:Pragmas}
+
+\end_inset
+
+) at the top of the C source file.
  The segment name always applies to the whole source file and generated
  object so functions for different banks need to be defined in different
  source files.
@@ -23655,7 +23765,12 @@ Functions that need to be in a switched bank must be put in a named segment.
 When linking your objects you need to tell the linker where
  to put your segments.
  To do this you use the following command line option to SDCC: -Wl-b BANK1=0x180
-00.
+00 (See 
+\begin_inset LatexCommand \ref{lyx:-Wl option}
+
+\end_inset
+
+).
  This sets the virtual start address of this segment.
  It sets the banknumber to 0x01 and maps the bank to 0x8000 and up.
  The linker will not check for overflows, again this is your responsibility.
@@ -23793,8 +23908,6 @@ The HC08 port passes the regression test suite (see section
 \end_inset
 
 
-\newpage
-
 \end_layout
 
 \begin_layout Section
@@ -23860,21 +23973,29 @@ Currently supported devices include:
 \end_layout
 
 \begin_layout Standard
-16F: 627, 627a, 628, 628a, 630, 636, 639, 648a, 676, 684, 685, 687, 688,
- 689, 690
+16CR: 620a, 73, 74, 76, 77
+\end_layout
+
+\begin_layout Standard
+16F: 616, 627, 627a, 628, 628a, 630, 636, 639, 648, 648a, 676, 684, 685,
+ 687, 688, 689, 690
 \end_layout
 
 \begin_layout Standard
-16F: 716, 72, 73, 737, 74, 76, 767, 77, 777, 785
+16F: 716, 72, 73, 737, 74, 747, 76, 767, 77, 777, 785
 \end_layout
 
 \begin_layout Standard
 16F: 818, 819, 84, 84a, 87, 870, 871, 872, 873, 873a, 874, 874a, 876, 876a,
- 877, 877a, 88
+ 877, 877a, 88, 886, 887
 \end_layout
 
 \begin_layout Standard
-16F: 913, 914, 916, 917
+16F: 913, 914, 916, 917, 946
+\end_layout
+
+\begin_layout Standard
+26HV: 626, 785
 \end_layout
 
 \begin_layout Standard
@@ -24369,7 +24490,7 @@ Function arguments
 
 \begin_layout Standard
 Functions with variable argument lists (like printf) are not yet supported.
- Similarly, taking the argument of the first argument passed into a function
+ Similarly, taking the address of the first argument passed into a function
  does not work: It is currently passed in WREG and has no address...
 \end_layout
 
@@ -24434,21 +24555,35 @@ The PIC16 port adds support for Microchip
 \end_layout
 
 \begin_layout Standard
-18F: 2220, 2221, 2320, 2321, 2331, 2431, 2455, 24j10, 2525, 2550, 25j10,
- 2620
+18F: 2220, 2221, 2320, 2321, 2331, 2420, 2423, 2431, 2455, 2480, 24j10
+\end_layout
+
+\begin_layout Standard
+18F: 2520, 2523, 2525, 2550, 2580, 2585, 25j10, 2620, 2680, 2682, 2685
+\end_layout
+
+\begin_layout Standard
+18F: 4220, 4221, 4320, 4321, 4331, 4420, 4423, 4431, 4455, 4480, 44j10
+\end_layout
+
+\begin_layout Standard
+18F: 4520, 4523, 4525, 4550, 4580, 4585, 45j10, 4620, 4680, 4682, 4685
 \end_layout
 
 \begin_layout Standard
-18F: 4220, 4221, 4320, 4321, 4331, 4431, 4455, 44j10, 4520, 4525, 4550,
- 45j10, 4620
+18F: 6520, 6585, 6620, 6680, 6720
 \end_layout
 
 \begin_layout Standard
-18F: 6520, 6620, 6680, 6720
+18F: 8520, 8585, 8620, 8680, 8720
 \end_layout
 
 \begin_layout Standard
-18F: 8520, 8620, 8680, 8720
+A list of supported devices is also available via '
+\family typewriter
+sdcc -mpic16 -plist
+\family default
+'.
 \end_layout
 
 \begin_layout Subsection
@@ -24709,7 +24844,7 @@ status collapsed
 
 \end_inset
 
--optimize-goto Try to use (conditional) BRA instead of GOTO.
+-no-optimize-goto Do not use (conditional) BRA instead of GOTO.
 \end_layout
 
 \begin_layout Description
@@ -26196,6 +26331,15 @@ Add DEVICE to
 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:
+\end_layout
+
+\begin_deeper
 \begin_layout Enumerate
 Adjust 
 \family typewriter
@@ -26218,6 +26362,17 @@ usart
 .
 \end_layout
 
+\begin_layout Enumerate
+Adjust 
+\family typewriter
+/path/to/sdcc/device/include/pic16/adc.h
+\newline
+
+\family default
+Add the new devices to the correct ADC style class.
+\end_layout
+
+\end_deeper
 \begin_layout Enumerate
 Edit 
 \family typewriter
@@ -26240,16 +26395,16 @@ at the right place (keep it sorted).
 \begin_layout Enumerate
 Edit 
 \family typewriter
-/path/to/sdcc/src/pic16/devices.inc
+/path/to/sdcc/device/include/pic16devices.txt
+\newline
+
 \family default
-.
- Copy and modify an existing entry and insert it at the correct place (keep
- the file sorted).
- The file is hardly documented, look at the entries for the 18f2221...
+Copy and modify an existing entry or create a new one and insert it at the
+ correct place (keep the file sorted).
 \end_layout
 
 \begin_layout Enumerate
-Recompile SDCC, including the pic16 libraries.
+Recompile the pic16 libraries.
 \end_layout
 
 \begin_layout Subsection