]> git.gag.com Git - fw/sdcc/commitdiff
* device/include/pic16/usart.h: added, missing in previous commit,
authorvrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 6 Apr 2005 06:06:20 +0000 (06:06 +0000)
committervrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 6 Apr 2005 06:06:20 +0000 (06:06 +0000)
* device/include/pic16/adc.h: fixed typo,
* device/lib/pic16/libc/utils/cvtdec.S: added missing in previous
commit,
* device/lib/pic16/libc/stdlib/g_ftoa.S: modified to include
<p18fxxx.inc>
* device/lib/pic16/libc/stdio/streams.c: leave stdin, stdout
uninitialized because a bug appears with gplink
* device/lib/pic16/{some makefiles}: moved $(CSTD) from CFLAGS to
COMPILE_FLAGS and added CPPFLAGS with -nostdinc because sdcpp
complains for unrecognised option

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3718 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
device/include/pic16/adc.h
device/include/pic16/usart.h [new file with mode: 0644]
device/lib/pic16/debug/Makefile.rules
device/lib/pic16/libc/Makefile.rules
device/lib/pic16/libc/stdio/streams.c
device/lib/pic16/libc/stdlib/g_ftoa.S
device/lib/pic16/libc/utils/cvtdec.S [new file with mode: 0644]
device/lib/pic16/libm/Makefile
device/lib/pic16/libsdcc/Makefile.rules

index f6c3900faaa1169f00405dedfd44a5cf9a3d5368..5cc0a663ebd535a222882479c9e43a65ebe1484e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-04-06 Vangelis Rokas <vrokas AT users.sourceforge.net>
+
+        * device/include/pic16/usart.h: added, missing in previous commit,
+        * device/include/pic16/adc.h: fixed typo,
+        * device/lib/pic16/libc/utils/cvtdec.S: added missing in previous
+        commit,
+        * device/lib/pic16/libc/stdlib/g_ftoa.S: modified to include
+        <p18fxxx.inc>
+        * device/lib/pic16/libc/stdio/streams.c: leave stdin, stdout
+        uninitialized because a bug appears with gplink
+        * device/lib/pic16/{some makefiles}: moved $(CSTD) from CFLAGS to
+        COMPILE_FLAGS and added CPPFLAGS with -nostdinc because sdcpp
+        complains for unrecognised option
+
 2005-04-05 Raphael Neider <rneider AT web.de>
 
        * src/pic16/gen.c (pic16_popCopyReg): made copying work for extended
index b36fc2319610fe3ab8fdbd9999b2fd4402f499da..333e99090cb662cffcf5caf7c820e2615a61eda3 100644 (file)
@@ -91,7 +91,7 @@ void adc_conv(void);
 /* return 1 if AD is performing a conversion, 0 if done */
 char adc_busy(void) __naked;
 
-/* get value of convertion */
+/* get value of conversion */
 int adc_read(void) __naked;
 
 /* setup conversion channel */
diff --git a/device/include/pic16/usart.h b/device/include/pic16/usart.h
new file mode 100644 (file)
index 0000000..0b119f3
--- /dev/null
@@ -0,0 +1,79 @@
+
+/*
+ * USART communications module library header
+ *
+ * written for SDCC/pic16 port by Vangelis Rokas, 2005 <vrokas AT otenet.gr>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ *
+ * $Id$
+ */
+
+#ifndef __USART_H__
+#define __USART_H__
+
+#pragma library io
+
+
+#define RAM_SCLS       __data
+
+/* configuration bit masks for open function */
+#define USART_TX_INT_ON   0xff
+#define USART_TX_INT_OFF  0x7f
+#define USART_RX_INT_ON   0xff
+#define USART_RX_INT_OFF  0xbf
+#define USART_BRGH_HIGH   0xff
+#define USART_BRGH_LOW    0xef
+#define USART_CONT_RX     0xff
+#define USART_SINGLE_RX   0xf7
+#define USART_SYNC_MASTER 0xff
+#define USART_SYNC_SLAVE  0xfb
+#define USART_NINE_BIT    0xff
+#define USART_EIGHT_BIT   0xfd
+#define USART_SYNCH_MODE  0xff
+#define USART_ASYNCH_MODE 0xfe
+
+
+/* status bits */
+union USART
+{
+  unsigned char val;
+  struct
+  {
+    unsigned RX_NINE:1;
+    unsigned TX_NINE:1;
+    unsigned FRAME_ERROR:1;
+    unsigned OVERRUN_ERROR:1;
+    unsigned fill:4;
+  };
+};
+
+void usart_open(unsigned char config, unsigned int spbrg) __wparam;
+void usart_close(void);
+
+unsigned char usart_busy(void) __naked;
+unsigned char usart_drdy(void) __naked;
+
+unsigned char usart_getc(void);
+void usart_gets(RAM_SCLS char *buffer, unsigned char len);
+
+void usart_putc(unsigned char data) __wparam __naked;
+void usart_puts(char *data);
+
+
+void usart_baud(unsigned char baudconfig) __wparam;
+
+#endif
index c76ece10e37e00248f368acd2d1a161d59e86498..b1048c9c5f1b2903c9097ebae79ca58b9935db3c 100644 (file)
@@ -21,7 +21,8 @@ LIBC_INC_DIR  = $(PRJDIR)/device/include/pic16
 
 COMPILE_FLAGS  += $(MODELFLAGS) $(OPT_FLAGS)
 
-CFLAGS = --nostdinc -I$(LIBC_INC_DIR)
+CPPFLAGS        := -nostdinc -I$(LIBC_INC_DIR)
+CFLAGS  += --nostdinc -I$(LIBC_INC_DIR)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
 OFILES = $(patsubst %.c,%.o,$(CFILES))
@@ -42,7 +43,7 @@ clean: clean-intermediate
 dep .depend:
        rm -f .depend
        for temp in $(CFILES); do \
-               $(CPP) $(MM) $(CFLAGS) $$temp > .tmpdepend; \
+               $(CPP) $(MM) $(CPPFLAGS) $$temp > .tmpdepend; \
                $(SED) s/.rel/.o/g .tmpdepend >> .depend; \
                $(RM) -f .tmpdepend; \
        done;
index f20e26f2188af4f7eaea9ae1265e4a68a54044ce..78e04f11f6d1a884ad5f471aa83f39b41c069944 100644 (file)
@@ -21,10 +21,12 @@ LIBC_INC_DIR        = $(PRJDIR)/device/include/pic16
 #OPT_FLAGS     += --pstack-model=large
 #OPT_FLAGS     += --stack-auto
 
-COMPILE_FLAGS  += $(MODELFLAGS) $(OPT_FLAGS)
+COMPILE_FLAGS  += $(MODELFLAGS)
+COMPILE_FLAGS   += $(OPT_FLAGS)
+COMPILE_FLAGS   += $(CSTD)
 
 
-CFLAGS = $(CSTD) -I$(LIBC_INC_DIR)
+CFLAGS = -I$(LIBC_INC_DIR)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
 COFILES        = $(patsubst %.c,%.o,$(CFILES))
index 65fa6c04caeb1953d0e661e49e858f4e22da2269..58eb209e757da4482ef54bb2c3280f0427a33d22 100644 (file)
@@ -29,5 +29,7 @@
 
 #include <stdio.h>
 
-FILE *stdout = STREAM_USER;
-FILE *stdin = STREAM_USER;
+FILE *stdout;
+// = STREAM_USER;
+FILE *stdin;
+// = STREAM_USER;
index fd7b0154c673297afab17083198cdf95d93494ec..e1381fddaa042a26a7c7f30e90fa93cc056d24cd 100644 (file)
@@ -21,7 +21,7 @@
                list    r=dec, n=96, st=off, mm=off
 
                nolist
-               include         "/usr/local/share/gputils/header/p18f452.inc"
+               include         <p18fxxx.inc>
                list
 
                udata
diff --git a/device/lib/pic16/libc/utils/cvtdec.S b/device/lib/pic16/libc/utils/cvtdec.S
new file mode 100644 (file)
index 0000000..10633dd
--- /dev/null
@@ -0,0 +1,286 @@
+;--
+;
+;      File:   cvtdec.asm
+;      Author: George Gallant
+;      Date:   19OCT04
+;      
+;       $Id$
+;
+;      This routine is based on the code and algorithm by
+;      Nikolai Golovchenko and Scott Dattalo presented in
+;      the piclist webb site on radix conversion methods.
+;      Modified to support integers from 0 to 65535 and coded
+;      for the pic18 chip set.
+;
+;                         Digit
+;      BIT  Weight  4   3   2   1   0
+;      ---  ------ --- --- --- --- ---
+;       0      1    0   0   0   0   1
+;       1      2    0   0   0   0   2
+;       2      4    0   0   0   0   4
+;       3      8    0   0   0   0   8
+;      
+;       4     16    0   0   0   1   6
+;       5     32    0   0   0   3   2
+;       6     64    0   0   0   6   4
+;       7    128    0   0   1   2   8
+;
+;       8    256    0   0   2   5   6
+;       9    512    0   0   5   1   2
+;      10   1024    0   1   0   2   4
+;      11   2048    0   2   0   4   8
+;
+;      12   4096    0   4   0   9   6
+;      13   8192    0   8   1   9   2
+;      14  16384    1   6   3   8   4
+;      15  32768    3   2   7   6   8
+;
+;--
+               nolist
+               include <p18fxxx.inc>
+               list
+
+               udata
+
+               global  digits
+
+digits:                res     6
+
+               code
+
+               global  cvt_dec_word
+
+;--
+;
+;      Convert a 16-bit binary word to 5 BCD bytes
+;
+;      On Call
+;              PROD    16 bit word
+;              FSR0    pointer to ascii buffer
+;
+;      On Return
+;              digits[4:0] contain the BCD integers
+;
+;      Notes:  1. strip leading zeros
+;              2. only positive integers on input
+;              3. FSR0, PROD & W are modified and not preserved
+;
+;--
+cvt_dec_word:  clrw                            ;calculate digit 0 - lsd
+
+               btfsc   PRODL,0                 ;bit0
+               addlw   1
+
+               btfsc   PRODL,1                 ;bit1
+               addlw   2
+
+               btfsc   PRODL,2                 ;bit2
+               addlw   4
+
+               btfsc   PRODL,3                 ;bit3
+               addlw   8
+
+               btfsc   PRODL,4                 ;bit4
+               addlw   6
+
+               btfsc   PRODL,5                 ;bit5
+               addlw   2
+
+               btfsc   PRODL,6                 ;bit6
+               addlw   4
+
+               btfsc   PRODL,7                 ;bit7
+               addlw   8
+
+               btfsc   PRODH,0                 ;bit8
+               addlw   6
+
+               btfsc   PRODH,1                 ;bit9
+               addlw   2
+
+               btfsc   PRODH,2                 ;bit10
+               addlw   4
+
+               btfsc   PRODH,3                 ;bit11
+               addlw   8
+
+               btfsc   PRODH,4                 ;bit12
+               addlw   6
+
+               btfsc   PRODH,5                 ;bit13
+               addlw   2
+
+               btfsc   PRODH,6                 ;bit14
+               addlw   4
+
+               btfsc   PRODH,7                 ;bit15
+               addlw   8
+
+               clrf    digits+1                ;setup for carry in 10's
+@1:            addlw   -10
+               bnc     @2
+               incf    digits+1,f
+               bra     @1
+
+@2:            addlw   10
+               movwf   digits+0
+
+;      calculate digit 1
+
+               movf    digits+1,w
+
+               btfsc   PRODL,4                 ;bit4
+               addlw   1
+
+               btfsc   PRODL,5                 ;bit5
+               addlw   3
+
+               btfsc   PRODL,6                 ;bit6
+               addlw   6
+
+               btfsc   PRODL,7                 ;bit7
+               addlw   2
+
+               btfsc   PRODH,0                 ;bit8
+               addlw   5
+
+               btfsc   PRODH,1                 ;bit9
+               addlw   1
+
+               btfsc   PRODH,2                 ;bit10
+               addlw   2
+
+               btfsc   PRODH,3                 ;bit11
+               addlw   4
+
+               btfsc   PRODH,4                 ;bit12
+               addlw   9
+
+               btfsc   PRODH,5                 ;bit13
+               addlw   9
+
+               btfsc   PRODH,6                 ;bit14
+               addlw   8
+
+               btfsc   PRODH,7                 ;bit15
+               addlw   6
+
+               clrf    digits+2                ;setup for carry into 100's
+@3:            addlw   -10
+               bnc     @4
+               incf    digits+2,f
+               bra     @3
+
+@4:            addlw   10
+               movwf   digits+1
+
+;      calculate digit 2
+
+               movf    digits+2,w
+
+               btfsc   PRODL,7                 ;bit7
+               addlw   1
+
+               btfsc   PRODH,0                 ;bit8
+               addlw   2
+
+               btfsc   PRODH,1                 ;bit9
+               addlw   5
+
+               btfsc   PRODH,5                 ;bit13
+               addlw   1
+
+               btfsc   PRODH,6                 ;bit14
+               addlw   3
+
+               btfsc   PRODH,7                 ;bit15
+               addlw   7
+
+               clrf    digits+3                ;setup for carry into 1000's
+@5:            addlw   -10
+               bnc     @6
+               incf    digits+3,f
+               bra     @5
+@6:            addlw   10
+
+               movwf   digits+2
+
+;      calculate digit 3
+
+               movf    digits+3,w
+
+               btfsc   PRODH,2                 ;bit10
+               addlw   1
+
+               btfsc   PRODH,3                 ;bit11
+               addlw   2
+
+               btfsc   PRODH,4                 ;bit12
+               addlw   4
+
+               btfsc   PRODH,5                 ;bit13
+               addlw   8
+
+               btfsc   PRODH,6                 ;bit14
+               addlw   6
+
+               btfsc   PRODH,7                 ;bit15
+               addlw   2
+
+               clrf    digits+4                ;setup for carry into 10000's
+@7:            addlw   -10
+               bnc     @8
+               incf    digits+4,f
+               bra     @7
+
+@8:            addlw   10
+               movwf   digits+3
+
+;      calculate digit 4
+
+               movf    digits+4,w
+
+               btfsc   PRODH,6                 ;bit14
+               addlw   1
+
+               btfsc   PRODH,7                 ;bit15
+               addlw   3
+
+@9:            addlw   -10
+               bc      @9
+
+               addlw   10
+;              movwf   digits+4
+
+;              movf    digits+4,w
+               bnz     @11
+               movf    digits+3,w
+               bnz     @12
+               movf    digits+2,w
+               bnz     @13
+               movf    digits+1,w
+               bnz     @14
+               bra     @15
+
+@11:           addlw   0x30
+               movwf   POSTINC0
+
+               movf    digits+3,w
+@12:           addlw   0x30
+               movwf   POSTINC0
+
+               movf    digits+2,w
+@13:           addlw   0x30
+               movwf   POSTINC0
+
+               movf    digits+1,w
+@14:           addlw   0x30
+               movwf   POSTINC0
+
+@15:           movf    digits+0,w
+               addlw   0x30
+               movwf   POSTINC0
+
+               return
+
+               end
index d9ba0a0cc6db80a1e20816022af34afb46852cc3..652092450c1c248e28745af622fbe94f7dfac96f 100644 (file)
@@ -61,9 +61,9 @@ SRCS  =       acosf  \
                tanhf
 
 COMPILE_FLAGS  += $(MODELFLAGS) $(OPT_FLAGS)
+COMPILE_FLAGS   += $(CSTD)
 
-CFLAGS += $(CSTD)
-CFLAGS += -I $(PRJDIR)/device/include/pic16
+CFLAGS  += -I $(PRJDIR)/device/include/pic16
 
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index 529b2a7b5b8d0bc659c3b46fc216fdded7fbe38a..3e0bec8e552026a98156aedf2663f986541f1999 100644 (file)
@@ -23,11 +23,16 @@ DEBUG       =
 
 OPT_FLAGS      += --optimize-cmp
 #OPT_FLAGS     += --stack-auto
-COMPILE_FLAGS  += $(MODELFLAGS) $(OPT_FLAGS) $(DEBUG)
 
-CFLAGS  += $(CSTD)
+COMPILE_FLAGS  += $(MODELFLAGS)
+COMPILE_FLAGS   += $(OPT_FLAGS) $(DEBUG)
+COMPILE_FLAGS   += $(CSTD)
+
+CPPFLAGS        := -nostdinc $(CFLAGS) -I$(LIBC_INC_DIR)
+
 CFLAGS += --nostdinc -I$(LIBC_INC_DIR)
 
+
 CFILES = $(patsubst %,%.c,$(SRCS))
 COFILES        = $(patsubst %.c,%.o,$(CFILES))
 
@@ -57,7 +62,7 @@ clean: clean-intermediate
 dep .depend:
        rm -f .depend
        for temp in $(CFILES); do \
-               $(CPP) $(MM) $(CFLAGS) $$temp > .tmpdepend; \
+               $(CPP) $(MM) $(CPPFLAGS) $$temp > .tmpdepend; \
                $(SED) s/.rel/.o/g .tmpdepend >> .depend; \
                $(RM) -f .tmpdepend; \
        done;