From 38c1a3ffff99645a8c0811254e9c3b68bb8caa0d Mon Sep 17 00:00:00 2001 From: frief Date: Thu, 25 Jan 2007 14:15:21 +0000 Subject: [PATCH] * support/regression/tests/swap.c: 64 bit hosts failed * doc/sdccman.lyx: added preliminary mcs51 printf feature matrix git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4596 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 5 + doc/sdccman.lyx | 954 ++++++++++++++++++++++++++++---- support/regression/tests/swap.c | 9 +- 3 files changed, 857 insertions(+), 111 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fc1679e..6b69ebc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-01-25 Frieder Ferlemann + + * support/regression/tests/swap.c: 64 bit hosts failed + * doc/sdccman.lyx: added preliminary mcs51 printf feature matrix + 2007-01-25 Raphael Neider * src/pic/pcode.c (sameBank,FixRegisterBanking): optimize banksels diff --git a/doc/sdccman.lyx b/doc/sdccman.lyx index eb16337e..05f928a9 100644 --- a/doc/sdccman.lyx +++ b/doc/sdccman.lyx @@ -15993,159 +15993,883 @@ Stdclib functions (puts, printf, strcat etc.) \layout Subsubsection +\layout Paragraph + +getchar(), putchar() +\layout Standard + + +\begin_inset LatexCommand \index{} + +\end_inset + +As usual on embedded systems you have to provide your own +\family typewriter +getchar() +\begin_inset LatexCommand \index{getchar()} + +\end_inset + + +\family default +and +\family typewriter +putchar() +\begin_inset LatexCommand \index{putchar()} + +\end_inset + + +\family default + routines. + SDCC does not know whether the system connects to a serial line with or + without handshake, LCD, keyboard or other device. + And whether a +\family typewriter +lf +\family default + to +\family typewriter +crlf +\family default + conversion within +\family typewriter +putchar() +\family default + is intended. + You'll find examples for serial routines f.e. + in sdcc/device/lib. + For the mcs51 this minimalistic polling +\family typewriter +putchar() +\family default + routine might be a start: +\layout Verse + + +\family typewriter +void putchar (char c) { +\newline +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +while (!TI)\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ + /* assumes UART is initialized */ +\newline +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +; +\newline +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +TI = 0; +\newline +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +\SpecialChar ~ +SBUF = c; +\newline +} +\layout Paragraph + +printf() +\layout Standard + +The default +\family typewriter + printf() +\begin_inset LatexCommand \index{printf()} + +\end_inset + + +\family default + implementation in +\family typewriter + printf_large.c +\family default + does not support float (except on ds390). + To enable this recompile it with the option +\emph on +- +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +/ +\end_inset + +DUSE_FLOATS=1 +\begin_inset LatexCommand \index{USE\_FLOATS} + +\end_inset + + +\emph default + on the command line. + Use +\emph on + - +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +/ +\end_inset + +-model-large +\begin_inset LatexCommand \index{-\/-model-large} + +\end_inset + + +\emph default + for the mcs51 port, since this uses a lot of memory. +\layout Standard + +If you're short on code memory you might want to use +\family typewriter +printf_small() +\begin_inset LatexCommand \index{printf\_small()} + +\end_inset + + +\family default + +\emph on +instead +\emph default + of +\family typewriter + printf(). + +\family default + For the mcs51 there additionally are assembly versions +\family typewriter +printf_tiny() +\begin_inset LatexCommand \index{printf\_tiny() (mcs51)} + +\end_inset + + +\family default + (subset of printf using less than 270 bytes) and +\family typewriter +printf_fast() +\begin_inset LatexCommand \index{printf\_fast() (mcs51)} + +\end_inset + + +\family default +and +\family typewriter + printf_fast_f() +\begin_inset LatexCommand \index{printf\_fast\_f() (mcs51)} + +\end_inset + + +\family default + (floating-point aware version of printf_fast) which should fit the requirements + of many embedded systems (printf_fast() can be customized by unsetting + #defines to +\emph on +not +\emph default + support long variables and field widths). + Be shure to only use only one of these printf options within a project. +\newline + +\layout Standard + +Feature matrix of different +\emph on +printf +\emph default + options on mcs51. +\layout Standard + + +\begin_inset Tabular + + + + + + + + + + + +\begin_inset Text + +\layout Standard + + +\series bold +\size large +mcs51 +\end_inset + + +\begin_inset Text + +\layout Standard + +printf +\begin_inset LatexCommand \index{printf} + +\end_inset + + +\end_inset + + +\begin_inset Text + +\layout Standard + +printf +\size scriptsize +USE_FLOATS=1 +\end_inset + + +\begin_inset Text + +\layout Standard + +printf_small +\end_inset + + +\begin_inset Text + +\layout Standard + +printf_fast +\end_inset + + +\begin_inset Text + +\layout Standard + +printf_fast_f +\end_inset + + +\begin_inset Text + +\layout Standard + +printf_tiny +\end_inset + + + + +\begin_inset Text + +\layout Standard + +filename +\end_inset + + +\begin_inset Text + +\layout Standard + + +\size scriptsize +printf_large.c +\end_inset + + +\begin_inset Text + +\layout Standard + + +\size scriptsize +printf_large.c +\end_inset + + +\begin_inset Text + +\layout Standard + + +\size scriptsize +printfl.c +\end_inset + + +\begin_inset Text + +\layout Standard + + +\size scriptsize +printf_fast.c +\end_inset + + +\begin_inset Text + +\layout Standard + + +\size scriptsize +printf_fast_f.c +\end_inset + + +\begin_inset Text + +\layout Standard + + +\size scriptsize +printf_tiny.c +\end_inset + + + + +\begin_inset Text + +\layout Standard + +code size (small\SpecialChar ~ +/\SpecialChar ~ +large) in\SpecialChar ~ +kByte +\end_inset + + +\begin_inset Text + +\layout Standard + +1.4 / 2.0 +\end_inset + + +\begin_inset Text + +\layout Standard + +2.8 / 3.7 +\end_inset + + +\begin_inset Text + +\layout Standard + +0.45 / 0.47 (+ _ltoa) +\end_inset + + +\begin_inset Text + +\layout Standard + +1.2 / 1.2 +\end_inset + + +\begin_inset Text + +\layout Standard + +1.6 / 1.6 +\end_inset + + +\begin_inset Text + +\layout Standard + +0.26 / 0.26 +\end_inset + + + + +\begin_inset Text + +\layout Standard + +formats +\end_inset + + +\begin_inset Text + +\layout Standard + +cd(f)i +\emph on +o +\emph default +psx +\end_inset + + +\begin_inset Text + +\layout Standard + + +\family roman +\series medium +\shape up +\size normal +\emph off +\bar no +\noun off +\color none +cd +\family default +\series default +\shape default +\size default +\emph default +\bar default +\noun default +\color default +f +\family roman +\series medium +\shape up +\size normal +\emph off +\bar no +\noun off +\color none +i +\family default +\series default +\shape default +\size default +\emph on +\bar default +\noun default +\color default +o +\family roman +\series medium +\shape up +\size normal +\emph off +\bar no +\noun off +\color none +psx +\end_inset + + +\begin_inset Text + +\layout Standard + +c +\family roman +\series medium +\shape up +\size normal +\emph off +\bar no +\noun off +\color none +d +\family default +\series default +\shape default +\size default +\emph on +\bar default +\noun default +\color default +o +\family roman +\series medium +\shape up +\size normal +\emph off +\bar no +\noun off +\color none +s +\family default +\series default +\shape default +\size default +\emph default +\bar default +\noun default +\color default +x +\end_inset + + +\begin_inset Text + +\layout Standard + +cdsx +\end_inset + + +\begin_inset Text + +\layout Standard + +cdfsx +\end_inset + + +\begin_inset Text + +\layout Standard + +cdsx +\end_inset + + + + +\begin_inset Text + +\layout Standard + +long (32 bit) support +\end_inset + + +\begin_inset Text + +\layout Standard + +x +\end_inset + + +\begin_inset Text + +\layout Standard + +x +\end_inset + + +\begin_inset Text + +\layout Standard + +x +\end_inset + + +\begin_inset Text + +\layout Standard + +x/(-) +\end_inset + + +\begin_inset Text + +\layout Standard + + +\family roman +\series medium +\shape up +\size normal +\emph off +\bar no +\noun off +\color none +x/(-) +\end_inset + + +\begin_inset Text + +\layout Standard + +- +\end_inset + + + + +\begin_inset Text + +\layout Standard + +byte arguments on stack +\end_inset + + +\begin_inset Text + +\layout Standard + +b +\end_inset + + +\begin_inset Text + +\layout Standard + +b +\end_inset + + +\begin_inset Text + +\layout Standard + +- +\end_inset + + +\begin_inset Text + \layout Standard +h +\end_inset + + +\begin_inset Text -\begin_inset LatexCommand \index{} +\layout Standard +h \end_inset + + +\begin_inset Text -As usual on embedded systems you have to provide your own -\family typewriter -getchar() -\begin_inset LatexCommand \index{getchar()} +\layout Standard +- \end_inset + + + + +\begin_inset Text - -\family default -and -\family typewriter -putchar() -\begin_inset LatexCommand \index{putchar()} +\layout Standard + +float format +\begin_inset LatexCommand \index{Floating point support} \end_inset -\family default - routines. - SDCC does not know whether the system connects to a serial line with or - without handshake, LCD, keyboard or other device. - And whether a -\family typewriter -lf -\family default - to -\family typewriter -crlf -\family default - conversion within -\family typewriter -putchar() -\family default - is intended. - You'll find examples for serial routines f.e. - in sdcc/device/lib. +\end_inset + + +\begin_inset Text + \layout Standard -The default -\family typewriter - printf() -\begin_inset LatexCommand \index{printf()} +(%f) +\end_inset + + +\begin_inset Text + +\layout Standard +%f \end_inset + + +\begin_inset Text +\layout Standard -\family default -implementation in -\family typewriter - printf_large.c -\family default - does not support float (except on ds390). - To enable this recompile it with the option -\emph on - -\begin_inset ERT -status Collapsed +\end_inset + + +\begin_inset Text \layout Standard -\backslash -/ +(%f) \end_inset + + +\begin_inset Text -DUSE_FLOATS=1 -\begin_inset LatexCommand \index{USE\_FLOATS} +\layout Standard +%f (limited\SpecialChar ~ +range) \end_inset + + +\begin_inset Text +\layout Standard -\emph default - on the command line. - Use -\emph on - - -\begin_inset ERT -status Collapsed +- +\end_inset + + + + +\begin_inset Text \layout Standard -\backslash -/ +float formats %e %g \end_inset + + +\begin_inset Text --model-large -\begin_inset LatexCommand \index{-\/-model-large} +\layout Standard +- \end_inset + + +\begin_inset Text + +\layout Standard +- +\end_inset + + +\begin_inset Text -\emph default - for the mcs51 port, since this uses a lot of memory. \layout Standard -If you're short on memory you might want to use -\family typewriter -printf_small() -\begin_inset LatexCommand \index{printf\_small()} +- +\end_inset + + +\begin_inset Text +\layout Standard + +- \end_inset + + +\begin_inset Text +\layout Standard -\family default - -\emph on -instead -\emph default - of -\family typewriter - printf(). +- +\end_inset + + +\begin_inset Text -\family default - For the mcs51 there additionally are assembly versions -\family typewriter -printf_tiny() -\begin_inset LatexCommand \index{printf\_tiny() (mcs51)} +\layout Standard +- \end_inset + + + + +\begin_inset Text +\layout Standard -\family default - (subset of printf using less than 270 bytes) and -\family typewriter -printf_fast() -\begin_inset LatexCommand \index{printf\_fast() (mcs51)} +field width +\end_inset + + +\begin_inset Text + +\layout Standard +x \end_inset + + +\begin_inset Text - -\family default -and -\family typewriter - printf_fast_f() -\begin_inset LatexCommand \index{printf\_fast\_f() (mcs51)} +\layout Standard + +x +\end_inset + + +\begin_inset Text + +\layout Standard + +- +\end_inset + + +\begin_inset Text + +\layout Standard + +x/(-) +\end_inset + + +\begin_inset Text + +\layout Standard + +x/(-) +\end_inset + + +\begin_inset Text + +\layout Standard + +- +\end_inset + + + \end_inset -\family default - (floating-point aware version of printf_fast) which should fit the requirements - of many embedded systems (printf_fast() can be customized by unsetting - #defines to -\emph on -not -\emph default - support long variables and field widths). \layout Subsubsection @@ -16177,17 +16901,14 @@ As of SDCC 2.6.2 you no longer need to call an initialization routine before \family typewriter sdcc -c _heap.c -D HEAD_SIZE=2048 -\newline +\layout Standard -\family default And then link it with: \layout Verse \family typewriter sdcc main.rel _heap.rel -\newline - \layout Subsection Math functions (sinf, powf, sqrtf etc.) @@ -22764,7 +23485,22 @@ and DDD was invoked with \newline \newline -ddd -debugger 'sdcdb -cpu 8032 ddd_example' +ddd -debugger "sdcdb -cpu 8032 ddd_example" +\layout Standard + + +\begin_inset Note +collapsed false + +\layout Standard + +Check that the double quotes or an apostroph within the command line survive + the LyX tool chain. + Previously the apostrophs got slanted in the PDF output so a cut and paste + did not work. +\end_inset + + \layout Subsection Interfacing SDCDB with XEmacs @@ -24007,7 +24743,12 @@ Directory \layout Standard -ucSsim +uCsim +\begin_inset LatexCommand \index{uCsim} + +\end_inset + + \end_inset @@ -24661,7 +25402,12 @@ online at \layout Standard -Software simulator for microcontrollers +uCsim +\begin_inset LatexCommand \index{uCsim} + +\end_inset + + Software simulator for microcontrollers \end_inset diff --git a/support/regression/tests/swap.c b/support/regression/tests/swap.c index fbec0ec2..4dbe4ec9 100644 --- a/support/regression/tests/swap.c +++ b/support/regression/tests/swap.c @@ -22,7 +22,7 @@ static void testSwap_4(void) } -#define SWAP_8(x) (((x)<<8)|((x)>>8)) +#define SWAP_8(x) ((((x)<<8)|((x)>>8)) & 0xffff) static void testSwap_8(void) { @@ -64,8 +64,7 @@ static void testSwap_8(void) } -#define SWAP_16(x) (((x)<<16) | ((x)>>16)) -#define SWAP_16_2(x) ((unsigned int)((SWAP_8((unsigned int)x))<<16) | (SWAP_8(x)>>16)) +#define SWAP_16(x) ((((x)<<16) | ((x)>>16)) & 0xffffFFFF) static void testSwap_16(void) { @@ -77,10 +76,6 @@ static void testSwap_16(void) tt = SWAP_16(tt); ASSERT( tt == SWAP_16(TEST_VECT_32)); - tt = t; - tt = SWAP_16_2(tt); - ASSERT( tt == SWAP_16_2(TEST_VECT_32)); - /* swapping union with little register pressure */ { unsigned char c; -- 2.30.2