From 6bd4075951c584e7d486299e3e5b5d2a5055e755 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 25 Dec 2015 15:19:09 -0600 Subject: [PATCH 1/9] LaunchXL-TMS57004: Add support for on-board LEDs and buttons --- configs/Kconfig | 3 + configs/launchxl-tms57004/README.txt | 47 +++++ configs/launchxl-tms57004/include/board.h | 65 ++++++ configs/launchxl-tms57004/nsh/defconfig | 15 +- configs/launchxl-tms57004/src/Makefile | 9 + .../launchxl-tms57004/src/launchxl-tms57004.h | 32 +++ .../launchxl-tms57004/src/tms570_autoleds.c | 139 ++++++++++++ .../launchxl-tms57004/src/tms570_bringup.c | 2 +- .../launchxl-tms57004/src/tms570_buttons.c | 199 ++++++++++++++++++ .../launchxl-tms57004/src/tms570_userleds.c | 87 ++++++++ configs/same70-xplained/README.txt | 8 +- 11 files changed, 600 insertions(+), 6 deletions(-) create mode 100644 configs/launchxl-tms57004/src/tms570_autoleds.c create mode 100644 configs/launchxl-tms57004/src/tms570_buttons.c create mode 100644 configs/launchxl-tms57004/src/tms570_userleds.c diff --git a/configs/Kconfig b/configs/Kconfig index 7811068bf53..b944743fb85 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -242,6 +242,9 @@ config ARCH_BOARD_KWIKSTIK_K40 config ARCH_BOARD_LAUNCHXL_TMS57004 bool "TI LaunchXL-TMS57004" depends on ARCH_CHIP_TMS570LS0432PZ + select ARCH_HAVE_LEDS + select ARCH_HAVE_BUTTONS + select ARCH_HAVE_IRQBUTTONS ---help--- TI Hercules TMS570LS04x/03x LaunchPad Evaluation Kit (LAUNCHXL- TMS57004) featuring the Hercules TMS570LS0432PZ chip. diff --git a/configs/launchxl-tms57004/README.txt b/configs/launchxl-tms57004/README.txt index a0e109b2e56..587f25f2563 100644 --- a/configs/launchxl-tms57004/README.txt +++ b/configs/launchxl-tms57004/README.txt @@ -8,8 +8,55 @@ README Contents ^^^^^^^^ + LEDs and Buttons Serial Console +LEDs and Buttons +================ + + LEDs + ---- + The launchpad has a four LEDs two power LEDs labeled D1 (red) that + connects to the TMS570's NERROR pin and D7 (blue) that indicates the + XDS200 POWER_EN signal, and two white, user LEDs labeled D12 that + connects to the NHET08 pin and D11 that connects to GIOA2. + + NHET08 is one of 32 N2HET pins than can be available to the user if + not used by N2HET. This implementation, however, uses only the single + LED driven by GIOA2. That LED is tied to ground and illuminated + with a high level output value. + + This LED is not used by the board port unless CONFIG_ARCH_LEDS is + defined. In that case, the usage by the board port is defined in + include/board.h and src/tms570_autoleds.c. The LED is used to encode + OS-related events as follows: + + ------------------- ----------------------- ------ + SYMBOL Meaning LED + ------------------- ----------------------- ------ + LED_STARTED NuttX has been started OFF + LED_HEAPALLOCATE Heap has been allocated OFF + LED_IRQSENABLED Interrupts enabled OFF + LED_STACKCREATED Idle stack created ON + LED_INIRQ In an interrupt N/C + LED_SIGNAL In a signal handler N/C + LED_ASSERTION An assertion failed N/C + LED_PANIC The system has crashed FLASH + + Thus if the LED is statically on, NuttX has successfully booted and is, + apparently, running normally. If the LED is flashing at approximately + 2Hz, then a fatal error has been detected and the system has halted. + + Buttons + ------- + The launchpad has three mechanical buttons. Two of these are reset buttons: + One button is labeled PORRST performs a power-on reset and one labeled RST + performs an MCU reset. Only one button is available for general software + usage. That button is labeled GIOA7 and is, obviously, sensed on GIOA7. + + GIOA7 is tied to ground, but will be pulled high if the GIOA7 button is + depressed. + Serial Console ^^^^^^^^^^^^^^ diff --git a/configs/launchxl-tms57004/include/board.h b/configs/launchxl-tms57004/include/board.h index fb78ca8748f..456fd16522b 100644 --- a/configs/launchxl-tms57004/include/board.h +++ b/configs/launchxl-tms57004/include/board.h @@ -179,8 +179,73 @@ PINMUX_MIBSPI1NCS1_PIN /* LED definitions ******************************************************************/ +/* LEDs + * + * The launchpad has a four LEDs two power LEDs labeled D1 (red) that connects to + * the TMS570's NERROR pin and D7 (blue) that indicates the XDS200 POWER_EN signal, + * and two white, user LEDs labeled D12 that connects to the NHET08 pin and D11 + * that connects to GIOA2. + * + * NHET08 is one of 32 N2HET pins than can be available to the user if not used by + * N2HET. This implementation, however, uses only the single LED driven by GIOA2. + * That LED is tied to ground and illuminated with a high level output value. + */ + +/* LED index values for use with board_userled() */ + +#define BOARD_LED_D11 0 +#define BOARD_NLEDS 1 + +/* LED bits for use with board_userled_all() */ + +#define BOARD_LED_D11_BIT (1 << BOARD_LED_D11) + +/* This LED is not used by the board port unless CONFIG_ARCH_LEDS is + * defined. In that case, the usage by the board port is defined in + * include/board.h and src/tms570_autoleds.c. The LED is used to encode + * OS-related events as follows: + */ + +/* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is + * defined. In that case, the usage by the board port is defined in + * include/board.h and src/sam_autoleds.c. The LEDs are used to encode + * OS-related events as follows: + * + * ---------------------- ---------------------------- ------ + * SYMBOL Meaning LED + * ---------------------- ---------------------------- ------ */ + +#define LED_STARTED 0 /* NuttX has been started OFF */ +#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */ +#define LED_IRQSENABLED 0 /* Interrupts enabled OFF */ +#define LED_STACKCREATED 1 /* Idle stack created ON */ +#define LED_INIRQ 2 /* In an interrupt N/C */ +#define LED_SIGNAL 2 /* In a signal handler N/C */ +#define LED_ASSERTION 2 /* An assertion failed N/C */ +#define LED_PANIC 3 /* The system has crashed FLASH */ +#undef LED_IDLE /* MCU is is sleep mode Not used */ + +/* Thus if the LED is statically on, NuttX has successfully booted and is, + * apparently, running normally. If the LED is flashing at approximately + * 2Hz, then a fatal error has been detected and the system has halted. + */ /* Button definitions ***************************************************************/ +/* Buttons + * + * The launchpad has three mechanical buttons. Two of these are reset buttons: One + * button is labeled PORRST performs a power-on reset and one labeled RST performs + * an MCU reset. Only one button is available for general software usage. That + * button is labeled GIOA7 and is, obviously, sensed on GIOA7. + * + * GIOA7 is tied to ground, but will be pulled high if the GIOA7 button is + * depressed. + */ + +#define BUTTON_GIOA7 0 +#define NUM_BUTTONS 1 + +#define BUTTON_GIOA7_BIT (1 << BUTTON_GIOA7) /************************************************************************************ * Public Data diff --git a/configs/launchxl-tms57004/nsh/defconfig b/configs/launchxl-tms57004/nsh/defconfig index 588b4cd58bd..d879faf59c5 100644 --- a/configs/launchxl-tms57004/nsh/defconfig +++ b/configs/launchxl-tms57004/nsh/defconfig @@ -136,11 +136,14 @@ CONFIG_ARMV7R_MEMINIT=y # CONFIG_ARMV7R_TOOLCHAIN_GNU_EABIL is not set CONFIG_ARMV7R_TOOLCHAIN_GNU_EABIW=y # CONFIG_ARMV7R_TOOLCHAIN_GNU_OABI is not set +CONFIG_ARMV7R_HAVE_DECODEFIQ=y # CONFIG_ARMV7R_DECODEFIQ is not set +# CONFIG_SERIAL_TERMIOS is not set # # TMS570 Configuration Options # +# CONFIG_TMS570_HAVE_SCI2 is not set # CONFIG_ARCH_CHIP_TMS570LS0232PZ is not set # CONFIG_ARCH_CHIP_TMS570LS0332PZ is not set CONFIG_ARCH_CHIP_TMS570LS0432PZ=y @@ -159,6 +162,8 @@ CONFIG_ARCH_CHIP_TMS570LS0432PZ=y # CONFIG_TMS570_N2HET is not set # CONFIG_TMS570_MIBASPI1 is not set CONFIG_TMS570_SCI1=y +CONFIG_TMS570_GIO_IRQ=y +# CONFIG_TMS570_SELFTEST is not set # # Architecture Options @@ -226,6 +231,12 @@ CONFIG_ARCH_BOARD="launchxl-tms57004" # # Common Board Options # +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_HAVE_BUTTONS=y +CONFIG_ARCH_BUTTONS=y +CONFIG_ARCH_HAVE_IRQBUTTONS=y +CONFIG_ARCH_IRQBUTTONS=y CONFIG_NSH_MMCSDMINOR=0 # @@ -397,6 +408,7 @@ CONFIG_SPI_EXCHANGE=y # # LED Support # +# CONFIG_USERLED is not set # CONFIG_PCA9635PW is not set # CONFIG_MMCSD is not set # CONFIG_MTD is not set @@ -440,7 +452,7 @@ CONFIG_STANDARD_SERIAL=y # CONFIG_SERIAL_IFLOWCONTROL is not set # CONFIG_SERIAL_OFLOWCONTROL is not set # CONFIG_SERIAL_DMA is not set -# CONFIG_ARCH_HAVE_SERIAL_TERMIOS is not set +CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y CONFIG_SCI1_SERIAL_CONSOLE=y # CONFIG_OTHER_SERIAL_CONSOLE is not set # CONFIG_NO_SERIAL_CONSOLE is not set @@ -617,6 +629,7 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024 # # Examples # +# CONFIG_EXAMPLES_BUTTONS is not set # CONFIG_EXAMPLES_CONFIGDATA is not set # CONFIG_EXAMPLES_CPUHOG is not set # CONFIG_EXAMPLES_DHCPD is not set diff --git a/configs/launchxl-tms57004/src/Makefile b/configs/launchxl-tms57004/src/Makefile index 87c3012bdc4..6b4d9ad28c5 100644 --- a/configs/launchxl-tms57004/src/Makefile +++ b/configs/launchxl-tms57004/src/Makefile @@ -42,5 +42,14 @@ ifeq ($(CONFIG_LIB_BOARDCTL),y) CSRCS += tms570_appinit.c endif +ifeq ($(CONFIG_ARCH_LEDS),y) + CSRCS += tms570_autoleds.c +else + CSRCS += tms570_userleds.c +endif + +ifeq ($(CONFIG_ARCH_BUTTONS),y) + CSRCS += tms570_buttons.c +endif include $(TOPDIR)/configs/Board.mk diff --git a/configs/launchxl-tms57004/src/launchxl-tms57004.h b/configs/launchxl-tms57004/src/launchxl-tms57004.h index d268a110732..3eb4f42d6aa 100644 --- a/configs/launchxl-tms57004/src/launchxl-tms57004.h +++ b/configs/launchxl-tms57004/src/launchxl-tms57004.h @@ -46,6 +46,38 @@ * Pre-processor Definitions ****************************************************************************/ +/* LEDs + * + * The launchpad has a four LEDs two power LEDs labeled D1 (red) that + * connects to the TMS570's NERROR pin and D7 (blue) that indicates the + * XDS200 POWER_EN signal, and two white, user LEDs labeled D12 that + * connects to the NHET08 pin and D11 that connects to GIOA2. + * + * NHET08 is one of 32 N2HET pins than can be available to the user if not + * used by N2HET. This implementation, however, uses only the single LED + * driven by GIOA2. That LED is tied to ground and illuminated with a high + * level output value. + */ + +#define GIO_LED_D11 (GIO_OUTPUT | GIO_CFG_DEFAULT | GIO_OUTPUT_SET | \ + GIO_PORT_GIOA | GIO_PIN2) + +/* Buttons + * + * The launchpad has three mechanical buttons. Two of these are reset + * buttons: One button is labeled PORRST performs a power-on reset and one + * labeled RST performs an MCU reset. Only one button is available for + * general software usage. That button is labeled GIOA7 and is, obviously, + * sensed on GIOA7. + * + * GIOA7 is tied to ground, but will be pulled high if the GIOA7 button is + * depressed. + */ + +#define GIO_BUTTON (GIO_INPUT | GIO_CFG_PULLUP | GIO_INT_BOTHEDGES | \ + GIO_PORT_GIOA | GIO_PIN7) +#define IRQ_BUTTON TMS570_IRQ_GIOA7 + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/configs/launchxl-tms57004/src/tms570_autoleds.c b/configs/launchxl-tms57004/src/tms570_autoleds.c new file mode 100644 index 00000000000..35c2302a10e --- /dev/null +++ b/configs/launchxl-tms57004/src/tms570_autoleds.c @@ -0,0 +1,139 @@ +/**************************************************************************** + * configs/launchxl-tms57004/include/tms570_autoleds.c + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/* LEDs + * + * The launchpad has a four LEDs two power LEDs labeled D1 (red) that + * connects to the TMS570's NERROR pin and D7 (blue) that indicates the + * XDS200 POWER_EN signal, and two white, user LEDs labeled D12 that + * connects to the NHET08 pin and D11 that connects to GIOA2. + * + * NHET08 is one of 32 N2HET pins than can be available to the user if + * not used by N2HET. This implementation, however, uses only the single + * LED driven by GIOA2. That LED is tied to ground and illuminated + * with a high level output value. + * + * This LED is not used by the board port unless CONFIG_ARCH_LEDS is + * defined. In that case, the usage by the board port is defined in + * include/board.h and src/tms570_autoleds.c. The LED is used to encode + * OS-related events as follows: + * + * ------------------- ----------------------- ------ + * SYMBOL Meaning LED + * ------------------- ----------------------- ------ + * LED_STARTED NuttX has been started OFF + * LED_HEAPALLOCATE Heap has been allocated OFF + * LED_IRQSENABLED Interrupts enabled OFF + * LED_STACKCREATED Idle stack created ON + * LED_INIRQ In an interrupt N/C + * LED_SIGNAL In a signal handler N/C + * LED_ASSERTION An assertion failed N/C + * LED_PANIC The system has crashed FLASH + * + * Thus if the LED is statically on, NuttX has successfully booted and is, + * apparently, running normally. If the LED is flashing at approximately + * 2Hz, then a fatal error has been detected and the system has halted. + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include + +#include "tms570_gio.h" +#include "launchxl-tms57004.h" + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG + * with CONFIG_DEBUG_VERBOSE too) + */ + +#ifdef CONFIG_DEBUG_LEDS +# define leddbg lldbg +# define ledvdbg llvdbg +#else +# define leddbg(x...) +# define ledvdbg(x...) +#endif + +/**************************************************************************** + * Name: board_autoled_initialize + ****************************************************************************/ + +void board_autoled_initialize(void) +{ + /* Configure LED GIOs for output */ + + tms570_configgio(GIO_LED_D11); +} + +/**************************************************************************** + * Name: board_autoled_on + ****************************************************************************/ + +void board_autoled_on(int led) +{ + if (led == 1 || led == 3) + { + tms570_giowrite(GIO_LED_D11, true); /* High illuminates */ + } +} + +/**************************************************************************** + * Name: board_autoled_off + ****************************************************************************/ + +void board_autoled_off(int led) +{ + if (led == 3) + { + tms570_giowrite(GIO_LED_D11, false); /* Low extinguishes */ + } +} + +#endif /* CONFIG_ARCH_LEDS */ diff --git a/configs/launchxl-tms57004/src/tms570_bringup.c b/configs/launchxl-tms57004/src/tms570_bringup.c index 5ca348df0e5..58b2773bf9b 100644 --- a/configs/launchxl-tms57004/src/tms570_bringup.c +++ b/configs/launchxl-tms57004/src/tms570_bringup.c @@ -52,7 +52,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: sam_bringup + * Name: tms570_bringup * * Description: * Bring up simulated board features diff --git a/configs/launchxl-tms57004/src/tms570_buttons.c b/configs/launchxl-tms57004/src/tms570_buttons.c new file mode 100644 index 00000000000..2ac5c091fcb --- /dev/null +++ b/configs/launchxl-tms57004/src/tms570_buttons.c @@ -0,0 +1,199 @@ +/**************************************************************************** + * configs/sam4e-ek/src/tms570_buttons.c + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 + +#include + +#include +#include +#include + +#include +#include + +#include "up_arch.h" +#include "tms570_gio.h" +#include "launchxl-tms57004.h" + +#ifdef CONFIG_ARCH_BUTTONS + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#undef HAVE_IRQBUTTONS +#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_TMS570_GIO_IRQ) +# define HAVE_IRQBUTTONS 1 +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#ifdef HAVE_IRQBUTTONS +static xcpt_t g_irq_button; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_button_irqx + * + * Description: + * This function implements the core of the board_button_irq() logic. + * + ****************************************************************************/ + +#ifdef HAVE_IRQBUTTONS +static xcpt_t board_button_irqx(gio_pinset_t pinset, int irq, + xcpt_t irqhandler, xcpt_t *store) +{ + xcpt_t oldhandler; + irqstate_t flags; + + /* Disable interrupts until we are done. This guarantees that the following + * operations are atomic. + */ + + flags = irqsave(); + + /* Get the old button interrupt handler and save the new one */ + + oldhandler = *store; + *store = irqhandler; + + /* Are we attaching or detaching? */ + + if (irqhandler != NULL) + { + /* Configure the interrupt */ + + tms570_gioirq(pinset); + (void)irq_attach(irq, irqhandler); + tms570_gioirqenable(irq); + } + else + { + /* Detach and disable the interrupt */ + + (void)irq_detach(irq); + tms570_gioirqdisable(irq); + } + + irqrestore(flags); + + /* Return the old button handler (so that it can be restored) */ + + return oldhandler; +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_button_initialize + * + * Description: + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. + * + ****************************************************************************/ + +void board_button_initialize(void) +{ + /* Configure button GIOs */ + + (void)tms570_configgio(GIO_BUTTON); +} + +/**************************************************************************** + * Name: board_buttons + * + * Description: + * After board_button_initialize() has been called, board_buttons() may be + * called to collect the state of all buttons. board_buttons() returns an + * 8-bit bit set with each bit associated with a button. See the BUTTON* + * definitions above for the meaning of each bit in the returned value. + * + ****************************************************************************/ + +uint8_t board_buttons(void) +{ + return tms570_gioread(GIO_BUTTON) ? BUTTON_GIOA7_BIT : 0; +} + +/**************************************************************************** + * Name: board_button_irq + * + * Description: + * This function may be called to register an interrupt handler that will + * be called when a button is depressed or released. The ID value is one + * of the BUTTON* definitions provided above. The previous interrupt + * handler address is returned (so that it may restored, if so desired). + * + * Configuration Notes: + * Configuration CONFIG_AVR32_GIOIRQ must be selected to enable the + * overall GIO IRQ feature and CONFIG_AVR32_GIOIRQSETA and/or + * CONFIG_AVR32_GIOIRQSETB must be enabled to select GIOs to support + * interrupts on. For button support, bits 2 and 3 must be set in + * CONFIG_AVR32_GIOIRQSETB (PB2 and PB3). + * + ****************************************************************************/ + +xcpt_t board_button_irq(int id, xcpt_t irqhandler) +{ +#ifdef HAVE_IRQBUTTONS + if (id == BUTTON_GIOA7) + { + return board_button_irqx(GIO_BUTTON, IRQ_BUTTON, irqhandler, &g_irq_button); + } +#endif + + return NULL; + +} + +#endif /* CONFIG_ARCH_BUTTONS */ diff --git a/configs/launchxl-tms57004/src/tms570_userleds.c b/configs/launchxl-tms57004/src/tms570_userleds.c new file mode 100644 index 00000000000..2249c1278fc --- /dev/null +++ b/configs/launchxl-tms57004/src/tms570_userleds.c @@ -0,0 +1,87 @@ +/**************************************************************************** + * configs/launchxl-tms57004/src/tms570_userleds.c + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 + +#include +#include +#include + +#include + +#include "tms570_gio.h" +#include "launchxl-tms57004.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_userled_initialize + ****************************************************************************/ + +void board_userled_initialize(void) +{ + /* Configure LED PIOs for output */ + + tms570_configgio(GIO_LED_D11); +} + +/**************************************************************************** + * Name: board_userled + ****************************************************************************/ + +void board_userled(int led, bool ledon) +{ + if (led == BOARD_LED_D11) + { + tms570_giowrite(GIO_LED_D11, !ledon); /* Low illuminates */ + } +} + +/**************************************************************************** + * Name: board_userled_all + ****************************************************************************/ + +void board_userled_all(uint8_t ledset) +{ + /* Low illuminates */ + + tms570_giowrite(GIO_LED_D11, (ledset & BOARD_LED_D11_BIT) == 0)); +} diff --git a/configs/same70-xplained/README.txt b/configs/same70-xplained/README.txt index 0b05f12d945..6348b7f77d8 100644 --- a/configs/same70-xplained/README.txt +++ b/configs/same70-xplained/README.txt @@ -255,9 +255,9 @@ LEDs ---- A single LED is available driven by PC8. -These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is +This LED is not used by the board port unless CONFIG_ARCH_LEDS is defined. In that case, the usage by the board port is defined in -include/board.h and src/sam_autoleds.c. The LEDs are used to encode +include/board.h and src/sam_autoleds.c. The LED is used to encode OS-related events as follows: ------------------- ----------------------- ------ @@ -272,8 +272,8 @@ OS-related events as follows: LED_ASSERTION An assertion failed N/C LED_PANIC The system has crashed FLASH -Thus is LED is statically on, NuttX has successfully booted and is, -apparently, running normally. If LED is flashing at approximately +Thus if the LED is statically on, NuttX has successfully booted and is, +apparently, running normally. If the LED is flashing at approximately 2Hz, then a fatal error has been detected and the system has halted. Buttons From 6d85d93e2ff7154446fe8c3336792ec2b22716c1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 25 Dec 2015 20:05:53 -0600 Subject: [PATCH 2/9] Update README --- configs/launchxl-tms57004/README.txt | 64 +++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/configs/launchxl-tms57004/README.txt b/configs/launchxl-tms57004/README.txt index 587f25f2563..c4764b0b49a 100644 --- a/configs/launchxl-tms57004/README.txt +++ b/configs/launchxl-tms57004/README.txt @@ -8,8 +8,9 @@ README Contents ^^^^^^^^ - LEDs and Buttons - Serial Console + - LEDs and Buttons + - Serial Console + - Configurations LEDs and Buttons ================ @@ -63,3 +64,62 @@ Serial Console This TMS570 has a single SCI. The SCI_RX and TX pins are connected to the FTDI chip which provides a virtual COM port for the launchpad. +Configurations +============== + +Information Common to All Configurations +---------------------------------------- +Each LaunchXL-TMS50704 configuration is maintained in a sub-directory and +can be selected as follow: + + cd tools + ./configure.sh launchxl-tms57004/ + cd - + . ./setenv.sh + +Before sourcing the setenv.sh file above, you should examine it and perform +edits as necessary so that TOOLCHAIN_BIN is the correct path to the directory +than holds your toolchain binaries. + +And then build NuttX by simply typing the following. At the conclusion of +the make, the nuttx binary will reside in an ELF file called, simply, nuttx. + + make oldconfig + make + +The that is provided above as an argument to the tools/configure.sh +must be is one of the following. + +NOTES: + + 1. These configurations use the mconf-based configuration tool. To + change any of these configurations using that tool, you should: + + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + see additional README.txt files in the NuttX tools repository. + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. All of these configurations are set up to build under Windows using the + "GNU Tools for ARM Embedded Processors" that is maintained by ARM + (unless stated otherwise in the description of the configuration). + + https://launchpad.net/gcc-arm-embedded + + That toolchain selection can easily be reconfigured using + 'make menuconfig'. Here are the relevant current settings: + + Build Setup: + CONFIG_HOST_WINDOWS=y : Window environment + CONFIG_WINDOWS_CYGWIN=y : Cywin under Windows + + System Type -> Toolchain: + CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : GNU ARM EABI toolchain + +Configuration sub-directories +----------------------------- + + nsh: + + Configures the NuttShell (nsh) located at examples/nsh. From 555cc1e3029047bd514c4ddeb4a0f3c50b9e5c45 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 26 Dec 2015 10:54:58 -0600 Subject: [PATCH 3/9] Update README --- configs/launchxl-tms57004/README.txt | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/configs/launchxl-tms57004/README.txt b/configs/launchxl-tms57004/README.txt index c4764b0b49a..c4e66fd2a37 100644 --- a/configs/launchxl-tms57004/README.txt +++ b/configs/launchxl-tms57004/README.txt @@ -1,17 +1,38 @@ README -^^^^^^ +====== This README provides some information about the port of NuttX to the TI Hercules TMS570LS04x/03x LaunchPad Evaluation Kit (LAUNCHXL-TMS57004) featuring the Hercules TMS570LS0432PZ chip. Contents -^^^^^^^^ +======== + - Toolchain - LEDs and Buttons - Serial Console + - Debugging - Configurations +Toolchain +========= + + All of these configurations are set up to build with Cygwin under Windows + using the "GNU Tools for ARM Embedded Processors" that is maintained by ARM + (unless stated otherwise in the description of the configuration). + + https://launchpad.net/gcc-arm-embedded + + That toolchain selection can easily be reconfigured using 'make menuconfig'. + Here are the relevant current settings: + + Build Setup: + CONFIG_HOST_WINDOWS=y : Window environment + CONFIG_WINDOWS_CYGWIN=y : Cywin under Windows + + System Type -> Toolchain: + CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : GNU ARM EABI toolchain + LEDs and Buttons ================ @@ -59,7 +80,7 @@ LEDs and Buttons depressed. Serial Console -^^^^^^^^^^^^^^ +============== This TMS570 has a single SCI. The SCI_RX and TX pins are connected to the FTDI chip which provides a virtual COM port for the launchpad. From 456b8d1b14944ad634e1090032f285b33890e09c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 26 Dec 2015 14:49:02 -0600 Subject: [PATCH 4/9] TMS570 is big-endian --- configs/launchxl-tms57004/README.txt | 59 +++++++++++++------ configs/launchxl-tms57004/nsh/Make.defs | 2 +- configs/launchxl-tms57004/nsh/defconfig | 5 +- .../launchxl-tms57004/scripts/flash-sram.ld | 1 + 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/configs/launchxl-tms57004/README.txt b/configs/launchxl-tms57004/README.txt index c4e66fd2a37..4133564892d 100644 --- a/configs/launchxl-tms57004/README.txt +++ b/configs/launchxl-tms57004/README.txt @@ -85,33 +85,56 @@ Serial Console This TMS570 has a single SCI. The SCI_RX and TX pins are connected to the FTDI chip which provides a virtual COM port for the launchpad. +Debugging +========= + + I used a Segger J-Link connected to the Launchpad via the JTAG connector. + The following table shows how I connected the 14-pin JTAG connector on + the Launchpad to the Segger 20-pin JTAG connector: + + --- ----------- ------ ------------- --- ---------- ------ ------- + J12 LAUCHPAD J-LINK J-LINK J12 LAUCHPAD J-LINK J-LINK + PIN SIGNAL PIN SIGNAL PIN SIGNAL PIN SIGNAL + --- ----------- ------ ------------- --- ---------- ------ ------- + 1 TMS 7 TMS 2 TRTSN 3 nTRST + 3 TDI 5 TDI 4 GND 2 GND + 5 PD (+3V3) 1 VTref 6 N/C - N/C + 7 TDO 13 TDO 8 JTAG_SEL** 4 GND + 9 RTCK 11 RTCK 10 GND 6 GND + 11 TCK 9 TCK 12 GND 8 GND + 13 EMU0* - N/C 14 EMU1* - N/C + --- ----------- ------ ------------- --- ---------- ------ ------- + + * Pulled high on board + ** Needs to be grounded to select JTAG + Configurations ============== -Information Common to All Configurations ----------------------------------------- -Each LaunchXL-TMS50704 configuration is maintained in a sub-directory and -can be selected as follow: + Information Common to All Configurations + ---------------------------------------- + Each LaunchXL-TMS50704 configuration is maintained in a sub-directory and + can be selected as follow: - cd tools - ./configure.sh launchxl-tms57004/ - cd - - . ./setenv.sh + cd tools + ./configure.sh launchxl-tms57004/ + cd - + . ./setenv.sh -Before sourcing the setenv.sh file above, you should examine it and perform -edits as necessary so that TOOLCHAIN_BIN is the correct path to the directory -than holds your toolchain binaries. + Before sourcing the setenv.sh file above, you should examine it and perform + edits as necessary so that TOOLCHAIN_BIN is the correct path to the directory + than holds your toolchain binaries. -And then build NuttX by simply typing the following. At the conclusion of -the make, the nuttx binary will reside in an ELF file called, simply, nuttx. + And then build NuttX by simply typing the following. At the conclusion of + the make, the nuttx binary will reside in an ELF file called, simply, nuttx. - make oldconfig - make + make oldconfig + make -The that is provided above as an argument to the tools/configure.sh -must be is one of the following. + The that is provided above as an argument to the tools/configure.sh + must be is one of the following. -NOTES: + NOTES: 1. These configurations use the mconf-based configuration tool. To change any of these configurations using that tool, you should: diff --git a/configs/launchxl-tms57004/nsh/Make.defs b/configs/launchxl-tms57004/nsh/Make.defs index 91fe68b0230..f139bb761a9 100644 --- a/configs/launchxl-tms57004/nsh/Make.defs +++ b/configs/launchxl-tms57004/nsh/Make.defs @@ -68,7 +68,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y) ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer endif -ARCHCPUFLAGS = -mcpu=cortex-r4 +ARCHCPUFLAGS = -mcpu=cortex-r4 -mbig-endian ARCHCFLAGS = -fno-builtin ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef diff --git a/configs/launchxl-tms57004/nsh/defconfig b/configs/launchxl-tms57004/nsh/defconfig index d879faf59c5..58a988cadf3 100644 --- a/configs/launchxl-tms57004/nsh/defconfig +++ b/configs/launchxl-tms57004/nsh/defconfig @@ -171,7 +171,7 @@ CONFIG_TMS570_GIO_IRQ=y # CONFIG_ARCH_NOINTC is not set # CONFIG_ARCH_VECNOTIRQ is not set # CONFIG_ARCH_DMA is not set -CONFIG_ARCH_HAVE_IRQPRIO=y +# CONFIG_ARCH_HAVE_IRQPRIO is not set # CONFIG_ARCH_L2CACHE is not set # CONFIG_ARCH_HAVE_COHERENT_DCACHE is not set # CONFIG_ARCH_HAVE_ADDRENV is not set @@ -184,9 +184,8 @@ CONFIG_ARCH_HAVE_MPU=y # CONFIG_ARCH_HAVE_POWEROFF is not set # CONFIG_ARCH_HAVE_RESET is not set # CONFIG_ARCH_USE_MPU is not set -# CONFIG_ARCH_IRQPRIO is not set CONFIG_ARCH_STACKDUMP=y -# CONFIG_ENDIAN_BIG is not set +CONFIG_ENDIAN_BIG=y # CONFIG_ARCH_IDLE_CUSTOM is not set CONFIG_ARCH_HAVE_RAMFUNCS=y # CONFIG_ARCH_RAMFUNCS is not set diff --git a/configs/launchxl-tms57004/scripts/flash-sram.ld b/configs/launchxl-tms57004/scripts/flash-sram.ld index bb4f7f16851..810a2b9b5d8 100644 --- a/configs/launchxl-tms57004/scripts/flash-sram.ld +++ b/configs/launchxl-tms57004/scripts/flash-sram.ld @@ -44,6 +44,7 @@ MEMORY } OUTPUT_ARCH(arm) +OUTPUT_FORMAT(elf32-bigarm) EXTERN(_vectors) ENTRY(_stext) From 6131f788b28e89a59f6a38a9e338593c50007ab6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 26 Dec 2015 18:12:03 -0600 Subject: [PATCH 5/9] LaunchXL-TMS57004: Switch to use big-endian, Cortex-R4 buildroot toolchain --- configs/launchxl-tms57004/README.txt | 44 +++++++++++++++++++++++-- configs/launchxl-tms57004/nsh/Make.defs | 3 ++ configs/launchxl-tms57004/nsh/defconfig | 5 +-- configs/launchxl-tms57004/nsh/setenv.sh | 4 +-- 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/configs/launchxl-tms57004/README.txt b/configs/launchxl-tms57004/README.txt index 4133564892d..d4436f75649 100644 --- a/configs/launchxl-tms57004/README.txt +++ b/configs/launchxl-tms57004/README.txt @@ -8,23 +8,61 @@ README Contents ======== + - Status - Toolchain - LEDs and Buttons - Serial Console - Debugging - Configurations +Status +====== + + The basic port to the TMS570 is complete. Testing is, however, stalled. + The TMD570 hardware is big-endian and I have not yet found an ARM toolchain + that will support big-endian operation. + Toolchain ========= + Build Platform + -------------- All of these configurations are set up to build with Cygwin under Windows - using the "GNU Tools for ARM Embedded Processors" that is maintained by ARM (unless stated otherwise in the description of the configuration). + Endian-ness Issues + ------------------ + I started using the the "GNU Tools for ARM Embedded Processors" that is + maintained by ARM. + https://launchpad.net/gcc-arm-embedded - That toolchain selection can easily be reconfigured using 'make menuconfig'. - Here are the relevant current settings: + However, that tool chain will not support the TMS570 big-endian mode. + Certainly the -mbig-endian options will compiler for big-endian, but the + final link fails because there is no big-endian version lib libgcc. + + There are patches available here if you want to build that toolchain + from scratch: + + https://launchpad.net/gcc-arm-embedded/+question/27995 + + I now use a version of the NuttX buildroot toolchain that can be built like + this: + + cd buildroot/ + cp configs/cortexr4-armeb-eabi-4.8.3-defconfig .config + make oldconfig + make + + You have to have several obscure packages installed on your Linux or Cygwin + system to build the toolchain like this: GMP, MPFR, MPC, and probably + others. See the buildroot/README.txt file for additional important information + about building the toolchain. + + Reconfiguring + ------------- + The build configuration selections can easily be reconfigured using 'make + menuconfig'. Here are the relevant current settings: Build Setup: CONFIG_HOST_WINDOWS=y : Window environment diff --git a/configs/launchxl-tms57004/nsh/Make.defs b/configs/launchxl-tms57004/nsh/Make.defs index f139bb761a9..130dce2b754 100644 --- a/configs/launchxl-tms57004/nsh/Make.defs +++ b/configs/launchxl-tms57004/nsh/Make.defs @@ -107,8 +107,11 @@ LIBEXT = .a EXEEXT = ifneq ($(CROSSDEV),arm-nuttx-elf-) +ifneq ($(CROSSDEV),armeb-nuttx-elf-) LDFLAGS += -nostartfiles -nodefaultlibs endif +endif + ifeq ($(CONFIG_DEBUG_SYMBOLS),y) LDFLAGS += -g endif diff --git a/configs/launchxl-tms57004/nsh/defconfig b/configs/launchxl-tms57004/nsh/defconfig index 58a988cadf3..cf156c72668 100644 --- a/configs/launchxl-tms57004/nsh/defconfig +++ b/configs/launchxl-tms57004/nsh/defconfig @@ -130,12 +130,13 @@ CONFIG_ARCH_LOWVECTORS=y CONFIG_ARMV7R_MEMINIT=y # CONFIG_ARMV7R_HAVE_L2CC is not set # CONFIG_ARMV7R_HAVE_L2CC_PL310 is not set -# CONFIG_ARMV7R_TOOLCHAIN_BUILDROOT is not set +CONFIG_ARMV7R_TOOLCHAIN_BUILDROOT=y # CONFIG_ARMV7R_TOOLCHAIN_CODESOURCERYW is not set # CONFIG_ARMV7R_TOOLCHAIN_DEVKITARM is not set # CONFIG_ARMV7R_TOOLCHAIN_GNU_EABIL is not set -CONFIG_ARMV7R_TOOLCHAIN_GNU_EABIW=y +# CONFIG_ARMV7R_TOOLCHAIN_GNU_EABIW is not set # CONFIG_ARMV7R_TOOLCHAIN_GNU_OABI is not set +# CONFIG_ARMV7R_OABI_TOOLCHAIN is not set CONFIG_ARMV7R_HAVE_DECODEFIQ=y # CONFIG_ARMV7R_DECODEFIQ is not set # CONFIG_SERIAL_TERMIOS is not set diff --git a/configs/launchxl-tms57004/nsh/setenv.sh b/configs/launchxl-tms57004/nsh/setenv.sh index 29889dedf67..2f7b6d3ed86 100644 --- a/configs/launchxl-tms57004/nsh/setenv.sh +++ b/configs/launchxl-tms57004/nsh/setenv.sh @@ -61,7 +61,7 @@ fi # This is the location where I installed the ARM "GNU Tools for ARM Embedded Processors" # You can this free toolchain here https://launchpad.net/gcc-arm-embedded -export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin" +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin" # This is the path to the location where I installed the devkitARM toolchain # You can get this free toolchain from http://devkitpro.org/ or http://sourceforge.net/projects/devkitpro/ @@ -69,7 +69,7 @@ export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 # This is the Cygwin path to the location where I build the buildroot # toolchain. -# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin" +export TOOLCHAIN_BIN="${WD}/../buildroot/build_armeb/staging_dir/bin" # Add the path to the toolchain to the PATH varialble export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" From 19ee04192b5dd45b6e2a9ce7f12d96a61ef94ef3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 26 Dec 2015 18:34:42 -0600 Subject: [PATCH 6/9] LaunchXL-TMS57004: Correct some comments: The LaunchXL has more that 4 LEDs --- configs/launchxl-tms57004/README.txt | 12 ++++++++---- configs/launchxl-tms57004/include/board.h | 12 ++++++++---- .../launchxl-tms57004/src/launchxl-tms57004.h | 12 ++++++++---- configs/launchxl-tms57004/src/tms570_autoleds.c | 12 ++++++++---- configs/launchxl-tms57004/src/tms570_userleds.c | 17 +++++++++++++++++ 5 files changed, 49 insertions(+), 16 deletions(-) diff --git a/configs/launchxl-tms57004/README.txt b/configs/launchxl-tms57004/README.txt index d4436f75649..e20040d8738 100644 --- a/configs/launchxl-tms57004/README.txt +++ b/configs/launchxl-tms57004/README.txt @@ -76,10 +76,14 @@ LEDs and Buttons LEDs ---- - The launchpad has a four LEDs two power LEDs labeled D1 (red) that - connects to the TMS570's NERROR pin and D7 (blue) that indicates the - XDS200 POWER_EN signal, and two white, user LEDs labeled D12 that - connects to the NHET08 pin and D11 that connects to GIOA2. + The launchpad has several LEDs: + + - LEd D1 (white) that connects to the USB +5V supply, + - LED D10 (red) that connects to the TMS570's NERROR pin, + - D5 (blue), D6 (blue), and D8 (blue) connect to the XDS100 FT2322, + - D7 (blue) connects to the XSD100 CPLD, and + - Two white, user LEDs labeled D12 that connects to the NHET08 + pin and D11 that connects to GIOA2. NHET08 is one of 32 N2HET pins than can be available to the user if not used by N2HET. This implementation, however, uses only the single diff --git a/configs/launchxl-tms57004/include/board.h b/configs/launchxl-tms57004/include/board.h index 456fd16522b..49d39309398 100644 --- a/configs/launchxl-tms57004/include/board.h +++ b/configs/launchxl-tms57004/include/board.h @@ -181,10 +181,14 @@ /* LED definitions ******************************************************************/ /* LEDs * - * The launchpad has a four LEDs two power LEDs labeled D1 (red) that connects to - * the TMS570's NERROR pin and D7 (blue) that indicates the XDS200 POWER_EN signal, - * and two white, user LEDs labeled D12 that connects to the NHET08 pin and D11 - * that connects to GIOA2. + * The launchpad has several LEDs: + * + * - LEd D1 (white) that connects to the USB +5V supply, + * - LED D10 (red) that connects to the TMS570's NERROR pin, + * - D5 (blue), D6 (blue), and D8 (blue) connect to the XDS100 FT2322, + * - D7 (blue) connects to the XSD100 CPLD, and + * - Two white, user LEDs labeled D12 that connects to the NHET08 + * pin and D11 that connects to GIOA2. * * NHET08 is one of 32 N2HET pins than can be available to the user if not used by * N2HET. This implementation, however, uses only the single LED driven by GIOA2. diff --git a/configs/launchxl-tms57004/src/launchxl-tms57004.h b/configs/launchxl-tms57004/src/launchxl-tms57004.h index 3eb4f42d6aa..2e7e91a64c9 100644 --- a/configs/launchxl-tms57004/src/launchxl-tms57004.h +++ b/configs/launchxl-tms57004/src/launchxl-tms57004.h @@ -48,10 +48,14 @@ /* LEDs * - * The launchpad has a four LEDs two power LEDs labeled D1 (red) that - * connects to the TMS570's NERROR pin and D7 (blue) that indicates the - * XDS200 POWER_EN signal, and two white, user LEDs labeled D12 that - * connects to the NHET08 pin and D11 that connects to GIOA2. + * The launchpad has several LEDs: + * + * - LEd D1 (white) that connects to the USB +5V supply, + * - LED D10 (red) that connects to the TMS570's NERROR pin, + * - D5 (blue), D6 (blue), and D8 (blue) connect to the XDS100 FT2322, + * - D7 (blue) connects to the XSD100 CPLD, and + * - Two white, user LEDs labeled D12 that connects to the NHET08 + * pin and D11 that connects to GIOA2. * * NHET08 is one of 32 N2HET pins than can be available to the user if not * used by N2HET. This implementation, however, uses only the single LED diff --git a/configs/launchxl-tms57004/src/tms570_autoleds.c b/configs/launchxl-tms57004/src/tms570_autoleds.c index 35c2302a10e..761986041d7 100644 --- a/configs/launchxl-tms57004/src/tms570_autoleds.c +++ b/configs/launchxl-tms57004/src/tms570_autoleds.c @@ -35,10 +35,14 @@ /* LEDs * - * The launchpad has a four LEDs two power LEDs labeled D1 (red) that - * connects to the TMS570's NERROR pin and D7 (blue) that indicates the - * XDS200 POWER_EN signal, and two white, user LEDs labeled D12 that - * connects to the NHET08 pin and D11 that connects to GIOA2. + * The launchpad has several LEDs: + * + * - LEd D1 (white) that connects to the USB +5V supply, + * - LED D10 (red) that connects to the TMS570's NERROR pin, + * - D5 (blue), D6 (blue), and D8 (blue) connect to the XDS100 FT2322, + * - D7 (blue) connects to the XSD100 CPLD, and + * - Two white, user LEDs labeled D12 that connects to the NHET08 + * pin and D11 that connects to GIOA2. * * NHET08 is one of 32 N2HET pins than can be available to the user if * not used by N2HET. This implementation, however, uses only the single diff --git a/configs/launchxl-tms57004/src/tms570_userleds.c b/configs/launchxl-tms57004/src/tms570_userleds.c index 2249c1278fc..efa63fb97c5 100644 --- a/configs/launchxl-tms57004/src/tms570_userleds.c +++ b/configs/launchxl-tms57004/src/tms570_userleds.c @@ -33,6 +33,23 @@ * ****************************************************************************/ +/* LEDs + * + * The launchpad has several LEDs: + * + * - LEd D1 (white) that connects to the USB +5V supply, + * - LED D10 (red) that connects to the TMS570's NERROR pin, + * - D5 (blue), D6 (blue), and D8 (blue) connect to the XDS100 FT2322, + * - D7 (blue) connects to the XSD100 CPLD, and + * - Two white, user LEDs labeled D12 that connects to the NHET08 + * pin and D11 that connects to GIOA2. + * + * NHET08 is one of 32 N2HET pins than can be available to the user if + * not used by N2HET. This implementation, however, uses only the single + * LED driven by GIOA2. That LED is tied to ground and illuminated + * with a high level output value. + */ + /**************************************************************************** * Included Files ****************************************************************************/ From a9c95b22a90c15e8f6494c964f05370b0cfecee2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 27 Dec 2015 09:27:41 -0600 Subject: [PATCH 7/9] Update README --- configs/launchxl-tms57004/README.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/launchxl-tms57004/README.txt b/configs/launchxl-tms57004/README.txt index e20040d8738..3b97bfa9527 100644 --- a/configs/launchxl-tms57004/README.txt +++ b/configs/launchxl-tms57004/README.txt @@ -18,9 +18,9 @@ Contents Status ====== - The basic port to the TMS570 is complete. Testing is, however, stalled. - The TMD570 hardware is big-endian and I have not yet found an ARM toolchain - that will support big-endian operation. + The basic port to the TMS570 is complete. After a few debug attempts, + I think I may have damaged my board: The CPU NERROR LED illuminates, JTAG + no longer recognizes the part, and can't re-program the FLASH. Toolchain ========= From c0c87a4bad07cfe976486dc8423d4a4007a7df65 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 28 Dec 2015 09:14:20 -0600 Subject: [PATCH 8/9] TMS570: I think that the correct SCI configuration is 9600 baude w/2 stop bits --- configs/launchxl-tms57004/nsh/defconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/launchxl-tms57004/nsh/defconfig b/configs/launchxl-tms57004/nsh/defconfig index cf156c72668..4fb810a9b4a 100644 --- a/configs/launchxl-tms57004/nsh/defconfig +++ b/configs/launchxl-tms57004/nsh/defconfig @@ -462,10 +462,10 @@ CONFIG_SCI1_SERIAL_CONSOLE=y # CONFIG_SCI1_RXBUFSIZE=256 CONFIG_SCI1_TXBUFSIZE=256 -CONFIG_SCI1_BAUD=115200 +CONFIG_SCI1_BAUD=9600 CONFIG_SCI1_BITS=8 CONFIG_SCI1_PARITY=0 -CONFIG_SCI1_2STOP=0 +CONFIG_SCI1_2STOP=1 # CONFIG_USBDEV is not set # CONFIG_USBHOST is not set # CONFIG_WIRELESS is not set From db0d2546e2754077019a965f123f292085ba5bbf Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 28 Dec 2015 09:43:21 -0600 Subject: [PATCH 9/9] TMS570: Try a more reasonable loops-per-msec value --- configs/launchxl-tms57004/nsh/defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/launchxl-tms57004/nsh/defconfig b/configs/launchxl-tms57004/nsh/defconfig index 4fb810a9b4a..97a0cd0de3b 100644 --- a/configs/launchxl-tms57004/nsh/defconfig +++ b/configs/launchxl-tms57004/nsh/defconfig @@ -195,7 +195,7 @@ CONFIG_ARCH_HAVE_RAMFUNCS=y # # Board Settings # -CONFIG_BOARD_LOOPSPERMSEC=51262 +CONFIG_BOARD_LOOPSPERMSEC=5000 # CONFIG_ARCH_CALIBRATION is not set #