diff options
-rw-r--r-- | nuttx/Documentation/README.html | 6 | ||||
-rw-r--r-- | nuttx/README.txt | 4 | ||||
-rw-r--r-- | nuttx/arch/arm/src/nuc1xx/chip/nuc_config.h | 117 | ||||
-rw-r--r-- | nuttx/arch/arm/src/nuc1xx/chip/nuc_memorymap.h | 4 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/README.txt | 287 | ||||
-rw-r--r-- | nuttx/configs/nutiny-nuc120/ostest/defconfig | 2 |
6 files changed, 418 insertions, 2 deletions
diff --git a/nuttx/Documentation/README.html b/nuttx/Documentation/README.html index 44b663188..4582a3bb8 100644 --- a/nuttx/Documentation/README.html +++ b/nuttx/Documentation/README.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttX README Files</i></font></big></h1> - <p>Last Updated: December 11, 2012</p> + <p>Last Updated: February 22, 2013</p> </td> </tr> </table> @@ -141,6 +141,8 @@ | | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/ntosd-dm320/README.txt"><b><i>README.txt</i></b></a> | | |- nucleus2g/ | | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/nucleus2g/README.txt"><b><i>README.txt</i></b></a> + | | |- nutiny-nuc120/ + | | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/nutiny-nuc120/README.txt"><b><i>README.txt</i></b></a> | | |- olimex-lpc1766stk/ | | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-lpc1766stk/README.txt"><b><i>README.txt</i></b></a> | | |- olimex-lpc2378/ @@ -150,6 +152,8 @@ | | | |- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-strp711/include/README.txt">include/README.txt</a> | | | |- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-strp711/src/README.txt">src/README.txt</a> | | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-strp711/README.txt"><b><i>README.txt</i></b></a> + | | |- open1788/ + | | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/open1788/README.txt"><b><i>README.txt</i></b></a> | | |- p112/ | | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/p112/README.txt"><b><i>README.txt</i></b></a> | | |- pcblogic-pic32mx/ diff --git a/nuttx/README.txt b/nuttx/README.txt index da1ed10c6..3b2eae702 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -1053,6 +1053,8 @@ nuttx | | `- README.txt | |- nucleus2g/ | | `- README.txt + | |- nutiny-nuc120/ + | | `- README.txt | |- olimex-lpc1766stk/ | | `- README.txt | |- olimex-lpc2378/ @@ -1062,6 +1064,8 @@ nuttx | | |- include/README.txt | | |- src/README.txt | | `- README.txt + | |- open1788/ + | | `- README.txt | |- p112/ | | `- README.txt | |- pcblogic-pic32mx/ diff --git a/nuttx/arch/arm/src/nuc1xx/chip/nuc_config.h b/nuttx/arch/arm/src/nuc1xx/chip/nuc_config.h new file mode 100644 index 000000000..24f394bd2 --- /dev/null +++ b/nuttx/arch/arm/src/nuc1xx/chip/nuc_config.h @@ -0,0 +1,117 @@ +/******************************************************************************************** + * arch/arm/src/nuc1xx/chip/nuc_adc.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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_ARM_SRC_NUC1XX_CHIP_NUC_ADC_H +#define __ARCH_ARM_SRC_NUC1XX_CHIP_NUC_ADC_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include <nuttx/config.h> + +#include "chip.h" + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ +/* Register offsets *************************************************************************/ + +#define NUC_CONFIG0_OFFSET 0x0000 /* Config 0 */ +#define NUC_CONFIG1_OFFSET 0x0004 /* Config 1 */ + +/* Register addresses ***********************************************************************/ + +#define NUC_CONFIG0 (NUC_CONFIG_BASE+NUC_CONFIG0_OFFSET) +#define NUC_CONFIG1 (NUC_CONFIG_BASE+NUC_CONFIG1_OFFSET) + +/* Register bit-field definitions ***********************************************************/ + +/* Config 0 */ + +#define CONFIG0_DFEN (1 << 0) /* Bit 0: Data FLASH enable */ +#define CONFIG0_LOCK (1 << 1) /* Bit 1: Security lock */ +#define CONFIG0_CBS (1 << 7) /* Bit 7: Chip boot selection. 1=LDROM 0=APROM */ +#define CONFIG0_CBORST (1 << 20) /* Bit 20: Brown-out reset enable */ +#define CONFIG0_CBOV_SHIFT (21) /* Bits 21-22: Brown-out voltage selection */ +#define CONFIG0_CBOV_MASK (3 << CONFIG0_CBOV_SHIFT) +# define CONFIG0_CBOV_2p2V (0 << CONFIG0_CBOV_SHIFT) /* 2.2V */ +# define CONFIG0_CBOV_2p7V (1 << CONFIG0_CBOV_SHIFT) /* 2.7V */ +# define CONFIG0_CBOV_3p8V (2 << CONFIG0_CBOV_SHIFT) /* 3.8V */ +# define CONFIG0_CBOV_4p5V (3 << CONFIG0_CBOV_SHIFT) /* 4.5V */ +#define CONFIG0_CBODEN (1 << 23) /* Bit 23: Brown out detector enable */ +#define CONFIG0_CFOSC_SHIFT (24) /* Bits 24-26: CPU clock source selection after reset */ +#define CONFIG0_CFOSC_MASK (7 << CONFIG0_CFOSC_SHIFT) +# define CONFIG0_CFOSC_XTALHI (0 << CONFIG0_CFOSC_SHIFT) +# define CONFIG0_CFOSC_INTHI (7 << CONFIG0_CFOSC_SHIFT) +#define CONFIG0_CKF (1 << 28) /* Bit 28: XT1 clock filter enable */ + +/* My NuTiny-SDK-NUC120 was programmed this way when I got it: + * CKF=1 + * CFOSC=0 + * CBODEN=1 + * CBOV=3 + * CBORST=1 + * CBS=0 + * LOCK=1 + * DFEN=1 + */ + +#define CONFIG0_FACTORY_DEFAULT (0xf8ffff7f) + +/* Config 1 */ + +#define CONFIG1_DFBADR_SHIFT (0) /* Bits 0-19: Data FLASH base address */ +#define CONFIG1_DFBADR_MASK (0x000fffff << CONFIG1_DFBADR_SHIFT) + +/* My NuTiny-SDK-NUC120 was programmed this way when I got it: + * DFBADR=0x05000 + */ + +#define CONFIG1_FACTORY_DEFAULT (0x00005000) + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_NUC1XX_CHIP_NUC_ADC_H */ diff --git a/nuttx/arch/arm/src/nuc1xx/chip/nuc_memorymap.h b/nuttx/arch/arm/src/nuc1xx/chip/nuc_memorymap.h index ef12f8919..4cdccfa72 100644 --- a/nuttx/arch/arm/src/nuc1xx/chip/nuc_memorymap.h +++ b/nuttx/arch/arm/src/nuc1xx/chip/nuc_memorymap.h @@ -57,6 +57,10 @@ #define NUC_EXTMEM_BASE 0x60000000 /* -0x6001ffff: External Memory space (128KB) */ #define NUC_SYSCON_BASE 0x60000000 /* -0x6001ffff: ARMv6-M system controller space * See nvic.h */ +/* FLASH space */ + +#define NUC_CONFIG_BASE 0x00300000 /* -0x00300004: User configuration */ + /* AHB controller space */ #define NUC_GCR_BASE 0x50000000 /* -0x500001ff: System global control registers */ diff --git a/nuttx/configs/nutiny-nuc120/README.txt b/nuttx/configs/nutiny-nuc120/README.txt new file mode 100644 index 000000000..5e486e480 --- /dev/null +++ b/nuttx/configs/nutiny-nuc120/README.txt @@ -0,0 +1,287 @@ +README.txt +========== + +This is the README file for the port of NuttX to the NuvoTon +NuTiny-SDK-NUC120 board. This board has the NUC120LE3AN chip +with a built-in NuLink debugger. + +Contents +======== + + - Development Environment + - GNU Toolchain Options + - LEDs + - Serial Console + - Debugging + - NuTiny-specific Configuration Options + - Configurations + +Development Environment +======================= + + Either Linux or Cygwin on Windows can be used for the development environment. + The source has been built only using the GNU toolchain (see below). Other + toolchains will likely cause problems. + +GNU Toolchain Options +===================== + + As of this writing I have used only the CodeSourcery GCC toolchain for windows. + +LEDs +==== + + The NuTiny has a single green LED that can be controlled from sofware. + This LED is connected to PIN17. It is pulled high so a low value will + illuminate the LED. + + If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board the + NuTiny. The following definitions describe how NuttX controls the LEDs: + + SYMBOL Meaning LED state + Initially all LED is OFF + ------------------- ----------------------- ------------- ------------ + LED_STARTED NuttX has been started LED ON + LED_HEAPALLOCATE Heap has been allocated LED ON + LED_IRQSENABLED Interrupts enabled LED ON + LED_STACKCREATED Idle stack created LED ON + LED_INIRQ In an interrupt LED should glow + LED_SIGNAL In a signal handler LED might glow + LED_ASSERTION An assertion failed LED ON while handling the assertion + LED_PANIC The system has crashed LED Blinking at 2Hz + LED_IDLE NUC1XX is is sleep mode (Optional, not used) + +Serial Console +============== + +To be provided + +Debugging +========= + +The NuTiny-SDK-NUC120 includes a built-in NuLink debugger. Unfortunately, +full debug support is available only with the Keil and IAR toolchains. +There is, however, a free program call call ICP (In-Circuit Programmer). +It can be used to burn programs into FLASH (aka APROM). + +The ICP program can also be used to burn an ISP program into LDROM. The +ISP (In-System Programmer) is available free from the Nuvton website. + +NuTiny-specific Configuration Options +===================================== + + CONFIG_ARCH - Identifies the arch/ subdirectory. This should + be set to: + + CONFIG_ARCH=arm + + CONFIG_ARCH_family - For use in C code: + + CONFIG_ARCH_ARM=y + + CONFIG_ARCH_architecture - For use in C code: + + CONFIG_ARCH_CORTEXM0=y + + CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory + + CONFIG_ARCH_CHIP=nuc1xx + + CONFIG_ARCH_CHIP_name - For use in C code to identify the exact + chip: + + CONFIG_ARCH_CHIP_NUC120LE3AN=y + + CONFIG_ARCH_BOARD - Identifies the configs subdirectory and + hence, the board that supports the particular chip or SoC. + + CONFIG_ARCH_BOARD=nutiny-nuc120 (for the NuTiny-SDK-NUC120 development board) + + CONFIG_ARCH_BOARD_name - For use in C code + + CONFIG_ARCH_BOARD_NUTINY_NUC120=y + + CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation + of delay loops + + CONFIG_ENDIAN_BIG - define if big endian (default is little + endian) + + CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case): + + CONFIG_DRAM_SIZE=16384 (16Kb) + + CONFIG_DRAM_START - The start address of installed DRAM + + CONFIG_DRAM_START=0x20000000 + + CONFIG_ARCH_IRQPRIO - The Cortex-M0 supports interrupt prioritization + + CONFIG_ARCH_IRQPRIO=y + + CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that + have LEDs + + 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_LEDS - Use LEDs to show state. Unique to board architecture. + + CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that + cause a 100 second delay during boot-up. This 100 second delay + serves no purpose other than it allows you to calibratre + CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure + the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until + the delay actually is 100 seconds. + + Individual subsystems can be enabled: + + AHB + --- + + CONFIG_NUC_PDMA Peripheral DMA + CONFIG_NUC_FMC Flash memory + CONFIG_NUC_EBI External bus interface + + APB1 + ---- + + CONFIG_NUC_WDT Watchdog timer + CONFIG_NUC_RTC Real time clock (RTC) + CONFIG_NUC_TMR01 Timer0/Timer1 + CONFIG_NUC_I2C0 I2C interface + CONFIG_NUC_SPI0 SPI0 master/slave + CONFIG_NUC_SPI1 SPI1 master/slave + CONFIG_NUC_PWMA PWM0/1/2/3 + CONFIG_NUC_UART0 UART0 + CONFIG_NUC_USBD USB 2.0 FS device controller registers */ + CONFIG_NUC_ACMP Analog comparator + CONFIG_NUC_ADC Analog-digital-converter (ADC) + + APB2 + --- + + CONFIG_NUC_PS2 PS/2 interface + CONFIG_NUC_TIMR23 Timer2/Timer3 + CONFIG_NUC_I2C1 I2C1 interface + CONFIG_NUC_SPI2 SPI2 master/slave + CONFIG_NUC_SPI3 SPI3 master/slave + CONFIG_NUC_PWMB PWM4/5/6/7 + CONFIG_NUC_UART1 UART1 + CONFIG_NUC_UART2 UART2 + CONFIG_NUC_I2S I2S interface + + NUC1XX specific device driver settings + + CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn (n=0,1,2) for the + console and ttys0 (default is the USART0). + 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 specific 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 5, 6, 7, or 8. + CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity + CONFIG_UARTn_2STOP - Two stop bits + +Configurations +============== + +Each NuTiny-SDK-NUC120 configuration is maintained in a sub-directory and +can be selected as follow: + + cd tools + ./configure.sh nutiny-nuc120/<subdir> + cd - + . ./setenv.sh + +If this is a Windows native build, then configure.bat should be used +instead of configure.sh: + + configure.bat nutiny-nuc120\<subdir> + +Where <subdir> is one of the following: + + ostest: + ------ + This configuration directory, performs a simple OS test using + apps/examples/ostest. + + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Default toolchain: + + CONFIG_HOST_WINDOWS=y : Builds under Windows + CONFIG_WINDOWS_CYGWIN=y : Using Cygwin + CONFIG_ARMV6M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows + + nsh: + --- + Configures the NuttShell (nsh) located at apps/examples/nsh. The + Configuration enables the serial interfaces on UART0. Support for + builtin applications is enabled, but in the base configuration no + builtin applications are selected (see NOTES below). + + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. By default, this configuration uses the CodeSourcery toolchain + for Windows and builds under Cygwin (or probably MSYS). That + can easily be reconfigured, of course. + + CONFIG_HOST_WINDOWS=y : Builds under Windows + CONFIG_WINDOWS_CYGWIN=y : Using Cygwin + CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows + + 3. This configuration includes USB Support (CDC/ACM device) + + CONFIG_STM32_USB=y : STM32 USB device support + CONFIG_USBDEV=y : USB device support must be enabled + CONFIG_CDCACM=y : The CDC/ACM driver must be built + CONFIG_NSH_BUILTIN_APPS=y : NSH built-in application support must be enabled + CONFIG_NSH_ARCHINIT=y : To perform USB initialization + + The CDC/ACM example is included as two NSH "built-in" commands.\ + + CONFIG_EXAMPLES_CDCACM=y : Enable apps/examples/cdcacm + + The two commands are: + + sercon : Connect the serial device a create /dev/ttyACM0 + serdis : Disconnect the serial device. + + NOTE: The serial connections/disconnections do not work as advertised. + This is because the NuTiny-SDK-NUC120 board does not provide circuitry for + control of the "soft connect" USB pullup. As a result, the host PC + does not know the USB has been logically connected or disconnected. You + have to follow these steps to use USB: + + 1) Start NSH with USB disconnected + 2) enter to 'sercon' command to start the CDC/ACM device, then + 3) Connect the USB device to the host. + + and to close the connection: + + 4) Disconnect the USB device from the host + 5) Enter the 'serdis' command diff --git a/nuttx/configs/nutiny-nuc120/ostest/defconfig b/nuttx/configs/nutiny-nuc120/ostest/defconfig index 9e37c286a..964155240 100644 --- a/nuttx/configs/nutiny-nuc120/ostest/defconfig +++ b/nuttx/configs/nutiny-nuc120/ostest/defconfig @@ -229,7 +229,7 @@ CONFIG_ARCH_STACKDUMP=y # Board Settings # CONFIG_DRAM_START=0x20000000 -CONFIG_DRAM_SIZE=40960 +CONFIG_DRAM_SIZE=16384 CONFIG_ARCH_HAVE_INTERRUPTSTACK=y CONFIG_ARCH_INTERRUPTSTACK=0 |