Add basic board support for the TM4C123G Launchpad

This commit is contained in:
Gregory Nutt
2014-03-10 11:25:06 -06:00
parent 688718fadb
commit f43278c400
18 changed files with 2899 additions and 1 deletions
+13
View File
@@ -737,6 +737,15 @@ config ARCH_BOARD_TEENSY
developed by http://pjrc.com/teensy/. The Teensy++ 2.0 is based
on an Atmel AT90USB1286 MCU.
config ARCH_BOARD_TM4C123G_LAUNCHPAD
bool "Tiva TM4C124G LaunchPad"
depends on ARCH_CHIP_TM4C123GH6ZRB
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS
---help---
Tiva TM4C123G LaunchPad.
config ARCH_BOARD_TWR_K60N512
bool "FreeScale TWR-K60N512d evelopment board"
depends on ARCH_CHIP_MK60N512VMD100
@@ -958,6 +967,7 @@ config ARCH_BOARD
default "mikroe-stm32f4" if ARCH_BOARD_MIKROE_STM32F4
default "sure-pic32mx" if ARCH_BOARD_SUREPIC32MX
default "teensy" if ARCH_BOARD_TEENSY
default "tm4c123g-launchpad" if ARCH_BOARD_TM4C123G_LAUNCHPAD
default "twr-k60n512" if ARCH_BOARD_TWR_K60N512
default "ubw32" if ARCH_BOARD_UBW32
default "us7032evb1" if ARCH_BOARD_US7032EVB1
@@ -1240,6 +1250,9 @@ endif
if ARCH_BOARD_TEENSY
source "configs/teensy/Kconfig"
endif
if ARCH_BOARD_TM4C123G_LAUNCHPAD
source "configs/tm4c123g-launchpad/Kconfig"
endif
if ARCH_BOARD_TWR_K60N512
source "configs/twr-k60n512/Kconfig"
endif
+7 -1
View File
@@ -268,7 +268,7 @@ configs/lm3s8962-ek
configs/lm4f120-launchpad
This is the port of NuttX to the Stellaris LM4F120 LaunchPad. The
Stellaris® LM4F120 LaunchPad Evaluation Board is a low-cost evaluation
platform for ARM® Cortex™-M4F-based microcontrollers from Texas\
platform for ARM® Cortex™-M4F-based microcontrollers from Texas
Instruments.
configs/lpcxpresso-lpc1768
@@ -543,6 +543,12 @@ configs/teensy
developed by http://pjrc.com/teensy/. The Teensy++ 2.0 is based
on an Atmel AT90USB1286 MCU.
configs/tm4c123g-launchpad
This is the port of NuttX to the Tiva TM4C123G LaunchPad. The
Tiva® TM4C123G LaunchPad Evaluation Board is a low-cost evaluation
platform for ARM® Cortex™-M4F-based microcontrollers from Texas
Instruments.
configs/twr-k60n512
Kinetis K60 Cortex-M4 MCU. This port uses the FreeScale TWR-K60N512
development board.
+7
View File
@@ -0,0 +1,7 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
if ARCH_BOARD_TM4C123G_LAUNCHPAD
endif
File diff suppressed because it is too large Load Diff
+222
View File
@@ -0,0 +1,222 @@
/************************************************************************************
* configs/tm4c123g-launchpad/include/board.h
*
* Copyright (C) 2014 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 __CONFIGS_TMC4C123G_LAUNCHPAD_INCLUDE_BOARD_H
#define __CONFIGS_TMC4C123G_LAUNCHPAD_INCLUDE_BOARD_H
/************************************************************************************
* Included Files
************************************************************************************/
/************************************************************************************
* Definitions
************************************************************************************/
/* Clocking *************************************************************************/
/* RCC settings. Crystals on-board the TMC4C123G LaunchPad include:
*
* 16MHz connected to OSC0/1 (pins 40/41)
* 32.768kHz connected to XOSC0/1 (pins 34/36)
*/
#define SYSCON_RCC_XTAL SYSCON_RCC_XTAL16000KHZ /* On-board crystal is 16 MHz */
#define XTAL_FREQUENCY 16000000
/* Oscillator source is the main oscillator */
#define SYSCON_RCC_OSCSRC SYSCON_RCC_OSCSRC_MOSC
#define SYSCON_RCC2_OSCSRC SYSCON_RCC2_OSCSRC2_MOSC
#define OSCSRC_FREQUENCY XTAL_FREQUENCY
/* Use system divider = 4; this corresponds to a system clock frequency
* of (400 / 1) / 5 = 80MHz (Using RCC2 and DIV400).
*/
#define TIVA_SYSDIV 5
#define SYSCLK_FREQUENCY 80000000 /* 80MHz */
/* Other RCC settings:
*
* - Main and internal oscillators enabled.
* - PLL and sys dividers not bypassed
* - PLL not powered down
* - No auto-clock gating reset
*/
#define TIVA_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | \
SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(TIVA_SYSDIV))
/* RCC2 settings
*
* - PLL and sys dividers not bypassed.
* - PLL not powered down
* - Not using RCC2
*
* When SYSCON_RCC2_DIV400 is not selected, SYSDIV2 is the divisor-1.
* When SYSCON_RCC2_DIV400 is selected, SYSDIV2 is the divisor-1)/2, plus
* the LSB:
*
* SYSDIV2 SYSDIV2LSB DIVISOR
* 0 N/A 2
* 1 0 3
* " 1 4
* 2 0 5
* " 1 6
* etc.
*/
#if (TIVA_SYSDIV & 1) == 0
# define TIVA_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV2LSB | \
SYSCON_RCC2_SYSDIV_DIV400(TIVA_SYSDIV) | \
SYSCON_RCC2_DIV400 | SYSCON_RCC2_USERCC2)
#else
# define TIVA_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV_DIV400(TIVA_SYSDIV) | \
SYSCON_RCC2_DIV400 | SYSCON_RCC2_USERCC2)
#endif
/* LED definitions ******************************************************************/
/* The TMC4C123G LaunchPad has a single RGB LED. There is only one visible LED which
* will vary in color. But, from the standpoint of the firmware, this appears as
* three LEDs:
*
* BOARD_LED_R -- Connected to PF1
* BOARD_LED_G -- Connected to PF3
* BOARD_LED_B -- Connected to PF2
*/
/* LED index values for use with tm4c_setled() */
#define BOARD_LED_R 0
#define BOARD_LED_G 1
#define BOARD_LED_B 2
#define BOARD_NLEDS 3
/* LED bits for use with tm4c_setleds() */
#define BOARD_LED1_BIT (1 << BOARD_LED1)
#define BOARD_LED2_BIT (1 << BOARD_LED2)
/* If CONFIG_ARCH_LEDS is defined, then automated support for the LaunchPad LEDs
* will be included in the build:
*
* OFF:
* - OFF means that the OS is still initializing. Initialization is very fast so
* if you see this at all, it probably means that the system is hanging up
* somewhere in the initialization phases.
*
* GREEN or GREEN-ish
* - This means that the OS completed initialization.
*
* Bluish:
* - Whenever and interrupt or signal handler is entered, the BLUE LED is
* illuminated and extinguished when the interrupt or signal handler exits.
* This will add a BLUE-ish tinge to the LED.
*
* Redish:
* - If a recovered assertion occurs, the RED component will be illuminated
* briefly while the assertion is handled. You will probably never see this.
*
* Flashing RED:
* - In the event of a fatal crash, the BLUE and GREEN components will be
* extinguished and the RED component will FLASH at a 2Hz rate.
*/
/* RED GREEN BLUE */
#define LED_STARTED 0 /* OFF OFF OFF */
#define LED_HEAPALLOCATE 0 /* OFF OFF OFF */
#define LED_IRQSENABLED 0 /* OFF OFF OFF */
#define LED_STACKCREATED 1 /* OFF ON OFF */
#define LED_INIRQ 2 /* NC NC ON (momentary) */
#define LED_SIGNAL 2 /* NC NC ON (momentary) */
#define LED_ASSERTION 3 /* ON NC NC (momentary) */
#define LED_PANIC 4 /* ON OFF OFF (flashing 2Hz) */
/* LED definitions ******************************************************************/
/* The TMC4C123G LaunchPad has a two buttons:
*
* BOARD_SW1 -- Connected to PF4
* BOARD_SW2 -- Connected to PF0
*/
#define BUTTON_SW1 0
#define BUTTON_SW2 1
#define NUM_BUTTONS 2
#define BUTTON_SW1_BIT (1 << BUTTON_SW1)
#define BUTTON_SW2_BIT (1 << BUTTON_SW2)
/* Pin Multiplexing Disambiguation **************************************************/
#define GPIO_UART1_CTS GPIO_UART1_CTS_1
#define GPIO_UART1_RTS GPIO_UART1_RTS_1
#define GPIO_UART1_RX GPIO_UART1_RX_1
#define GPIO_UART1_TX GPIO_UART1_TX_1
/************************************************************************************
* Public Function Prototypes
************************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
* Name: tiva_boardinitialize
*
* Description:
* All Tiva architectures must provide the following entry point. This entry
* point is called early in the intitialization -- after all memory has been
* configured and mapped but before any devices have been initialized.
*
************************************************************************************/
void tiva_boardinitialize(void);
/************************************************************************************
* Name: tm4c_ledinit, tm4c_setled, and tm4c_setleds
*
* Description:
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LED. If
* CONFIG_ARCH_LEDS is not defined, then the following interfaces are available to
* control the LEDs from user applications.
*
************************************************************************************/
#ifndef CONFIG_ARCH_LEDS
void tm4c_ledinit(void);
void tm4c_setled(int led, bool ledon);
void tm4c_setleds(uint8_t ledset);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_TMC4C123G_LAUNCHPAD_INCLUDE_BOARD_H */
+110
View File
@@ -0,0 +1,110 @@
############################################################################
# configs/tm4c123g-launchpad/nsh/Make.defs
#
# Copyright (C) 2014 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.
#
############################################################################
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.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)/scripts/ld.script}"
else
# Linux/Cygwin-native toolchain
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)/scripts/ld.script
endif
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
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 ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifneq ($(CROSSDEV),arm-nuttx-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+74
View File
@@ -0,0 +1,74 @@
#!/bin/bash
# configs/tm4c123g-launchpad/nsh/setenv.sh
#
# Copyright (C) 2014 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.
#
if [ "$_" = "$0" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
WD=`pwd`
if [ ! -x "setenv.sh" ]; then
echo "This script must be executed from the top-level NuttX build directory"
exit 1
fi
if [ -z "${PATH_ORIG}" ]; then
export PATH_ORIG="${PATH}"
fi
# This is the Cygwin path to the location where I installed the CodeSourcery
# toolchain under windows. You will also have to edit this if you install
# the CodeSourcery toolchain in any other location
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
# These are the Cygwin paths to the locations where I installed the Atollic
# toolchain under windows. You will also have to edit this if you install
# the Atollic toolchain in any other location. /usr/bin is added before
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
# at those locations as well.
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
# This is the Cygwin path to the location where I build the buildroot
# toolchain.
export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
# The tm4c123g-launchpad/tools directory
export TOOL_DIR="${WD}/configs/tm4c123g-launchpad/tools"
# Add the path to the toolchain and tools directory to the PATH varialble
export PATH="${TOOLCHAIN_BIN}:${TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"
+115
View File
@@ -0,0 +1,115 @@
/****************************************************************************
* configs/tm4c123g-launchpad/scripts/ld.script
*
* Copyright (C) 2014 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.
*
****************************************************************************/
/* The TM4C123GH6ZRB has 256Kb of FLASH beginning at address 0x0000:0000 and
* 32Kb of SRAM beginning at 0x2000:0000.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
}
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
.ARM.extab : {
*(.ARM.extab*)
} > flash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > flash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* 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) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}
@@ -0,0 +1,2 @@
/.depend
/Make.dep
+91
View File
@@ -0,0 +1,91 @@
############################################################################
# configs/tm4c123g-launchpad/src/Makefile
#
# Copyright (C) 2014 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.
#
############################################################################
-include $(TOPDIR)/Make.defs
CFLAGS += -I$(TOPDIR)/sched
ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = tm4c_boot.c tm4c_ssi.c
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += tm4c_autoleds.c
endif
ifeq ($(CONFIG_NSH_ARCHINIT),y)
CSRCS += tm4c_nsh.c
endif
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
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)/armv7-m}"
else
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
endif
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, libboard$(LIBEXT))
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep
@@ -0,0 +1,223 @@
/****************************************************************************
* configs/tm4c123g-launchpad/src/tm4c_leds.c
*
* Copyright (C) 2014 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <debug.h>
#include <arch/board/board.h>
#include "chip.h"
#include "up_arch.h"
#include "up_internal.h"
#include "tiva_gpio.h"
#include "tm4c123g-launchpad.h"
/****************************************************************************
* Definitions
****************************************************************************/
/* The TM4C123G LaunchPad has a single RGB LED. There is only one visible LED
* which will vary in color. But, from the standpoint of the firmware, this
* appears as three LEDs:
*
* BOARD_LED_R -- Connected to PF1
* BOARD_LED_G -- Connected to PF3
* BOARD_LED_B -- Connected to PF2
*
* If CONFIG_ARCH_LEDS is defined, then automated support for the LaunchPad LEDs
* will be included in the build:
*
* OFF:
* - OFF means that the OS is still initializing. Initialization is very fast so
* if you see this at all, it probably means that the system is hanging up
* somewhere in the initialization phases.
*
* GREEN or GREEN-ish
* - This means that the OS completed initialization.
*
* Bluish:
* - Whenever and interrupt or signal handler is entered, the BLUE LED is
* illuminated and extinguished when the interrupt or signal handler exits.
* This will add a BLUE-ish tinge to the LED.
*
* Redish:
* - If a recovered assertion occurs, the RED component will be illuminated
* briefly while the assertion is handled. You will probably never see this.
*
* Flashing RED:
* - In the event of a fatal crash, the BLUE and GREEN components will be
* extinguished and the RED component will FLASH at a 2Hz rate.
*
* RED GREEN BLUE
* LED_STARTED 0 OFF OFF OFF
* LED_HEAPALLOCATE 0 OFF OFF OFF
* LED_IRQSENABLED 0 OFF OFF OFF
* LED_STACKCREATED 1 OFF ON OFF
* LED_INIRQ 2 NC NC ON (momentary)
* LED_SIGNAL 2 NC NC ON (momentary)
* LED_ASSERTION 3 ON NC NC (momentary)
* LED_PANIC 4 ON OFF OFF (flashing 2Hz)
*/
/* 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
/* Dump GPIO registers */
#ifdef CONFIG_DEBUG_LEDS
# define led_dumpgpio(m) tiva_dumpgpio(LED_GPIO, m)
#else
# define led_dumpgpio(m)
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: tm4c_ledinit
*
* Description:
* Called to initialize the on-board LEDs.
*
****************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void tm4c_ledinit(void)
{
leddbg("Initializing\n");
/* Configure Port E, Bit 1 as an output, initial value=OFF */
led_dumpgpio("tm4c_ledinit before tiva_configgpio()");
tiva_configgpio(GPIO_LED_R);
tiva_configgpio(GPIO_LED_G);
tiva_configgpio(GPIO_LED_B);
led_dumpgpio("tm4c_ledinit after tiva_configgpio()");
}
/****************************************************************************
* Name: board_led_on
****************************************************************************/
void board_led_on(int led)
{
switch (led)
{
/* All components stay off until the file initialization step */
default:
case 0:
break;
/* The GREEN component is illuminated at the final initialization step */
case 1:
tiva_gpiowrite(GPIO_LED_G, false);
break;
/* These will illuminate the BLUE component with on effect no RED and GREEN */
case 2:
tiva_gpiowrite(GPIO_LED_B, false);
break;
/* This will turn off RED and GREEN and turn RED on */
case 4:
tiva_gpiowrite(GPIO_LED_G, true);
tiva_gpiowrite(GPIO_LED_B, true);
/* This will illuminate the RED component with no effect on RED and GREEN */
case 3:
tiva_gpiowrite(GPIO_LED_R, false);
break;
}
}
/****************************************************************************
* Name: board_led_off
****************************************************************************/
void board_led_off(int led)
{
switch (led)
{
/* These should not happen and are ignored */
default:
case 0:
case 1:
break;
/* These will extinguish the BLUE component with no effect on RED and GREEN */
case 2:
tiva_gpiowrite(GPIO_LED_B, true);
break;
/* These will extinguish the RED component with on effect on RED and GREEN */
case 3:
case 4:
tiva_gpiowrite(GPIO_LED_R, true);
break;
}
}
#endif /* CONFIG_ARCH_LEDS */
@@ -0,0 +1,92 @@
/************************************************************************************
* configs/tm4c123g-launchpad/src/tm4c_boot.c
*
* Copyright (C) 2014 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.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "tm4c123g-launchpad.h"
/************************************************************************************
* Definitions
************************************************************************************/
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: tiva_boardinitialize
*
* Description:
* All Tiva architectures must provide the following entry point. This entry
* point is called early in the intitialization -- after all memory has been
* configured and mapped but before any devices have been initialized.
*
************************************************************************************/
void tiva_boardinitialize(void)
{
/* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function
* tm4c_ssiinitialize() has been brought into the link.
*/
/* The TM4C123G LaunchPad microSD CS and OLED are on SSI0 */
#if !defined(CONFIG_SSI0_DISABLE) || !defined(CONFIG_SSI1_DISABLE)
if (tm4c_ssiinitialize)
{
tm4c_ssiinitialize();
}
#endif
/* Configure on-board LEDs if LED support has been selected. */
#ifdef CONFIG_ARCH_LEDS
tm4c_ledinit();
#endif
}
+92
View File
@@ -0,0 +1,92 @@
/****************************************************************************
* config/tm4c123g-launchpad/src/tm4c_nsh.c
*
* Copyright (C) 2014 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/spi/spi.h>
#include <nuttx/mmcsd.h>
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Can't support USB features if USB is not enabled */
#ifndef CONFIG_USBDEV
# undef NSH_HAVEUSBDEV
#endif
/* Debug ********************************************************************/
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lowsyslog(__VA_ARGS__)
# else
# define message(...) printf(__VA_ARGS__)
# endif
#else
# ifdef CONFIG_DEBUG
# define message lowsyslog
# else
# define message printf
# endif
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nsh_archinitialize
*
* Description:
* Perform architecture specific initialization
*
****************************************************************************/
int nsh_archinitialize(void)
{
return OK;
}
+132
View File
@@ -0,0 +1,132 @@
/************************************************************************************
* configs/tm4c123g-launchpad/src/tm4c_ssi.c
*
* Copyright (C) 2014 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.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "chip.h"
#include "tiva_gpio.h"
#include "tm4c123g-launchpad.h"
/* The TM4C123G LaunchPad microSD CS is on SSI0 */
#if !defined(CONFIG_SSI0_DISABLE) || !defined(CONFIG_SSI1_DISABLE)
/************************************************************************************
* Definitions
************************************************************************************/
/* CONFIG_DEBUG_SPI enables debug output from this file (needs CONFIG_DEBUG too) */
#ifdef CONFIG_DEBUG_SPI
# define ssidbg lldbg
#else
# define ssidbg(x...)
#endif
/* Dump GPIO registers */
#if defined(CONFIG_DEBUG_SPI) && defined(CONFIG_DEBUG_VERBOSE)
# define ssivdbg lldbg
# define ssi_dumpgpio(m) tiva_dumpgpio(SDCCS_GPIO, m)
#else
# define ssivdbg(x...)
# define ssi_dumpgpio(m)
#endif
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: tm4c_ssiinitialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the TM4C123G LaunchPad.
*
************************************************************************************/
void weak_function tm4c_ssiinitialize(void)
{
}
/****************************************************************************
* The external functions, tiva_spiselect and tiva_spistatus must be provided
* by board-specific logic. The are implementations of the select and status
* methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi/spi.h).
* All othermethods (including tiva_spiinitialize()) are provided by common
* logic. To use this common SPI logic on your board:
*
* 1. Provide tiva_spiselect() and tiva_spistatus() functions in your
* board-specific logic. This function will perform chip selection and
* status operations using GPIOs in the way your board is configured.
* 2. Add a call to tiva_spiinitialize() in your low level initialization
* logic
* 3. The handle returned by tiva_spiinitialize() may then be used to bind the
* SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
****************************************************************************/
void tiva_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
{
ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssi_dumpgpio("tiva_spiselect() Entry");
ssi_dumpgpio("tiva_spiselect() Exit");
}
uint8_t tiva_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
ssidbg("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
}
#endif /* !CONFIG_SSI0_DISABLE || !CONFIG_SSI1_DISABLE */
@@ -0,0 +1,152 @@
/************************************************************************************
* configs/tm4c123g-launchpad/src/tm4c123g-launchpad.h
*
* Copyright (C) 2014 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 __CONFIGS_TM4C123G_LAUNCHPAD_TM4C123G_LAUNCHPAD_H
#define __CONFIGS_TM4C123G_LAUNCHPAD_TM4C123G_LAUNCHPAD_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include "chip.h"
#include "tiva_gpio.h"
/************************************************************************************
* Definitions
************************************************************************************/
/* How many SSI modules does this chip support? */
#if TIVA_NSSI < 1
# undef CONFIG_SSI0_DISABLE
# define CONFIG_SSI0_DISABLE 1
# undef CONFIG_SSI1_DISABLE
# define CONFIG_SSI1_DISABLE 1
#elif TIVA_NSSI < 2
# undef CONFIG_SSI1_DISABLE
# define CONFIG_SSI1_DISABLE 1
#endif
/* TM4C123G LaunchPad ***************************************************************/
/* The TM4C123G LaunchPad has a single RGB LED. There is only one visible LED which
* will vary in color. But, from the standpoint of the firmware, this appears as
* three LEDs:
*
* BOARD_LED_R -- Connected to PF1
* BOARD_LED_G -- Connected to PF3
* BOARD_LED_B -- Connected to PF2
*
* If CONFIG_ARCH_LEDS is defined, then automated support for the LaunchPad LEDs
* will be included in the build:
*
* OFF:
* - OFF means that the OS is still initializing. Initialization is very fast so
* if you see this at all, it probably means that the system is hanging up
* somewhere in the initialization phases.
*
* GREEN or GREEN-ish
* - This means that the OS completed initialization.
*
* Bluish:
* - Whenever and interrupt or signal handler is entered, the BLUE LED is
* illuminated and extinguished when the interrupt or signal handler exits.
* This will add a BLUE-ish tinge to the LED.
*
* Redish:
* - If a recovered assertion occurs, the RED component will be illuminated
* briefly while the assertion is handled. You will probably never see this.
*
* Flashing RED:
* - In the event of a fatal crash, the BLUE and GREEN components will be
* extinguished and the RED component will FLASH at a 2Hz rate.
*
* RED GREEN BLUE
* LED_STARTED 0 OFF OFF OFF
* LED_HEAPALLOCATE 0 OFF OFF OFF
* LED_IRQSENABLED 0 OFF OFF OFF
* LED_STACKCREATED 1 OFF ON OFF
* LED_INIRQ 2 NC NC ON (momentary)
* LED_SIGNAL 2 NC NC ON (momentary)
* LED_ASSERTION 3 ON NC NC (momentary)
* LED_PANIC 3 ON OFF OFF (flashing 2Hz)
*/
#define GPIO_LED_R (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTF | GPIO_PIN_1)
#define GPIO_LED_G (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTF | GPIO_PIN_3)
#define GPIO_LED_B (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTF | GPIO_PIN_2)
/* The TM4C123G LaunchPad has a two buttons:
*
* BOARD_SW1 -- Connected to PF4
* BOARD_SW2 -- Connected to PF0
*/
#define GPIO_SW1 (GPIO_FUNC_INTERRUPT | GPIO_INT_BOTHEDGES | GPIO_PORTF | GPIO_PIN_1)
#define GPIO_SW2 (GPIO_FUNC_INTERRUPT | GPIO_INT_BOTHEDGES | GPIO_PORTF | GPIO_PIN_1)
/************************************************************************************
* Public Functions
************************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
* Name: tm4c_ssiinitialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the TM4C123G LaunchPad.
*
************************************************************************************/
void weak_function tm4c_ssiinitialize(void);
/****************************************************************************
* Name: tm4c_ledinit
*
* Description:
* Called to initialize the on-board LEDs.
*
****************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void tm4c_ledinit(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_TM4C123G_LAUNCHPAD_TM4C123G_LAUNCHPAD_H */
@@ -0,0 +1,71 @@
#
# TI Tiva Launchpad ek-tm4c123gxl Evaluation Kits
#
# http://www.ti.com/tool/ek-tm4c123gxl
#
#
# NOTE: using the bundled ICDI interface is optional!
# This interface is not ftdi based as previous boards were
#
# Interface configuration
#
# TI Tiva In-Circuit Debug Interface (ICDI) Board
#
# This is the propriety ICDI interface used on newer boards such as
# LM4F232 Evaluation Kit - http://www.ti.com/tool/ek-lm4f232
# Tiva Launchpad - http://www.ti.com/stellaris-launchpad
# http://www.ti.com/tool/ek-lm4f232
#
interface hla
hla_layout ti-icdi
hla_vid_pid 0x1cbe 0x00fd
# Board configuration
# unused but set to disable warnings
adapter_khz 1000
set WORKAREASIZE 0x8000
set CHIPNAME tm4c123gh5qr
# Target configuration
#
# lm3s icdi pseudo target
#
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME lm3s
}
# Work-area is a space in RAM used for flash programming
# By default use 16kB
if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
set _WORKAREASIZE 0x4000
}
#
# possible value are hla_jtag
# currently swd is not supported
#
transport select hla_jtag
# do not check id as icdi currently does not support it
hla newtap $_CHIPNAME cpu -expected-id 0
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME hla_target -chain-position $_TARGETNAME
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
# flash configuration ... autodetects sizes, autoprobed
flash bank $_CHIPNAME.flash stellaris 0 0 0 0 $_TARGETNAME
+58
View File
@@ -0,0 +1,58 @@
#!/bin/sh
#
# See configs/tm4c123g-launchpad/README.txt for information about
# this file.
TOPDIR=$1
USAGE="$0 <TOPDIR> [-d]"
if [ -z "${TOPDIR}" ]; then
echo "Missing argument"
echo $USAGE
exit 1
fi
# Assume that OpenOCD was installed and at /usr/local/bin. Uncomment
# the following to run directly from the build directory
# OPENOCD_PATH="/home/OpenOCD/openocd/src"
# OPENOCD_PATH="/usr/bin"
OPENOCD_PATH="/usr/local/bin"
# TARGET_PATH="/home/OpenOCD/openocd/tcl"
# TARGET_PATH="/usr/share/openocd/scripts"
TARGET_PATH="/usr/local/share/openocd/scripts"
# Assume a Unix development environment. Uncomment to use a Windows
# like environment
# OPENOCD_EXE=openocd.exe
OPENOCD_EXE=openocd
OPENOCD_CFG="${TOPDIR}/configs/tm4c123g-launchpad/tools/tm4c123g-launchpad.cfg"
OPENOCD_ARGS="-f ${OPENOCD_CFG} -s ${TARGET_PATH}"
if [ "X$2" = "X-d" ]; then
OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
set -x
fi
if [ ! -d ${OPENOCD_PATH} ]; then
echo "OpenOCD path does not exist: ${OPENOCD_PATH}"
exit 1
fi
if [ ! -x ${OPENOCD_PATH}/${OPENOCD_EXE} ]; then
echo "OpenOCD does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
exit 1
fi
if [ ! -f ${OPENOCD_CFG} ]; then
echo "OpenOCD config file does not exist: ${OPENOCD_CFG}"
exit 1
fi
echo "Starting OpenOCD"
cd ${OPENOCD_PATH} || { echo "Failed to CD to ${OPENOCD_PATH}"; exit 1; }
${OPENOCD_EXE} ${OPENOCD_ARGS} &
echo "OpenOCD daemon started"
ps -ef | grep openocd
echo "In GDB: target remote localhost:3333"