diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-04-09 00:51:08 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-04-09 00:51:08 +0000 |
commit | 645ad410918ec982fcc0ee6ee1bfa0afc3872663 (patch) | |
tree | d98a689ae856d3d15d4e2cd1f6c8870ff909fc1e /nuttx | |
parent | 8e550d087c7b76ccaa782a5ce87ebfe1c119f27c (diff) | |
download | px4-nuttx-645ad410918ec982fcc0ee6ee1bfa0afc3872663.tar.gz px4-nuttx-645ad410918ec982fcc0ee6ee1bfa0afc3872663.tar.bz2 px4-nuttx-645ad410918ec982fcc0ee6ee1bfa0afc3872663.zip |
lpc2378 port contributed by Rommel Marcelo
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2578 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rwxr-xr-x | nuttx/arch/arm/include/lpc2378/irq.h | 150 | ||||
-rw-r--r-- | nuttx/configs/olimex-lpc2378/README.txt | 11 | ||||
-rw-r--r-- | nuttx/configs/olimex-lpc2378/include/README.txt | 1 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/include/board.h | 90 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/nsh/Make.defs | 157 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/nsh/defconfig | 438 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/nsh/ld.script | 166 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/nsh/setenv.sh | 52 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/ostest/Make.defs | 165 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/ostest/defconfig | 438 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/ostest/ld.script | 166 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/ostest/setenv.sh | 52 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/src/Makefile | 93 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/src/up_leds.c | 142 | ||||
-rwxr-xr-x | nuttx/configs/olimex-lpc2378/src/up_nsh.c | 114 |
15 files changed, 2235 insertions, 0 deletions
diff --git a/nuttx/arch/arm/include/lpc2378/irq.h b/nuttx/arch/arm/include/lpc2378/irq.h new file mode 100755 index 000000000..6a557cf75 --- /dev/null +++ b/nuttx/arch/arm/include/lpc2378/irq.h @@ -0,0 +1,150 @@ +/**************************************************************************** + * arch/lpc2378/irq.h + * + * Copyright (C) 2010 Rommel Marcelo. All rights reserved. + * Author: Rommel Marcelo + * + * This file is part of the NuttX RTOS and based on the lpc2148 port: + * + * Copyright (C) 2010 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 NuttX 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. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, + * only indirectly through nuttx/irq.h + */ + +#ifndef __ARCH_LPC2378_IRQ_H +#define __ARCH_LPC2378_IRQ_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ +#ifndef __ASSEMBLY__ +# include <stdint.h> +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* LPC2378 Interrupts */ + +#define WDT_IRQ 0 /* Watchdog */ +#define RESERVED_IRQ 1 /* SWI only */ +#define DBGCOMMRX_IRQ 2 /* Embedded debug */ +#define DBGCOMMTX_IRQ 3 /* Embedded debug */ +#define TIMER0_IRQ 4 /* Timer 0 */ +#define TIMER1_IRQ 5 /* Timer 1 */ +#define UART0_IRQ 6 /* UART 0 */ +#define UART1_IRQ 7 /* UART 1 */ +#define PWM0_IRQ 8 /* PWM 0 */ +#define I2C0_IRQ 9 /* I2C 0 */ +#define SPI0_IRQ 10 /* SPI 0 */ +#define SSP0_IRQ 10 /* SSP 0 */ +#define SSP1_IRQ 11 /* SSP 1 */ +#define PLL_IRQ 12 /* PLL Lock IRQ */ +#define RTC_IRQ 13 /* Real Time Clock */ +#define EINT0_IRQ 14 /* External interrupt 0 */ +#define EINT1_IRQ 15 /* External interrupt 1 */ +#define EINT2_IRQ 16 /* External interrupt 2 */ +#define EINT3_IRQ 17 /* External interrupt 3 */ +#define ADC0_IRQ 18 /* ADC 0 */ +#define I2C1_IRQ 19 /* I2C 1 */ +#define BOD_IRQ 20 /* Brown Out Detect */ +#define EMAC_IRQ 21 /* Ethernet */ +#define USB_IRQ 22 /* USB */ +#define CAN_IRQ 23 /* CAN */ +#define MCI_IRQ 24 /* SD/MMC Interface */ +#define GPDMA_IRQ 25 /* General Purpose DMA */ +#define TIMER2_IRQ 26 /* Timer 2 */ +#define TIMER3_IRQ 27 /* Timer 3 */ +#define UART2_IRQ 28 /* Uart 2 */ +#define UART3_IRQ 29 /* Uart 3 */ +#define I2C2_IRQ 30 /* I2C 2 */ +#define I2S_IRQ 31 /* I2S */ + + +#define IRQ_SYSTIMER TIMER0_IRQ + +#define NR_IRQS 32 + +/* There are 32 vectored interrupts. If vectored interrupts are enabled, the + * following will be used by the system. + */ +#define SYSTIMER_VEC 0 /* System timer */ + +#define CLASS_IRQ 0 +#define CLASS_FIQ 1 +#define PRIORITY_LOWEST 15 +#define PRIORITY_HIGHEST 0 /* System timer */ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +typedef void (*vic_vector_t)(uint32_t *regs); +#endif + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#ifndef CONFIG_VECTORED_INTERRUPTS +EXTERN void up_attach_vector(int irq, int priority, vic_vector_t handler); +EXTERN void up_detach_vector(int vector); +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif +#endif + +#endif /* __ARCH_LPC2378_IRQ_H */ + diff --git a/nuttx/configs/olimex-lpc2378/README.txt b/nuttx/configs/olimex-lpc2378/README.txt new file mode 100644 index 000000000..9b28f1b3f --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/README.txt @@ -0,0 +1,11 @@ +There's not much here: + +EXT1 - P3 0:7 are used for LEDs. + +UEXT pin 3/4 -TXD2/RXD2- is UART2. + +The board I have has the revision '-' of LPC2378 even though I got the board +more than 2 years after the chip revision was released :-( . +I can't get Nuttx to work if I fully enabled the MAM. + +I used FTDI ft232 usb-serial with nsh piping as seen on the screenshot. diff --git a/nuttx/configs/olimex-lpc2378/include/README.txt b/nuttx/configs/olimex-lpc2378/include/README.txt new file mode 100644 index 000000000..60f959c8f --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/include/README.txt @@ -0,0 +1 @@ +This directory contains header files unique to the OLIMEX-LPC2378 STK board. diff --git a/nuttx/configs/olimex-lpc2378/include/board.h b/nuttx/configs/olimex-lpc2378/include/board.h new file mode 100755 index 000000000..c6dd70c1d --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/include/board.h @@ -0,0 +1,90 @@ +/****************************************************************************
+ * configs/olimex-lpc2378/include/board.h
+ *
+ * Copyright (C) 2010 Rommel Marcelo. All rights reserved.
+ * Author: Rommel Marcelo
+ *
+ * This is part of the NuttX RTOS and based on the LPC2148 port:
+ *
+ * Copyright (C) 2010 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 NuttX 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.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* If USB is enabled, PLL must be configured for 48MHz to provide USB clocking */
+//-- F_pll = (2 * M * F_in)/N
+//-- F_out = ((2 * (PLL_M + 1 ) * FOSC)/(0+1))/(CCLK_DIV+1) = 288/5 = 57 600 000 Hz
+//~ #ifdef CONFIG_USBDEV
+ //~ # define FOSC (12000000) /* Oscillator frequency */
+ //~ # define CCLK (57600000) /* CPU running clock */
+ //~ # define FCCO (288000000) /* CPU CCO clock */
+//~ #else
+ # define FOSC (12000000) /* Oscillator frequency */
+ # define CCLK (57600000) /* CPU running clock */
+ # define FCCO (288000000) /* CPU CCO clock */
+ //~ # define CCLK (72000000) /* CPU running clock */
+ //~ # define FCCO (360000000) /* CPU CCO clock */
+//~ #endif
+
+//~#define PLL_M ( (FCCO / (2 * FOSC))-1 )
+//~ #define PLL_N ( ((2 * PLL_M * FOSC) / FCCO)-1 )
+#define PLL_M 11
+#define PLL_N 0
+
+#define CCLK_DIV 4
+#define USBCLK_DIV 6
+
+ /* LED definitions **********************************************************/
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_STACKCREATED 3
+#define LED_INIRQ 4
+#define LED_SIGNAL 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+#ifdef __cplusplus
+ }
+#endif
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/olimex-lpc2378/nsh/Make.defs b/nuttx/configs/olimex-lpc2378/nsh/Make.defs new file mode 100755 index 000000000..77203891b --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/nsh/Make.defs @@ -0,0 +1,157 @@ +############################################################################## +# configs/olimex-lpc2378/nsh/Make.defs +# +# Copyright (C) 2010 Rommel Marcelo. All rights reserved. +# Author: Rommel Marcelo +# +# This is part of the NuttX RTOS and based on the LPC2148 port: +# +# Copyright (C) 2010 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 NuttX 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. +# +############################################################################## + +include ${TOPDIR}/.config + +# The default value for CROSSDEV can be overridden from the make command line: +# make -- Will build for the NuttX buildroot toolchain +# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain +# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain +# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain + +CROSSDEV = arm-elf- +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +HOSTOS = ${shell uname -o} + +ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} +ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} + +ifeq ($(ARCHCCMAJOR),4) +ifneq ($(HOSTOS),Cygwin) +OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment +endif +endif + +ifeq ($(CROSSDEV),arm-elf-) + MKDEP = $(TOPDIR)/tools/mkdeps.sh + ARCHINCLUDES = -I. -isystem $(TOPDIR)/include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script + MAXOPTIMIZATION = -Os +else + WINTOOL = y + DIRLINK = $(TOPDIR)/tools/winlink.sh + DIRUNLINK = $(TOPDIR)/tools/unlink.sh + MKDEP = $(TOPDIR)/tools/mknulldeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}" + MAXOPTIMIZATION = -O2 +endif + +ifeq ("${CONFIG_DEBUG}","y") + ARCHOPTIMIZATION = -g +else + ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer +endif + +ifeq ($(ARCHCCMAJOR),4) + ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft +else + ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions +ARCHPICFLAGS = -fpic +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow +ARCHWARNINGSXX = -Wall -Wshadow +ARCHDEFINES = + +CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +ifneq ($(CROSSDEV),arm-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG),y) + LDFLAGS += -g +endif + +define PREPROCESS + @echo "CPP: $1->$2" + @$(CPP) $(CPPFLAGS) $1 -o $2 +endef + +define COMPILE + @echo "CC: $1" + @$(CC) -c $(CFLAGS) $1 -o $2 +endef + +define COMPILEXX + @echo "CXX: $1" + @$(CXX) -c $(CXXFLAGS) $1 -o $2 +endef + +define ASSEMBLE + @echo "AS: $1" + @$(CC) -c $(AFLAGS) $1 -o $2 +endef + +define ARCHIVE + echo "AR: $2"; \ + $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; } +endef + +define CLEAN + @rm -f *.o *.a +endef + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = + diff --git a/nuttx/configs/olimex-lpc2378/nsh/defconfig b/nuttx/configs/olimex-lpc2378/nsh/defconfig new file mode 100755 index 000000000..f8b22ac91 --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/nsh/defconfig @@ -0,0 +1,438 @@ +############################################################################ +# configs/olimex-lpc2378/nsh/defconfig +# +# Copyright (C) 2010 Rommel Marcelo. All rights reserved. +# Author: Rommel Marcelo +# +# This is part of the NuttX RTOS and based on the LPC2148 port: +# +# Copyright (C) 2010 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 NuttX 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. +# +############################################################################ +# +# Architecture selection +# +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_family - for use in C code. This identifies the +# particular chip family that the architecture is implemented +# in. +# CONFIG_ARCH_architecture - for use in C code. This identifies the +# specific architecture within the chip familyl. +# CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory +# CONFIG_ARCH_CHIP_name - For use in C code +# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_ENDIAN_BIG - define if big endian (default is little endian) +# CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_ARCH_IRQPRIO +# Define if the architecture suports prioritizaton of interrupts +# and the up_prioritize_irq() API. +# CONFIG_BOARD_LOOPSPERMSEC - for delay loops +# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to lpc2148. +# CONFIG_DRAM_SIZE - Describes the internal DRAM. +# CONFIG_DRAM_START - The start address of internal DRAM +# CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt +# stack. If defined, this symbol is the size of the interrupt +# stack in bytes. If not defined, the user task stacks will be +# used during interrupt handling. +# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions +# +CONFIG_ARCH=arm +CONFIG_ARCH_ARM=y +CONFIG_ARCH_ARM7TDMI=y +CONFIG_ARCH_CHIP=lpc2378 +CONFIG_ARCH_LPC2378=y +CONFIG_ARCH_BOARD=olimex-lpc2378 +CONFIG_ARCH_IRQPRIO=y +CONFIG_BOARD_LOOPSPERMSEC=3270 +CONFIG_ARCH_LEDS=y +CONFIG_DRAM_SIZE=0x00008000 +CONFIG_DRAM_START=0x40000000 +CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE) +CONFIG_ARCH_INTERRUPTSTACK= +CONFIG_ARCH_STACKDUMP=y + +# +# LPC2378 specific chip initialization +#CONFIG_PLL_CLKSRC - identifies the clock source to use +# IRC = 0, MAIN = 1, RTC = 2 +# +CONFIG_EXTMEM_MODE=n +CONFIG_RAM_MODE=n +CONFIG_CODE_BASE=0x00000000 +CONFIG_PLL_SETUP=y +CONFIG_PLL_CLKSRC= 1 +CONFIG_MAM_SETUP=y +#TODO: CONFIG_EMC_SETUP=n +CONFIG_ADC_SETUP=n +CONFIG_USBDEV=n +CONFIG_UART0=y +CONFIG_UART2=y + +# +# LPC23xx specific device driver settings +# +# CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the +# console and ttys0 (default is the UART0). +# CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received. +# This specific the size of the receive buffer +# CONFIG_UARTn_TXBUFSIZE - Characters are buffered before +# being sent. This specify the size of the transmit buffer +# CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be +# CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8. +# CONFIG_UARTn_PARITY - 0=no parity, 1=odd parity, 2=even parity, 3=mark 1, 4=space 0 +# CONFIG_UARTn_2STOP - Two stop bits +# +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_UART2_SERIAL_CONSOLE=n + +CONFIG_UART0_TXBUFSIZE=128 +CONFIG_UART2_TXBUFSIZE=256 + +CONFIG_UART0_RXBUFSIZE=128 +CONFIG_UART2_RXBUFSIZE=256 + +# Baud Rate +CONFIG_UART0_BAUD=9600 +CONFIG_UART2_BAUD=576000 +# Data Bits +CONFIG_UART0_BITS=8 +CONFIG_UART2_BITS=8 +# Parity Bits +CONFIG_UART0_PARITY=0 +CONFIG_UART2_PARITY=0 +# 2 Stop Bits ? +CONFIG_UART0_2STOP=0 +CONFIG_UART2_2STOP=0 + +# +# General build options +# +# CONFIG_RRLOAD_BINARY - make the rrload binary format used with +# BSPs from www.ridgerun.com using the tools/mkimage.sh script +# CONFIG_INTELHEX_BINARY - make the Intel HEX binary format +# used with many different loaders using the GNU objcopy program +# Should not be selected if you are not using the GNU toolchain. +# CONFIG_RAW_BINARY - make a raw binary format file used with many +# different loaders using the GNU objcopy program. This option +# should not be selected if you are not using the GNU toolchain. +# CONFIG_HAVE_LIBM - toolchain supports libm.a +# +CONFIG_RRLOAD_BINARY=n +CONFIG_INTELHEX_BINARY=n +CONFIG_RAW_BINARY=y +CONFIG_HAVE_LIBM=n + +# +# General OS setup +# +# CONFIG_EXAMPLE - identifies the subdirectory in examples +# that will be used in the build +# CONFIG_DEBUG - enables built-in debug options +# CONFIG_DEBUG_VERBOSE - enables verbose debug output +# CONFIG_MM_REGIONS - If the architecture includes multiple +# regions of memory to allocate from, this specifies the +# number of memory regions that the memory manager must +# handle and enables the API mm_addregion(start, end); +# CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot +# time console output +# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz +# or TICKS_PER_MSEC=10. This setting may be defined to +# inform NuttX that the processor hardware is providing +# system timer interrupts at some interrupt interval other +# than 10 msec. +# CONFIG_RR_INTERVAL - The round robin timeslice will be set +# this number of milliseconds; Round robin scheduling can +# be disabled by setting this value to zero. +# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in +# scheduler to monitor system performance +# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a +# task name to save in the TCB. Useful if scheduler +# instrumentation is selected. Set to zero to disable. +# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY - +# Used to initialize the internal time logic. +# CONFIG_JULIAN_TIME - Enables Julian time conversions +# CONFIG_DEV_CONSOLE - Set if architecture-specific logic +# provides /dev/console. Enables stdout, stderr, stdin. +# CONFIG_DEV_LOWCONSOLE - Use the simple, low-level serial console +# driver (minimal support) +# +CONFIG_EXAMPLE=nsh +CONFIG_DEBUG=n +CONFIG_DEBUG_VERBOSE=n +#CONFIG_DEBUG_MM=y +#CONFIG_DEBUG_SCHED=y +CONFIG_DEBUG_FS=y +CONFIG_MM_REGIONS=1 +CONFIG_ARCH_LOWPUTC=y +CONFIG_RR_INTERVAL=0 +CONFIG_SCHED_INSTRUMENTATION=n +CONFIG_TASK_NAME_SIZE=0 +CONFIG_START_YEAR=2010 +CONFIG_START_MONTH=4 +CONFIG_START_DAY=8 +CONFIG_JULIAN_TIME=n +CONFIG_DEV_CONSOLE=y +CONFIG_DEV_LOWCONSOLE= +CONFIG_MUTEX_TYPES=n +CONFIG_PRIORITY_INHERITANCE=n +CONFIG_SEM_PREALLOCHOLDERS=0 +CONFIG_SEM_NNESTPRIO=0 +CONFIG_FDCLONE_DISABLE=n +CONFIG_FDCLONE_STDIO=n +CONFIG_SDCLONE_DISABLE=y +CONFIG_NXFLAT=n +# +# The following can be used to disable categories of +# APIs supported by the OS. If the compiler supports +# weak functions, then it should not be necessary to +# disable functions unless you want to restrict usage +# of those APIs. +# +# There are certain dependency relationships in these +# features. +# +# o mq_notify logic depends on signals to awaken tasks +# waiting for queues to become full or empty. +# o pthread_condtimedwait() depends on signals to wake +# up waiting tasks. +# +CONFIG_DISABLE_CLOCK=n +CONFIG_DISABLE_POSIX_TIMERS=n +CONFIG_DISABLE_PTHREAD=n +CONFIG_DISABLE_SIGNALS=n +CONFIG_DISABLE_MQUEUE=n +CONFIG_DISABLE_MOUNTPOINT=n +CONFIG_DISABLE_ENVIRON=n +CONFIG_DISABLE_POLL=y + +# +# Misc libc settings +# +# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a +# little smaller if we do not support fieldwidthes +# +CONFIG_NOPRINTF_FIELDWIDTH=n + +# +# Allow for architecture optimized implementations +# +# The architecture can provide optimized versions of the +# following to improve sysem performance +# +CONFIG_ARCH_MEMCPY=n +CONFIG_ARCH_MEMCMP=n +CONFIG_ARCH_MEMMOVE=n +CONFIG_ARCH_MEMSET=n +CONFIG_ARCH_STRCMP=n +CONFIG_ARCH_STRCPY=n +CONFIG_ARCH_STRNCPY=n +CONFIG_ARCH_STRLEN=n +CONFIG_ARCH_BZERO=n +CONFIG_ARCH_KMALLOC=n +CONFIG_ARCH_KZMALLOC=n +CONFIG_ARCH_KFREE=n + +# +# Sizes of configurable things (0 disables) +# +# CONFIG_MAX_TASKS - The maximum number of simultaneously +# active tasks. This value must be a power of two. +# CONFIG_MAX_TASK_ARGS - This controls the maximum number of +# of parameters that a task may receive (i.e., maxmum value +# of 'argc') +# CONFIG_NPTHREAD_KEYS - The number of items of thread- +# specific data that can be retained +# CONFIG_NFILE_DESCRIPTORS - The maximum number of file +# descriptors (one for each open) +# CONFIG_NFILE_STREAMS - The maximum number of streams that +# can be fopen'ed +# CONFIG_NAME_MAX - The maximum size of a file name. +# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate +# on fopen. (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_NUNGET_CHARS - Number of characters that can be +# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message +# structures. The system manages a pool of preallocated +# message structures to minimize dynamic allocations +# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with +# a fixed payload size given by this settin (does not include +# other message structure overhead. +# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that +# can be passed to a watchdog handler +# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog +# structures. The system manages a pool of preallocated +# watchdog structures to minimize dynamic allocations +# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX +# timer structures. The system manages a pool of preallocated +# timer structures to minimize dynamic allocations. Set to +# zero for all dynamic allocations. +# +CONFIG_MAX_TASKS=16 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_NUNGET_CHARS=2 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=4 + +# +# Filesystem configuration +# +# CONFIG_FS_FAT - Enable FAT filesystem support +# CONFIG_FAT_SECTORSIZE - Max supported sector size +# CONFIG_FS_ROMFS - Enable ROMFS filesystem support +CONFIG_FS_FAT=y +CONFIG_FS_ROMFS=n + +# +# SPI-based MMC/SD driver +# +# CONFIG_MMCSD_NSLOTS +# Number of MMC/SD slots supported by the driver +# CONFIG_MMCSD_READONLY +# Provide read-only access (default is read/write) +# CONFIG_MMCSD_SPICLOCK - Maximum SPI clock to drive MMC/SD card. +# Default is 20MHz. +# +CONFIG_MMCSD_NSLOTS=1 +CONFIG_MMCSD_READONLY=n +CONFIG_MMCSD_SPICLOCK=20000000 + +# +# Settings for examples/hello +CONFIG_EXAMPLES_OSTEST_LOOPS=1 +CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096 +CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 + +# Settings for examples/serloop +CONFIG_EXAMPLES_SERLOOP_BUFIO= + +# +# Settings for examples/nsh +# +# CONFIG_EXAMPLES_NSH_FILEIOSIZE - Size of a static I/O buffer +# CONFIG_EXAMPLES_NSH_STRERROR - Use strerror(errno) +# CONFIG_EXAMPLES_NSH_LINELEN - Maximum length of one command line +# CONFIG_EXAMPLES_NSH_STACKSIZE - Stack size to use for new threads. +# CONFIG_EXAMPLES_NSH_NESTDEPTH - Max number of nested if-then[-else]-fi +# CONFIG_EXAMPLES_NSH_DISABLESCRIPT - Disable scripting support +# CONFIG_EXAMPLES_NSH_DISABLEBG - Disable background commands +# CONFIG_EXAMPLES_NSH_ROMFSETC - Use startup script in /etc +# CONFIG_EXAMPLES_NSH_CONSOLE - Use serial console front end +# CONFIG_EXAMPLES_NSH_TELNET - Use telnetd console front end +# CONFIG_EXAMPLES_NSH_ARCHINIT - Platform provides architecture +# specific initialization (nsh_archinitialize()). +# +# If CONFIG_EXAMPLES_NSH_TELNET is selected: +# CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE -- Telnetd I/O buffer size +# CONFIG_EXAMPLES_NSH_DHCPC - Obtain address using DHCP +# CONFIG_EXAMPLES_NSH_IPADDR - Provides static IP address +# CONFIG_EXAMPLES_NSH_DRIPADDR - Provides static router IP address +# CONFIG_EXAMPLES_NSH_NETMASK - Provides static network mask +# CONFIG_EXAMPLES_NSH_NOMAC - Use a bogus MAC address +# +# If CONFIG_EXAMPLES_NSH_ROMFSETC is selected: +# CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT - ROMFS mountpoint +# CONFIG_EXAMPLES_NSH_INITSCRIPT - Relative path to init script +# CONFIG_EXAMPLES_NSH_ROMFSDEVNO - ROMFS RAM device minor +# CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE - ROMF sector size +# CONFIG_EXAMPLES_NSH_FATDEVNO - FAT FS RAM device minor +# CONFIG_EXAMPLES_NSH_FATSECTSIZE - FAT FS sector size +# CONFIG_EXAMPLES_NSH_FATNSECTORS - FAT FS number of sectors +# CONFIG_EXAMPLES_NSH_FATMOUNTPT - FAT FS mountpoint +# +CONFIG_EXAMPLES_NSH_FILEIOSIZE=512 +CONFIG_EXAMPLES_NSH_STRERROR=n +CONFIG_EXAMPLES_NSH_LINELEN=64 +CONFIG_EXAMPLES_NSH_STACKSIZE=2048 +CONFIG_EXAMPLES_NSH_NESTDEPTH=3 +CONFIG_EXAMPLES_NSH_DISABLESCRIPT=n +CONFIG_EXAMPLES_NSH_DISABLEBG=n +CONFIG_EXAMPLES_NSH_ROMFSETC=n +CONFIG_EXAMPLES_NSH_CONSOLE=y +CONFIG_EXAMPLES_NSH_TELNET=n +CONFIG_EXAMPLES_NSH_ARCHINIT=n +CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512 +CONFIG_EXAMPLES_NSH_DHCPC=n +CONFIG_EXAMPLES_NSH_NOMAC=n +CONFIG_EXAMPLES_NSH_IPADDR=(10<<24|0<<16|0<<8|2) +CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) +CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0) +CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT="/etc" +CONFIG_EXAMPLES_NSH_INITSCRIPT="init.d/rcS" +CONFIG_EXAMPLES_NSH_ROMFSDEVNO=0 +CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE=64 +CONFIG_EXAMPLES_NSH_FATDEVNO=1 +CONFIG_EXAMPLES_NSH_FATSECTSIZE=512 +CONFIG_EXAMPLES_NSH_FATNSECTORS=1024 +CONFIG_EXAMPLES_NSH_FATMOUNTPT=/tmp + + +# Stack and heap information +# +# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP +# operation from FLASH but must copy initialized .data sections to RAM. +# (Must always =n; the LPC23xx always runs from FLASH) +# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH +# but copy themselves entirely into RAM for better performance. +# CONFIG_CUSTOM_STACK - The up_ implementation will handle +# all stack operations outside of the nuttx model. +# CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only) +# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack. +# This is the thread that (1) performs the inital boot of the system up +# to the point where user_start() is spawned, and (2) there after is the +# IDLE thread that executes only when there is no other thread ready to +# run. +# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate +# for the main user thread that begins at the user_start() entry point. +# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size +# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size +# CONFIG_HEAP_BASE - The beginning of the heap +# CONFIG_HEAP_SIZE - The size of the heap +# +#CONFIG_BOOT_RUNFROMFLASH= +CONFIG_BOOT_COPYTORAM=n +CONFIG_CUSTOM_STACK=n +CONFIG_STACK_POINTER= +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 +CONFIG_HEAP_BASE= +CONFIG_HEAP_SIZE= diff --git a/nuttx/configs/olimex-lpc2378/nsh/ld.script b/nuttx/configs/olimex-lpc2378/nsh/ld.script new file mode 100755 index 000000000..34d6b958d --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/nsh/ld.script @@ -0,0 +1,166 @@ +/**************************************************************************** + * configs/olimex-lpc2378/nsh/ld.script + * + * Copyright (C) 2010 Rommel Marcelo. All rights reserved. + * Author: Rommel Marcelo + * + * This is part of the NuttX RTOS and based on the LPC2148 port: + * + * Copyright (C) 2010 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 NuttX 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. + * + ****************************************************************************/ +MEMORY +{ + ROM (rx) : ORIGIN = 0x00000000, LENGTH = (512k-8k) /* Flash: 512k - boot code */ + RAM (rw) : ORIGIN = 0x40000000, LENGTH = (32k-32) /* SRAM: 32k - IAP work */ + URAM (rw) : ORIGIN = 0x7FD00000, LENGTH = (8k) /* USB RAM: 8k */ + ERAM (rw) : ORIGIN = 0x7FE00000, LENGTH = (16k) /* Ethernet RAM: 16k */ + BRAM (rw) : ORIGIN = 0xE0084000, LENGTH = (2k) /* Battery RAM: 2k */ +} + +OUTPUT_ARCH(arm) +ENTRY(_stext) +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) /* Startup code */ + *(.text .text.*) /* remaining code */ + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) /* read-only data (constants) */ + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + . = ALIGN(4); + } > ROM + + /* This is where the .data section is relocated for execution out + * FLASH. The .data section will be relocated from _eronly + * to _sdata at boot time. + */ + . = ALIGN(4); + _eronly = ABSOLUTE(.); + + .data : + { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > RAM AT > ROM + + .ARM.extab : { + *(.ARM.extab*) + } > RAM + + .ARM.exidx : { + __exidx_start = ABSOLUTE(.); + *(.ARM.exidx*) + __exidx_end = ABSOLUTE(.); + } > RAM + + +/* .bss section which is initialized by 0 */ + /* This section will be filled with zero by startup code */ + .bss (NOLOAD) : + { + _sbss = ABSOLUTE(.) ; + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b*) + *(COMMON) + _ebss = ABSOLUTE(.); + } > RAM + + .usbram (NOLOAD) : + { + __usbram_start = . ; + __usbram_start__ = . ; + *(.usbram) + . = ALIGN(4); + } > URAM + + .etherram (NOLOAD) : + { + __etherram_start = . ; + __etherram_start__ = . ; + *(.etherram) + . = ALIGN(4); + } > ERAM + + .batteryram (NOLOAD) : + { + __batteryram_start = . ; + __batteryram_start__ = . ; + *(.batteryram) + . = ALIGN(4); + } > BRAM + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/nuttx/configs/olimex-lpc2378/nsh/setenv.sh b/nuttx/configs/olimex-lpc2378/nsh/setenv.sh new file mode 100755 index 000000000..90871fd62 --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/nsh/setenv.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# configs/olimex-lpc2378/ostest/setenv.sh +# +# Copyright (C) 2010 Rommel Marcelo. All rights reserved. +# Author: Rommel Marcelo +# +# This is part of the NuttX RTOS and based on the LPC2148 port: +# +# Copyright (C) 2010 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 NuttX 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. +# + +if [ "$(basename $0)" = "setenv.sh" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi + +WD=`pwd` +export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin" +export LPC23XXSCRIPTS="$WD/configs/olimex-lpc2378/scripts" +export PATH="${BUILDROOT_BIN}:${LPC23XXSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}" + +echo "PATH : ${PATH}" diff --git a/nuttx/configs/olimex-lpc2378/ostest/Make.defs b/nuttx/configs/olimex-lpc2378/ostest/Make.defs new file mode 100755 index 000000000..b025fd1bb --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/ostest/Make.defs @@ -0,0 +1,165 @@ +############################################################################## +# configs/olimex-lpc2378/ostest/Make.defs +# +# Copyright (C) 2010 Rommel Marcelo. All rights reserved. +# Author: Rommel Marcelo +# +# This is part of the NuttX RTOS and based on the LPC2148 port: +# +# Copyright (C) 2010 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 NuttX 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. +# +############################################################################## + +include ${TOPDIR}/.config + +# The default value for CROSSDEV can be overridden from the make command line: +# make -- Will build for the NuttX buildroot toolchain +# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain +# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain +# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain + +CROSSDEV = arm-elf- +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +HOSTOS = ${shell uname -o} + +ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} +ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} + +ifeq ($(ARCHCCMAJOR),4) +ifneq ($(HOSTOS),Cygwin) +OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment +endif +endif + +ifeq ($(CROSSDEV),arm-elf-) + MKDEP = $(TOPDIR)/tools/mkdeps.sh + ARCHINCLUDES = -I. -isystem $(TOPDIR)/include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script + MAXOPTIMIZATION = -Os +else + WINTOOL = y + DIRLINK = $(TOPDIR)/tools/winlink.sh + DIRUNLINK = $(TOPDIR)/tools/unlink.sh + MKDEP = $(TOPDIR)/tools/mknulldeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}" + MAXOPTIMIZATION = -O2 +endif + +ifeq ("${CONFIG_DEBUG}","y") + ARCHOPTIMIZATION = -g +else + ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer +endif + +ifeq ($(ARCHCCMAJOR),4) + ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft +else + ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow +ARCHWARNINGSXX = -Wall -Wshadow +ARCHDEFINES = + +CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \ + -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \ + -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +ifneq ($(CROSSDEV),arm-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG),y) + LDFLAGS += -g +endif + +define PREPROCESS + @echo "CPP: $1->$2" + @$(CPP) $(CPPFLAGS) $1 -o $2 +endef + +define COMPILE + @echo "CC: $1" + @$(CC) -c $(CFLAGS) $1 -o $2 +endef + +define COMPILEXX + @echo "CXX: $1" + @$(CXX) -c $(CXXFLAGS) $1 -o $2 +endef + +define ASSEMBLE + @echo "AS: $1" + @$(CC) -c $(AFLAGS) $1 -o $2 +endef + +define ARCHIVE + echo "AR: $2"; \ + $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; } +endef + +define CLEAN + @rm -f *.o *.a +endef + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = + diff --git a/nuttx/configs/olimex-lpc2378/ostest/defconfig b/nuttx/configs/olimex-lpc2378/ostest/defconfig new file mode 100755 index 000000000..138895678 --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/ostest/defconfig @@ -0,0 +1,438 @@ +############################################################################ +# configs/olimex-lpc2378/ostest/defconfig +# +# Copyright (C) 2010 Rommel Marcelo. All rights reserved. +# Author: Rommel Marcelo +# +# This is part of the NuttX RTOS and based on the LPC2148 port: +# +# Copyright (C) 2010 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 NuttX 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. +# +############################################################################ +# +# Architecture selection +# +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_family - for use in C code. This identifies the +# particular chip family that the architecture is implemented +# in. +# CONFIG_ARCH_architecture - for use in C code. This identifies the +# specific architecture within the chip familyl. +# CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory +# CONFIG_ARCH_CHIP_name - For use in C code +# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_ENDIAN_BIG - define if big endian (default is little endian) +# CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_ARCH_IRQPRIO +# Define if the architecture suports prioritizaton of interrupts +# and the up_prioritize_irq() API. +# CONFIG_BOARD_LOOPSPERMSEC - for delay loops +# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to lpc2378. +# CONFIG_DRAM_SIZE - Describes the internal DRAM. +# CONFIG_DRAM_START - The start address of internal DRAM +# CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt +# stack. If defined, this symbol is the size of the interrupt +# stack in bytes. If not defined, the user task stacks will be +# used during interrupt handling. +# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions +# +CONFIG_ARCH=arm +CONFIG_ARCH_ARM=y +CONFIG_ARCH_ARM7TDMI=y +CONFIG_ARCH_CHIP=lpc2378 +CONFIG_ARCH_LPC2378=y +CONFIG_ARCH_BOARD=olimex-lpc2378 +CONFIG_ARCH_IRQPRIO=y +CONFIG_BOARD_LOOPSPERMSEC=3270 +CONFIG_ARCH_LEDS=y +CONFIG_DRAM_SIZE=0x00008000 +CONFIG_DRAM_START=0x40000000 +CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE) +CONFIG_ARCH_INTERRUPTSTACK= +CONFIG_ARCH_STACKDUMP=y + +# +# LPC2378 specific chip initialization +#CONFIG_PLL_CLKSRC - identifies the clock source to use +# IRC = 0, MAIN = 1, RTC = 2 +# +CONFIG_EXTMEM_MODE=n +CONFIG_RAM_MODE=n +CONFIG_CODE_BASE=0x00000000 +CONFIG_PLL_SETUP=y +CONFIG_PLL_CLKSRC= 1 +CONFIG_MAM_SETUP=y +#TODO: CONFIG_EMC_SETUP=n +CONFIG_ADC_SETUP=n +CONFIG_USBDEV=n +CONFIG_UART0=y +CONFIG_UART2=y + +# +# LPC23xx specific device driver settings +# +# CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the +# console and ttys0 (default is the UART0). +# CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received. +# This specific the size of the receive buffer +# CONFIG_UARTn_TXBUFSIZE - Characters are buffered before +# being sent. This specify the size of the transmit buffer +# CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be +# CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8. +# CONFIG_UARTn_PARITY - 0=no parity, 1=odd parity, 2=even parity, 3=mark 1, 4=space 0 +# CONFIG_UARTn_2STOP - Two stop bits +# +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_UART2_SERIAL_CONSOLE=n + +CONFIG_UART0_TXBUFSIZE=128 +CONFIG_UART2_TXBUFSIZE=256 + +CONFIG_UART0_RXBUFSIZE=128 +CONFIG_UART2_RXBUFSIZE=256 + +# Baud Rate +CONFIG_UART0_BAUD=9600 +CONFIG_UART2_BAUD=576000 +# Data Bits +CONFIG_UART0_BITS=8 +CONFIG_UART2_BITS=8 +# Parity Bits +CONFIG_UART0_PARITY=0 +CONFIG_UART2_PARITY=0 +# 2 Stop Bits ? +CONFIG_UART0_2STOP=0 +CONFIG_UART2_2STOP=0 + +# +# General build options +# +# CONFIG_RRLOAD_BINARY - make the rrload binary format used with +# BSPs from www.ridgerun.com using the tools/mkimage.sh script +# CONFIG_INTELHEX_BINARY - make the Intel HEX binary format +# used with many different loaders using the GNU objcopy program +# Should not be selected if you are not using the GNU toolchain. +# CONFIG_RAW_BINARY - make a raw binary format file used with many +# different loaders using the GNU objcopy program. This option +# should not be selected if you are not using the GNU toolchain. +# CONFIG_HAVE_LIBM - toolchain supports libm.a +# +CONFIG_RRLOAD_BINARY=n +CONFIG_INTELHEX_BINARY=y +CONFIG_RAW_BINARY=y +CONFIG_HAVE_LIBM=n + +# +# General OS setup +# +# CONFIG_EXAMPLE - identifies the subdirectory in examples +# that will be used in the build +# CONFIG_DEBUG - enables built-in debug options +# CONFIG_DEBUG_VERBOSE - enables verbose debug output +# CONFIG_MM_REGIONS - If the architecture includes multiple +# regions of memory to allocate from, this specifies the +# number of memory regions that the memory manager must +# handle and enables the API mm_addregion(start, end); +# CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot +# time console output +# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz +# or TICKS_PER_MSEC=10. This setting may be defined to +# inform NuttX that the processor hardware is providing +# system timer interrupts at some interrupt interval other +# than 10 msec. +# CONFIG_RR_INTERVAL - The round robin timeslice will be set +# this number of milliseconds; Round robin scheduling can +# be disabled by setting this value to zero. +# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in +# scheduler to monitor system performance +# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a +# task name to save in the TCB. Useful if scheduler +# instrumentation is selected. Set to zero to disable. +# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY - +# Used to initialize the internal time logic. +# CONFIG_JULIAN_TIME - Enables Julian time conversions +# CONFIG_DEV_CONSOLE - Set if architecture-specific logic +# provides /dev/console. Enables stdout, stderr, stdin. +# CONFIG_DEV_LOWCONSOLE - Use the simple, low-level serial console +# driver (minimal support) +# +CONFIG_EXAMPLE=ostest +CONFIG_DEBUG=n +CONFIG_DEBUG_VERBOSE=n +#CONFIG_DEBUG_MM=y +#CONFIG_DEBUG_SCHED=y +#CONFIG_DEBUG_FS=y +CONFIG_MM_REGIONS=1 +CONFIG_ARCH_LOWPUTC=y +CONFIG_RR_INTERVAL=0 +CONFIG_SCHED_INSTRUMENTATION=n +CONFIG_TASK_NAME_SIZE=0 +CONFIG_START_YEAR=2009 +CONFIG_START_MONTH=7 +CONFIG_START_DAY=13 +CONFIG_JULIAN_TIME=n +CONFIG_DEV_CONSOLE=y +CONFIG_DEV_LOWCONSOLE= +CONFIG_MUTEX_TYPES=n +CONFIG_PRIORITY_INHERITANCE=n +CONFIG_SEM_PREALLOCHOLDERS=0 +CONFIG_SEM_NNESTPRIO=0 +CONFIG_FDCLONE_DISABLE=n +CONFIG_FDCLONE_STDIO=n +CONFIG_SDCLONE_DISABLE=y +CONFIG_NXFLAT=n +# +# The following can be used to disable categories of +# APIs supported by the OS. If the compiler supports +# weak functions, then it should not be necessary to +# disable functions unless you want to restrict usage +# of those APIs. +# +# There are certain dependency relationships in these +# features. +# +# o mq_notify logic depends on signals to awaken tasks +# waiting for queues to become full or empty. +# o pthread_condtimedwait() depends on signals to wake +# up waiting tasks. +# +CONFIG_DISABLE_CLOCK=n +CONFIG_DISABLE_POSIX_TIMERS=n +CONFIG_DISABLE_PTHREAD=n +CONFIG_DISABLE_SIGNALS=n +CONFIG_DISABLE_MQUEUE=n +CONFIG_DISABLE_MOUNTPOINT=n +CONFIG_DISABLE_ENVIRON=n +CONFIG_DISABLE_POLL=y + +# +# Misc libc settings +# +# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a +# little smaller if we do not support fieldwidthes +# +CONFIG_NOPRINTF_FIELDWIDTH=n + +# +# Allow for architecture optimized implementations +# +# The architecture can provide optimized versions of the +# following to improve sysem performance +# +CONFIG_ARCH_MEMCPY=n +CONFIG_ARCH_MEMCMP=n +CONFIG_ARCH_MEMMOVE=n +CONFIG_ARCH_MEMSET=n +CONFIG_ARCH_STRCMP=n +CONFIG_ARCH_STRCPY=n +CONFIG_ARCH_STRNCPY=n +CONFIG_ARCH_STRLEN=n +CONFIG_ARCH_BZERO=n +CONFIG_ARCH_KMALLOC=n +CONFIG_ARCH_KZMALLOC=n +CONFIG_ARCH_KFREE=n + +# +# Sizes of configurable things (0 disables) +# +# CONFIG_MAX_TASKS - The maximum number of simultaneously +# active tasks. This value must be a power of two. +# CONFIG_MAX_TASK_ARGS - This controls the maximum number of +# of parameters that a task may receive (i.e., maxmum value +# of 'argc') +# CONFIG_NPTHREAD_KEYS - The number of items of thread- +# specific data that can be retained +# CONFIG_NFILE_DESCRIPTORS - The maximum number of file +# descriptors (one for each open) +# CONFIG_NFILE_STREAMS - The maximum number of streams that +# can be fopen'ed +# CONFIG_NAME_MAX - The maximum size of a file name. +# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate +# on fopen. (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_NUNGET_CHARS - Number of characters that can be +# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message +# structures. The system manages a pool of preallocated +# message structures to minimize dynamic allocations +# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with +# a fixed payload size given by this settin (does not include +# other message structure overhead. +# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that +# can be passed to a watchdog handler +# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog +# structures. The system manages a pool of preallocated +# watchdog structures to minimize dynamic allocations +# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX +# timer structures. The system manages a pool of preallocated +# timer structures to minimize dynamic allocations. Set to +# zero for all dynamic allocations. +# +CONFIG_MAX_TASKS=16 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_NUNGET_CHARS=2 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=4 + +# +# Filesystem configuration +# +# CONFIG_FS_FAT - Enable FAT filesystem support +# CONFIG_FAT_SECTORSIZE - Max supported sector size +# CONFIG_FS_ROMFS - Enable ROMFS filesystem support +CONFIG_FS_FAT=n +CONFIG_FS_ROMFS=n + +# +# SPI-based MMC/SD driver +# +# CONFIG_MMCSD_NSLOTS +# Number of MMC/SD slots supported by the driver +# CONFIG_MMCSD_READONLY +# Provide read-only access (default is read/write) +# CONFIG_MMCSD_SPICLOCK - Maximum SPI clock to drive MMC/SD card. +# Default is 20MHz. +# +CONFIG_MMCSD_NSLOTS=0 +CONFIG_MMCSD_READONLY=n +CONFIG_MMCSD_SPICLOCK=20000000 + +# +# Settings for examples/hello +CONFIG_EXAMPLES_OSTEST_LOOPS=1 +CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096 +CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 + +# Settings for examples/serloop +CONFIG_EXAMPLES_SERLOOP_BUFIO= + +# +# Settings for examples/nsh +# +# CONFIG_EXAMPLES_NSH_FILEIOSIZE - Size of a static I/O buffer +# CONFIG_EXAMPLES_NSH_STRERROR - Use strerror(errno) +# CONFIG_EXAMPLES_NSH_LINELEN - Maximum length of one command line +# CONFIG_EXAMPLES_NSH_STACKSIZE - Stack size to use for new threads. +# CONFIG_EXAMPLES_NSH_NESTDEPTH - Max number of nested if-then[-else]-fi +# CONFIG_EXAMPLES_NSH_DISABLESCRIPT - Disable scripting support +# CONFIG_EXAMPLES_NSH_DISABLEBG - Disable background commands +# CONFIG_EXAMPLES_NSH_ROMFSETC - Use startup script in /etc +# CONFIG_EXAMPLES_NSH_CONSOLE - Use serial console front end +# CONFIG_EXAMPLES_NSH_TELNET - Use telnetd console front end +# CONFIG_EXAMPLES_NSH_ARCHINIT - Platform provides architecture +# specific initialization (nsh_archinitialize()). +# +# If CONFIG_EXAMPLES_NSH_TELNET is selected: +# CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE -- Telnetd I/O buffer size +# CONFIG_EXAMPLES_NSH_DHCPC - Obtain address using DHCP +# CONFIG_EXAMPLES_NSH_IPADDR - Provides static IP address +# CONFIG_EXAMPLES_NSH_DRIPADDR - Provides static router IP address +# CONFIG_EXAMPLES_NSH_NETMASK - Provides static network mask +# CONFIG_EXAMPLES_NSH_NOMAC - Use a bogus MAC address +# +# If CONFIG_EXAMPLES_NSH_ROMFSETC is selected: +# CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT - ROMFS mountpoint +# CONFIG_EXAMPLES_NSH_INITSCRIPT - Relative path to init script +# CONFIG_EXAMPLES_NSH_ROMFSDEVNO - ROMFS RAM device minor +# CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE - ROMF sector size +# CONFIG_EXAMPLES_NSH_FATDEVNO - FAT FS RAM device minor +# CONFIG_EXAMPLES_NSH_FATSECTSIZE - FAT FS sector size +# CONFIG_EXAMPLES_NSH_FATNSECTORS - FAT FS number of sectors +# CONFIG_EXAMPLES_NSH_FATMOUNTPT - FAT FS mountpoint +# +CONFIG_EXAMPLES_NSH_FILEIOSIZE=512 +CONFIG_EXAMPLES_NSH_STRERROR=n +CONFIG_EXAMPLES_NSH_LINELEN=64 +CONFIG_EXAMPLES_NSH_STACKSIZE=2048 +CONFIG_EXAMPLES_NSH_NESTDEPTH=3 +CONFIG_EXAMPLES_NSH_DISABLESCRIPT=n +CONFIG_EXAMPLES_NSH_DISABLEBG=n +CONFIG_EXAMPLES_NSH_ROMFSETC=n +CONFIG_EXAMPLES_NSH_CONSOLE=y +CONFIG_EXAMPLES_NSH_TELNET=n +CONFIG_EXAMPLES_NSH_ARCHINIT=n +CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512 +CONFIG_EXAMPLES_NSH_DHCPC=n +CONFIG_EXAMPLES_NSH_NOMAC=n +CONFIG_EXAMPLES_NSH_IPADDR=(10<<24|0<<16|0<<8|2) +CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) +CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0) +CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT="/etc" +CONFIG_EXAMPLES_NSH_INITSCRIPT="init.d/rcS" +CONFIG_EXAMPLES_NSH_ROMFSDEVNO=0 +CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE=64 +CONFIG_EXAMPLES_NSH_FATDEVNO=1 +CONFIG_EXAMPLES_NSH_FATSECTSIZE=512 +CONFIG_EXAMPLES_NSH_FATNSECTORS=1024 +CONFIG_EXAMPLES_NSH_FATMOUNTPT=/tmp + + +# Stack and heap information +# +# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP +# operation from FLASH but must copy initialized .data sections to RAM. +# (Must always =n; the LPC23xx always runs from FLASH) +# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH +# but copy themselves entirely into RAM for better performance. +# CONFIG_CUSTOM_STACK - The up_ implementation will handle +# all stack operations outside of the nuttx model. +# CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only) +# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack. +# This is the thread that (1) performs the inital boot of the system up +# to the point where user_start() is spawned, and (2) there after is the +# IDLE thread that executes only when there is no other thread ready to +# run. +# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate +# for the main user thread that begins at the user_start() entry point. +# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size +# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size +# CONFIG_HEAP_BASE - The beginning of the heap +# CONFIG_HEAP_SIZE - The size of the heap +# +#CONFIG_BOOT_RUNFROMFLASH= +CONFIG_BOOT_COPYTORAM=n +CONFIG_CUSTOM_STACK=n +CONFIG_STACK_POINTER= +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 +CONFIG_HEAP_BASE= +CONFIG_HEAP_SIZE= diff --git a/nuttx/configs/olimex-lpc2378/ostest/ld.script b/nuttx/configs/olimex-lpc2378/ostest/ld.script new file mode 100755 index 000000000..e72913093 --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/ostest/ld.script @@ -0,0 +1,166 @@ +/**************************************************************************** + * configs/olimex-lpc2378/ostest/ld.script + * + * Copyright (C) 2010 Rommel Marcelo. All rights reserved. + * Author: Rommel Marcelo + * + * This is part of the NuttX RTOS and based on the LPC2148 port: + * + * Copyright (C) 2010 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 NuttX 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. + * + ****************************************************************************/ +MEMORY +{ + ROM (rx) : ORIGIN = 0x00000000, LENGTH = (512k-8k) /* Flash: 512k - boot code */ + RAM (rw) : ORIGIN = 0x40000000, LENGTH = (32k-32) /* SRAM: 32k - IAP work */ + URAM (rw) : ORIGIN = 0x7FD00000, LENGTH = (8k) /* USB RAM: 8k */ + ERAM (rw) : ORIGIN = 0x7FE00000, LENGTH = (16k) /* Ethernet RAM: 16k */ + BRAM (rw) : ORIGIN = 0xE0084000, LENGTH = (2k) /* Battery RAM: 2k */ +} + +OUTPUT_ARCH(arm) +ENTRY(_stext) +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) /* Startup code */ + *(.text .text.*) /* remaining code */ + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) /* read-only data (constants) */ + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + . = ALIGN(4); + } > ROM + + /* This is where the .data section is relocated for execution out + * FLASH. The .data section will be relocated from _eronly + * to _sdata at boot time. + */ + . = ALIGN(4); + _eronly = ABSOLUTE(.); + + .data : + { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > RAM AT > ROM + + .ARM.extab : { + *(.ARM.extab*) + } > RAM + + .ARM.exidx : { + __exidx_start = ABSOLUTE(.); + *(.ARM.exidx*) + __exidx_end = ABSOLUTE(.); + } > RAM + + +/* .bss section which is initialized by 0 */ + /* This section will be filled with zero by startup code */ + .bss (NOLOAD) : + { + _sbss = ABSOLUTE(.) ; + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b*) + *(COMMON) + _ebss = ABSOLUTE(.); + } > RAM + + .usbram (NOLOAD) : + { + __usbram_start = . ; + __usbram_start__ = . ; + *(.usbram) + . = ALIGN(4); + } > URAM + + .etherram (NOLOAD) : + { + __etherram_start = . ; + __etherram_start__ = . ; + *(.etherram) + . = ALIGN(4); + } > ERAM + + .batteryram (NOLOAD) : + { + __batteryram_start = . ; + __batteryram_start__ = . ; + *(.batteryram) + . = ALIGN(4); + } > BRAM + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/nuttx/configs/olimex-lpc2378/ostest/setenv.sh b/nuttx/configs/olimex-lpc2378/ostest/setenv.sh new file mode 100755 index 000000000..c55ede833 --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/ostest/setenv.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# configs/olimex-lpc2378/ostest/setenv.sh +# +# Author: Rommel Marcelo +# Copyright (C) 2010 Rommel Marcelo. All rights reserved. +# +# This is part of the NuttX RTOS and based on the LPC2148 port: +# +# Copyright (C) 2007-2009 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 NuttX 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. +# + +if [ "$(basename $0)" = "setenv.sh" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi + +WD=`pwd` +export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin" +export LPC23XXSCRIPTS="$WD/configs/olimex-lpc2378/scripts" +export PATH="${BUILDROOT_BIN}:${LPC23XXSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}" + +echo "PATH : ${PATH}" diff --git a/nuttx/configs/olimex-lpc2378/src/Makefile b/nuttx/configs/olimex-lpc2378/src/Makefile new file mode 100755 index 000000000..dac27f82a --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/src/Makefile @@ -0,0 +1,93 @@ +############################################################################ +# configs/mcu123-lpc214x/src/Makefile +# +# Copyright (C) 2010 Rommel Marcelo. All rights reserved. +# Author: Rommel Marcelo +# +# This is part of the NuttX RTOS and based on the LPC2148 port: +# +# Copyright (C) 2010 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 NuttX 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. +# +############################################################################ + +-include $(TOPDIR)/Make.defs + +ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src +ifeq ($(WINTOOL),y) + CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \ + -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \ + -I "${shell cygpath -w $(ARCH_SRCDIR)/arm}" \ + -I "${shell cygpath -w $(ARCH_SRCDIR)/sched}" +else + CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm -I$(TOPDIR)/sched +endif + +ASRCS = +AOBJS = $(ASRCS:.S=$(OBJEXT)) +CSRCS = up_leds.c +#CSRCS += up_spi.c +ifeq ($(CONFIG_EXAMPLES_NSH_ARCHINIT),y) +CSRCS += up_nsh.c +endif +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src + +all: libboard$(LIBEXT) + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +libboard$(LIBEXT): $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) + +.depend: Makefile $(SRCS) + @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f libboard$(LIBEXT) *~ .*.swp + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/nuttx/configs/olimex-lpc2378/src/up_leds.c b/nuttx/configs/olimex-lpc2378/src/up_leds.c new file mode 100755 index 000000000..feaaf4455 --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/src/up_leds.c @@ -0,0 +1,142 @@ +/**************************************************************************** + * configs/olimex-lpc2378/src/up_leds.c + * + * Copyright (C) 2010 Rommel Marcelo. All rights reserved. + * Author: Rommel Marcelo + * + * This is part of the NuttX RTOS and based on the LPC2148 port: + * + * Copyright (C) 2010 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 NuttX 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 "chip.h" +#include "up_arch.h" +#include "up_internal.h" +//~ #define LPC23XX_FIO_BASE 0x3fffc000 /* Fast I/O 0 base address */ + +/**************************************************************************** + * Definitions + ****************************************************************************/ +/* P3.0 : P0.7 PINSEL6 LEDS 1-8 */ +#define LEDBIT(led) (0x01 << (led)) +#define ALL_LEDS (0xFF) +#define STATLED (0x08) +//~ #ifdef CONFIG_LPC23XX_FIO +# define putled8(v,o) putreg8((v), (LPC23XX_FIO_BASE+(o))) +# define putled32(v,r) putreg32((v),(LPC23XX_FIO_BASE+(r))) +# define CLRLEDS putled(ALL_LEDS,FIO3CLR0_OFFSET) + +# define LED_SET_OFFSET FIO3SET0_OFFSET +# define LED_CLR_OFFSET FIO3CLR0_OFFSET +# define LED_DIR_OFFSET FIO3DIR0_OFFSET +# define LED_MASK_OFFSET FIO3MASK0_OFFSET + +//~ #else +//~ # define putled(v,r) putreg32((v),(LPC23XX_GPIO1_BASE+(r))) +//~ # define CLRLEDS putled(STATLED,LPC23XX_GPIO1_SET_OFFSET) +//~ +//~ # define LED_SET_OFFSET LPC23XX_GPIO_SET_OFFSET +//~ # define LED_CLR_OFFSET LPC23XX_GPIO_CLR_OFFSET +//~ # define LED_DIR_OFFSET LPC23XX_GPIO_DIR_OFFSET +//~ #endif + + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Funtions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_ledinit + ****************************************************************************/ + +#ifdef CONFIG_ARCH_LEDS +void up_ledinit(void) +{ + /* Initilize GIOs P1.16-P1.23 */ + putled8(ALL_LEDS,LED_DIR_OFFSET); + putled8(ALL_LEDS,LED_CLR_OFFSET); + putled8(LEDBIT(0),LED_SET_OFFSET); +} + +/**************************************************************************** + * Name: up_ledon + ****************************************************************************/ + +void up_ledon(int led) +{ + putled8(~(LEDBIT(led)),LED_MASK_OFFSET); + putled8(LEDBIT(led),LED_SET_OFFSET); +} + +/**************************************************************************** + * Name: up_ledoff + ****************************************************************************/ + +void up_ledoff(int led) +{ + putled8(LEDBIT(led),LED_CLR_OFFSET); +} + +/**************************************************************************** + * olimex board STATUS LED + ****************************************************************************/ + +void up_statledoff(void) +{ + putled8(~STATLED, FIO1MASK2_OFFSET); + putled8(STATLED, FIO1CLR2_OFFSET); +} + +void up_statledon(void) +{ + putled8(~STATLED, FIO1MASK2_OFFSET); + putled8(STATLED, FIO1SET2_OFFSET); +} + +#endif /* CONFIG_ARCH_LEDS */ + + diff --git a/nuttx/configs/olimex-lpc2378/src/up_nsh.c b/nuttx/configs/olimex-lpc2378/src/up_nsh.c new file mode 100755 index 000000000..4bf6ac8df --- /dev/null +++ b/nuttx/configs/olimex-lpc2378/src/up_nsh.c @@ -0,0 +1,114 @@ +/**************************************************************************** + * config/olimex-lpc2378/src/up_nsh.c + * arch/arm/src/board/up_nsh.c + * + * Copyright (C) 2010 Rommel Marcelo. All rights reserved. + * Author: Rommel Marcelo + * + * This is part of the NuttX RTOS and based on the LPC2148 port: + * + * Copyright (C) 2010 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 NuttX 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 <stdio.h> +#include <debug.h> +#include <errno.h> + +#include <nuttx/spi.h> +#include <nuttx/mmcsd.h> + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +#undef CONFIG_EXAMPLES_NSH_HAVEUSBDEV +#undef CONFIG_EXAMPLES_NSH_HAVEMMCSD + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef CONFIG_EXAMPLES_NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) +# undef CONFIG_EXAMPLES_NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_EXAMPLES_NSH_MMCSDMINOR +# define CONFIG_EXAMPLES_NSH_MMCSDMINOR 0 +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# else +# define message(...) printf(__VA_ARGS__) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# else +# define message printf +# endif +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nsh_archinitialize + * + * Description: + * Perform architecture specific initialization + * + ****************************************************************************/ + +int nsh_archinitialize(void) +{ + return OK; +} |