diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-07 17:42:58 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-07 17:42:58 +0000 |
commit | 1f754edf772673bababe1dc42dad095208525230 (patch) | |
tree | a690d400f687f300dc1753b5be22f2c960ec21b8 /nuttx | |
parent | 37d122462b63f86d33120783576e9b74b880edd9 (diff) | |
download | px4-nuttx-1f754edf772673bababe1dc42dad095208525230.tar.gz px4-nuttx-1f754edf772673bababe1dc42dad095208525230.tar.bz2 px4-nuttx-1f754edf772673bababe1dc42dad095208525230.zip |
c5471 bringup changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@41 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/Documentation/NuttX.html | 3 | ||||
-rw-r--r-- | nuttx/arch/README.txt | 4 | ||||
-rw-r--r-- | nuttx/arch/c5471/defconfig | 13 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/Makefile | 3 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_allocateheap.c | 77 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_delay.c | 102 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_head.S | 19 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_initialize.c | 2 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_initialstate.c | 4 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_internal.h | 19 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_irq.c | 2 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_serial.c | 134 | ||||
-rw-r--r-- | nuttx/arch/pjrc-8051/README.txt | 34 |
13 files changed, 349 insertions, 67 deletions
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 13f2d7f5b..4eb565842 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -34,9 +34,6 @@ This port uses the <a href="http://www.pjrc.com/">PJRC</a> 87C52 development system and the <a href="http://sdcc.sourceforge.net/">SDCC</a> toolchain. This port will require a few more weeks before it is ready for prime time.</li> -<li><b>Motorola (Freescale) MC68HC908GP32 Microcontroller</b>. - Using the Axiom CMS8GP32 development board. - This is next in the queue.</li> <li><b>Other ports</b>. I also have partial ports for the TI TMS320DM270 and for MIPS. </ul> diff --git a/nuttx/arch/README.txt b/nuttx/arch/README.txt index 35279349f..07d11b9b3 100644 --- a/nuttx/arch/README.txt +++ b/nuttx/arch/README.txt @@ -226,10 +226,6 @@ arch/pjrc-8051 8051 Microcontroller. This port uses the PJRC 87C52 development system and the SDCC toolchain. This port is not quite ready for prime time. -arch/axiom-mc68 - For the Motorola (Freescale) MC68HC908GP32 Microcontroller using the - Axiom CMS8GP32 development board. This has not yet been checked-in. - arch/sim x86 Linux Simulation</b>. Fully functional. diff --git a/nuttx/arch/c5471/defconfig b/nuttx/arch/c5471/defconfig index e3f8d028a..8a6d50189 100644 --- a/nuttx/arch/c5471/defconfig +++ b/nuttx/arch/c5471/defconfig @@ -37,11 +37,14 @@ # # CONFIG_ARCH - identifies the arch subdirectory # CONFIG_ARCH_name - for use in C code -# CONFIG_ROM_VECTORS - unique to arm7tdmi +# CONFIG_ROM_VECTORS - unique to c5471 +# CONFIG_DRAM_END - the size of installed DRAM. +# Unique to c5471 # CONFIG_ARCH=c5471 CONFIG_ARCH_C5471=y CONFIG_ROM_VECTORS=n +CONFIG_DRAM_END=0x11000000 # # C5471 specific device driver settings @@ -59,8 +62,8 @@ CONFIG_ROM_VECTORS=n # CONFIG_UART_*_2STOP - Two stop bits # CONFIG_SERIAL_IRDA_CONSOLE=n -CONFIG_UART_IRDA_HWFLOWCONTROL=y -CONFIG_UART_MODEM_HWFLOWCONTROL=y +CONFIG_UART_IRDA_HWFLOWCONTROL=n +CONFIG_UART_MODEM_HWFLOWCONTROL=n CONFIG_UART_IRDA_RXBUFSIZE=256 CONFIG_UART_MODEM_RXBUFSIZE=256 CONFIG_UART_IRDA_TXBUFSIZE=256 @@ -228,5 +231,5 @@ CONFIG_STACK_POINTER= CONFIG_PROC_STACK_SIZE=4096 CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=4096 -CONFIG_HEAP_BASE=(0x10300000+90*1024+CONFIG_PROC_STACK_SIZE) -CONFIG_HEAP_SIZE=(0x11000000-CONFIG_HEAP_BASE) +CONFIG_HEAP_BASE= +CONFIG_HEAP_SIZE= diff --git a/nuttx/arch/c5471/src/Makefile b/nuttx/arch/c5471/src/Makefile index 97f3ae9a2..a7867f0b7 100644 --- a/nuttx/arch/c5471/src/Makefile +++ b/nuttx/arch/c5471/src/Makefile @@ -50,7 +50,8 @@ CSRCS = up_initialize.c up_initialstate.c up_idle.c up_doirq.c \ up_createstack.c up_usestack.c up_releasestack.c \ up_exit.c up_assert.c up_blocktask.c up_unblocktask.c \ up_releasepending.c up_reprioritizertr.c up_copystate.c \ - up_schedulesigaction.c up_sigdeliver.c up_serial.c + up_schedulesigaction.c up_sigdeliver.c up_serial.c \ + up_delay.c up_allocateheap.c COBJS = $(CSRCS:.c=.o) SRCS = $(ASRCS) $(CSRCS) diff --git a/nuttx/arch/c5471/src/up_allocateheap.c b/nuttx/arch/c5471/src/up_allocateheap.c new file mode 100644 index 000000000..2d40857f8 --- /dev/null +++ b/nuttx/arch/c5471/src/up_allocateheap.c @@ -0,0 +1,77 @@ +/************************************************************ + * up_allocateheap.c + * + * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************/ + +/************************************************************ + * Included Files + ************************************************************/ + +#include <nuttx/config.h> +#include <sys/types.h> +#include <debug.h> +#include <nuttx/arch.h> +#include "up_internal.h" + +/************************************************************ + * Private Definitions + ************************************************************/ + +/************************************************************ + * Private Data + ************************************************************/ + +/************************************************************ + * Private Functions + ************************************************************/ + +/************************************************************ + * Public Functions + ************************************************************/ + +/************************************************************ + * Name: up_allocate_heap + * + * Description: + * The heap may be statically allocated by + * defining CONFIG_HEAP_BASE and CONFIG_HEAP_SIZE. If these + * are not defined, then this function will be called to + * dynamically set aside the heap region. + * + ************************************************************/ + +void up_allocate_heap(FAR void **heap_start, size_t *heap_size) +{ + *heap_start = (FAR void*)g_heapstart; + *heap_size = CONFIG_DRAM_END - g_heapstart; +} diff --git a/nuttx/arch/c5471/src/up_delay.c b/nuttx/arch/c5471/src/up_delay.c new file mode 100644 index 000000000..373602d53 --- /dev/null +++ b/nuttx/arch/c5471/src/up_delay.c @@ -0,0 +1,102 @@ +/************************************************************ + * up_delay.c + * + * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************/ + +/************************************************************ + * Included Files + ************************************************************/ + +#include <nuttx/config.h> +#include <sys/types.h> +#include <unistd.h> +#include <semaphore.h> +#include <string.h> +#include <errno.h> +#include <debug.h> +#include <nuttx/irq.h> +#include <nuttx/arch.h> +#include <nuttx/fs.h> +#include <arch/serial.h> +#include "c5471.h" +#include "os_internal.h" +#include "up_internal.h" + +/************************************************************ + * Definitions + ************************************************************/ + +#define LOOPS_PER_MSEC 1250 + +/************************************************************ + * Private Types + ************************************************************/ + +/************************************************************ + * Private Function Prototypes + ************************************************************/ + +/************************************************************ + * Private Variables + ************************************************************/ + +/************************************************************ + * Private Functions + ************************************************************/ + + +/************************************************************ + * Public Funtions + ************************************************************/ + +/************************************************************ + * Name: up_delay + * + * Description: + * Delay inline for the requested number of milliseconds. + * NOT multi-tasking friendly. + * + ************************************************************/ + +void up_delay(int milliseconds) +{ + volatile int i; + volatile int j; + + for (i = 0; i < milliseconds; i++) + { + for (j = 0; j < LOOPS_PER_MSEC; j++) + { + } + } +} diff --git a/nuttx/arch/c5471/src/up_head.S b/nuttx/arch/c5471/src/up_head.S index e97a52dbd..dd59b98b7 100644 --- a/nuttx/arch/c5471/src/up_head.S +++ b/nuttx/arch/c5471/src/up_head.S @@ -64,6 +64,7 @@ * us and that only leaves us having to do some os specific things * below. */ + .text .global __start .type __start, #function __start: @@ -122,7 +123,9 @@ __start: * _sbss is the start of the BSS region (see ld.script) * _ebss is the end of the BSS regsion (see ld.script) * The idle task stack starts at the end of BSS and is - * of size CONFIG_PROC_STACK_SIZE + * of size CONFIG_PROC_STACK_SIZE. The heap continues + * from there until the end of memory. See g_heapstart + * below. */ LC0: .long _sbss @@ -134,6 +137,20 @@ LC2: .long _eronly /* Where .data defaults are stored in FLASH */ .long _sdata /* Where .data needs to reside in SDRAM */ .long _edata #endif + .size __start, .-__start + + /* This global variable is unsigned long g_heapstart and is + * exported from here only because of its coupling to LCO + * above. + */ + + .data + .align 4 + .globl g_heapstart + .type g_heapstart, object +g_heapstart: + .long _ebss+CONFIG_PROC_STACK_SIZE + .size g_heapstart, .-g_heapstart .end diff --git a/nuttx/arch/c5471/src/up_initialize.c b/nuttx/arch/c5471/src/up_initialize.c index bae36548b..86b6a9f8d 100644 --- a/nuttx/arch/c5471/src/up_initialize.c +++ b/nuttx/arch/c5471/src/up_initialize.c @@ -88,7 +88,9 @@ void up_initialize(void) /* Initialize the system timer interrupt */ +#ifndef CONFIG_SUPPRESS_INTERRUPTS up_timerinit(); +#endif /* Register devices */ diff --git a/nuttx/arch/c5471/src/up_initialstate.c b/nuttx/arch/c5471/src/up_initialstate.c index 0309daab0..76792f695 100644 --- a/nuttx/arch/c5471/src/up_initialstate.c +++ b/nuttx/arch/c5471/src/up_initialstate.c @@ -83,5 +83,9 @@ void up_initial_state(_TCB *tcb) memset(xcp, 0, sizeof(struct xcptcontext)); xcp->regs[REG_SP] = (uint32)tcb->adj_stack_ptr; xcp->regs[REG_PC] = (uint32)tcb->start; +#ifdef CONFIG_SUPPRESS_INTERRUPTS + xcp->regs[REG_CPSR] = SVC_MODE | I_BIT | F_BIT; +#else xcp->regs[REG_CPSR] = SVC_MODE | F_BIT; +#endif } diff --git a/nuttx/arch/c5471/src/up_internal.h b/nuttx/arch/c5471/src/up_internal.h index b1256130e..7563a15fc 100644 --- a/nuttx/arch/c5471/src/up_internal.h +++ b/nuttx/arch/c5471/src/up_internal.h @@ -44,6 +44,11 @@ * Definitions ************************************************************/ +/* Bring-up debug configurations */ + +#define CONFIG_SUPPRESS_INTERRUPTS 1 /* Do not enable interrupts */ +#define CONFIG_SUPPRESS_UART_CONFIG 1 /* Do not reconfig UART */ + /************************************************************ * Public Types ************************************************************/ @@ -57,7 +62,20 @@ typedef void (*up_vector_t)(void); ************************************************************/ #ifndef __ASSEMBLY__ +/* This holds a references to the current interrupt level + * register storage structure. If is non-NULL only during + * interrupt processing. + */ + extern uint32 *current_regs; + +/* This is the beginning of heap as provided from up_head.S. + * This is the first address in DRAM after the loaded + * program+bss+idle stack. The end of the heap is + * CONFIG_DRAM_END + */ + +extern uint32 g_heapstart; #endif /************************************************************ @@ -75,6 +93,7 @@ extern uint32 *current_regs; extern void up_copystate(uint32 *dest, uint32 *src); extern void up_dataabort(uint32 *regs); +extern void up_delay(int milliseconds); extern void up_doirq(int irq, uint32* regs); extern void up_fullcontextrestore(uint32 *regs) __attribute__ ((noreturn)); extern void up_irqinitialize(void); diff --git a/nuttx/arch/c5471/src/up_irq.c b/nuttx/arch/c5471/src/up_irq.c index 32c350d48..6b981c99a 100644 --- a/nuttx/arch/c5471/src/up_irq.c +++ b/nuttx/arch/c5471/src/up_irq.c @@ -176,7 +176,9 @@ void up_irqinitialize(void) /* And finally, enable interrupts */ +#ifndef CONFIG_SUPPRESS_INTERRUPTS irqrestore(SVC_MODE | F_BIT); +#endif } /************************************************************ diff --git a/nuttx/arch/c5471/src/up_serial.c b/nuttx/arch/c5471/src/up_serial.c index b11bfc070..7bd90ef11 100644 --- a/nuttx/arch/c5471/src/up_serial.c +++ b/nuttx/arch/c5471/src/up_serial.c @@ -43,6 +43,7 @@ #include <semaphore.h> #include <string.h> #include <errno.h> +#include <debug.h> #include <nuttx/irq.h> #include <nuttx/arch.h> #include <nuttx/fs.h> @@ -57,6 +58,10 @@ #define BASE_BAUD 115200 +#if defined(CONFIG_UART_IRDA_HWFLOWCONTROL) || defined(CONFIG_UART_MODEM_HWFLOWCONTROL) +# define CONFIG_UART_HWFLOWCONTROL +#endif + /************************************************************ * Private Types ************************************************************/ @@ -93,15 +98,17 @@ struct up_dev_s * this UART */ boolean parity; /* 0=none, 1=odd, 2=even */ boolean bits; /* Number of bits (7 or 8) */ +#ifdef CONFIG_UART_HWFLOWCONTROL boolean flowcontrol; /* TRUE: Hardware flow control * is enabled. */ +#endif boolean stopbits2; /* TRUE: Configure with 2 * stop bits instead of 1 */ boolean xmitwaiting; /* TRUE: User is waiting * for space in xmit.buffer */ boolean recvwaiting; /* TRUE: User is waiting * for space in recv.buffer */ - boolean isconsole; /* TRUE: This is the serila console */ + boolean isconsole; /* TRUE: This is the serial console */ sem_t closesem; /* Looks out new opens while * close is in progress */ sem_t xmitsem; /* Used to wakeup user waiting @@ -124,7 +131,6 @@ static ssize_t up_read(struct file *filep, char *buffer, size_t buflen); static ssize_t up_write(struct file *filep, const char *buffer, size_t buflen); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static void up_uartsetup(up_dev_t *dev); -static void up_delay(int milliseconds); /************************************************************ * Private Variables @@ -150,7 +156,9 @@ static up_dev_t g_irdaport = .baud = CONFIG_UART_IRDA_BAUD, .parity = CONFIG_UART_IRDA_PARITY, .bits = CONFIG_UART_IRDA_BITS, - .flowcontrol = CONFIG_UART_IRDA_HWFLOWCONTROL, +#ifdef CONFIG_UART_IRDA_HWFLOWCONTROL + .flowcontrol = TRUE, +#endif .stopbits2 = CONFIG_UART_IRDA_2STOP, }; @@ -165,7 +173,9 @@ static up_dev_t g_modemport = .baud = CONFIG_UART_MODEM_BAUD, .parity = CONFIG_UART_MODEM_PARITY, .bits = CONFIG_UART_MODEM_BITS, - .flowcontrol = CONFIG_UART_MODEM_HWFLOWCONTROL, +#ifdef CONFIG_UART_MODEM_HWFLOWCONTROL + .flowcontrol = TRUE, +#endif .stopbits2 = CONFIG_UART_MODEM_2STOP, }; @@ -464,22 +474,13 @@ static inline void up_saveregisters(up_dev_t *dev) { dev->regs.ier = up_inserial(dev, UART_IER_OFFS); dev->regs.lcr = up_inserial(dev, UART_LCR_OFFS); +#ifdef CONFIG_UART_HWFLOWCONTROL if (dev->flowcontrol) { dev->regs.efr = up_inserial(dev, UART_EFR_OFFS); dev->regs.tcr = up_inserial(dev, UART_TCR_OFFS); } -} - -#define LOOPS_PER_MSEC 1250 - -static void up_delay(int milliseconds) -{ - volatile int i, j; - for (i = 0; i < milliseconds; i++) { - for (j = 0; j < LOOPS_PER_MSEC; j++) { - } - } +#endif } /************************************************************ @@ -582,6 +583,51 @@ static void up_xmitchars(up_dev_t *dev) } /************************************************************ + * Name: up_putxmitchar + ************************************************************/ + +static void up_putxmitchar(up_dev_t *dev, int ch) +{ + int nexthead = dev->xmit.head + 1; + if (nexthead >= dev->xmit.size) + { + nexthead = 0; + } + + if (nexthead != dev->xmit.tail) + { + dev->xmit.buffer[dev->xmit.head] = ch; + dev->xmit.head = nexthead; + } + else + { + /* Transfer some characters with interrupts disabled */ + + up_xmitchars(dev); + + /* If we unsuccessful in making room in the buffer. + * then transmit the characters with interrupts + * enabled and wait for result. + */ + + if (nexthead == dev->xmit.tail) + { + /* Still no space */ + + dev->xmitwaiting = TRUE; + + /* Wait for some characters to be sent from the buffer + * with the TX interrupt disabled. + */ + + up_enabletxint(dev); + up_takesem(&dev->xmitsem); + up_disabletxint(dev); + } + } +} + +/************************************************************ * Name: up_interrupt ************************************************************/ @@ -665,6 +711,7 @@ static int up_interrupt(int irq, void *context) static void up_uartsetup(up_dev_t *dev) { +#ifdef CONFIG_SUPPRESS_UART_CONFIG unsigned int cval; uint16 mrs; @@ -701,14 +748,17 @@ static void up_uartsetup(up_dev_t *dev) up_setrate(dev, dev->baud); up_setmode(dev, cval); +#ifdef CONFIG_UART_HWFLOWCONTROL if (dev->flowcontrol) { serial_enable_hw_flow_control(dev); } else +#endif { serial_disable_hw_flow_control(dev); } +#endif } /************************************************************ @@ -749,46 +799,20 @@ static ssize_t up_write(struct file *filep, const char *buffer, size_t buflen) */ up_disabletxint(dev); - while (buflen) + for (; buflen; buflen--) { - int nexthead = dev->xmit.head + 1; - if (nexthead >= dev->xmit.size) - { - nexthead = 0; - } - - if (nexthead != dev->xmit.tail) - { - dev->xmit.buffer[dev->xmit.head] = *buffer++; - dev->xmit.head = nexthead; - buflen--; - } - else - { - /* Transfer some characters with interrupts disabled */ + int ch = *buffer++; - up_xmitchars(dev); - - /* If we unsuccessful in making room in the buffer. - * then transmit the characters with interrupts - * enabled and wait for result. - */ - - if (nexthead == dev->xmit.tail) - { - /* Still no space */ + /* Put the character into the transmit buffer */ - dev->xmitwaiting = TRUE; + up_putxmitchar(dev, ch); + + /* If this is the console, then we should replace LF with LF-CR */ - /* Wait for some characters to be sent from the buffer - * with the TX interrupt disabled. - */ - - up_enabletxint(dev); - up_takesem(&dev->xmitsem); - up_disabletxint(dev); - } - } + if (ch == '\n') + { + up_putxmitchar(dev, '\r'); + } } if (dev->xmit.head != dev->xmit.tail) @@ -924,6 +948,10 @@ static int up_close(struct file *filep) return OK; } + /* There are no more references to the port */ + + dev->open_count = 0; + /* Stop accepting input */ up_disablerxint(dev); @@ -1100,12 +1128,12 @@ int up_putc(int ch) /* Check for LF */ - if (ch == 10) + if (ch == '\n') { /* Add CR */ up_waittxfifonotfull(&CONSOLE_DEV); - up_outserialchar(&CONSOLE_DEV, 13); + up_outserialchar(&CONSOLE_DEV, '\r'); } up_waittxfifonotfull(&CONSOLE_DEV); diff --git a/nuttx/arch/pjrc-8051/README.txt b/nuttx/arch/pjrc-8051/README.txt new file mode 100644 index 000000000..0b73373d3 --- /dev/null +++ b/nuttx/arch/pjrc-8051/README.txt @@ -0,0 +1,34 @@ +pjrc-8051 README +^^^^^^^^^^^^^^^^ + +This port uses the PJRC 87C52 development system and the SDCC toolchain. + +The PJRC 87C52 development system can be obtained from http://www.pjrc.com/. + +The SDCC toolchain is available from http://sdcc.sourceforge.net/. All +testing has been performed using verison 2.6.0 of the SDDC toolchain. + +Building the SDCC toolchain +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The SDCC toolchain is built with the standard configure/make/make install +sequence. However, some special actions are required to generate libraries +compatible with this build. First start with the usual steps + + download + unpack + cd sdcc + ./configure + make + +But before installing, + + Apply sdcc-2.6.0.patch + cd sdcc/device/lib + make model-mcs51-stack-auto + +Then + + cd sdcc + make install + |