From ac4fd8e8340886f455add8cf92ee1c8458b8ae19 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Sun, 16 Mar 2014 14:31:22 +0200 Subject: Add ek-tm4c1294xl example projects --- boards/ek-tm4c1294xl/usb_host_msc/Makefile | 96 ++ .../ek-tm4c1294xl/usb_host_msc/ccs/.ccsimportspec | 8 + boards/ek-tm4c1294xl/usb_host_msc/ccs/.ccsproject | 10 + boards/ek-tm4c1294xl/usb_host_msc/ccs/.cproject | 193 +++ boards/ek-tm4c1294xl/usb_host_msc/ccs/.project | 80 ++ .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../usb_host_msc/ccs/Debug/usb_host_msc.bin | Bin 0 -> 29128 bytes .../usb_host_msc/ccs/Debug/usb_host_msc.out | Bin 0 -> 652476 bytes .../usb_host_msc/ccs/macros.ini_initial | 1 + .../usb_host_msc/ccs/target_config.ccxml | 13 + .../usb_host_msc/ewarm/Exe/usb_host_msc.bin | Bin 0 -> 27124 bytes .../usb_host_msc/ewarm/Exe/usb_host_msc.out | Bin 0 -> 505168 bytes .../usb_host_msc/gcc/usb_host_msc.axf | Bin 0 -> 85936 bytes .../usb_host_msc/gcc/usb_host_msc.bin | Bin 0 -> 29766 bytes boards/ek-tm4c1294xl/usb_host_msc/readme.txt | 34 + .../usb_host_msc/rvmdk/usb_host_msc.axf | Bin 0 -> 328448 bytes .../usb_host_msc/rvmdk/usb_host_msc.bin | Bin 0 -> 29876 bytes boards/ek-tm4c1294xl/usb_host_msc/startup_ccs.c | 276 ++++ boards/ek-tm4c1294xl/usb_host_msc/startup_ewarm.c | 307 ++++ boards/ek-tm4c1294xl/usb_host_msc/startup_gcc.c | 323 +++++ boards/ek-tm4c1294xl/usb_host_msc/startup_rvmdk.S | 332 +++++ boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.c | 1469 ++++++++++++++++++++ boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewd | 614 ++++++++ boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewp | 809 +++++++++++ boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.icf | 78 ++ boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ld | 57 + boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.sct | 47 + .../ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvopt | 387 ++++++ .../ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvproj | 459 ++++++ .../usb_host_msc/usb_host_msc_ccs.cmd | 70 + 30 files changed, 5666 insertions(+) create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/Makefile create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ccs/.ccsimportspec create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ccs/.ccsproject create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ccs/.cproject create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ccs/.project create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ccs/Debug/usb_host_msc.bin create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ccs/Debug/usb_host_msc.out create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ccs/macros.ini_initial create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ccs/target_config.ccxml create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ewarm/Exe/usb_host_msc.bin create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/ewarm/Exe/usb_host_msc.out create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/gcc/usb_host_msc.axf create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/gcc/usb_host_msc.bin create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/readme.txt create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/rvmdk/usb_host_msc.axf create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/rvmdk/usb_host_msc.bin create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/startup_ccs.c create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/startup_ewarm.c create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/startup_gcc.c create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/startup_rvmdk.S create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.c create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewd create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewp create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.icf create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ld create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.sct create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvopt create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvproj create mode 100644 boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc_ccs.cmd (limited to 'boards/ek-tm4c1294xl/usb_host_msc') diff --git a/boards/ek-tm4c1294xl/usb_host_msc/Makefile b/boards/ek-tm4c1294xl/usb_host_msc/Makefile new file mode 100644 index 0000000..45006c1 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/Makefile @@ -0,0 +1,96 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB host mass storage example. +# +# Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C1294NCPDT + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../third_party/fatfs/port +VPATH+=../../../../third_party/fatfs/src +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. +IPATH+=../../../../third_party + +# +# The default rule, which causes the USB host mass storage example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_host_msc.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB host mass storage example. +# +${COMPILER}/usb_host_msc.axf: ${COMPILER}/cmdline.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/fat_usbmsc.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/ff.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/pinout.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/uartstdio.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/usb_host_msc.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/ustdlib.o +${COMPILER}/usb_host_msc.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_host_msc.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_host_msc.axf: usb_host_msc.ld +SCATTERgcc_usb_host_msc=usb_host_msc.ld +ENTRY_usb_host_msc=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C129_RA0 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ccs/.ccsimportspec b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.ccsimportspec new file mode 100644 index 0000000..252e9bb --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ccs/.ccsproject b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.ccsproject new file mode 100644 index 0000000..ac3158a --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ccs/.cproject b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.cproject new file mode 100644 index 0000000..8c8bbc9 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.cproject @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ccs/.project b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.project new file mode 100644 index 0000000..4390bb4 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.project @@ -0,0 +1,80 @@ + + + usb_host_msc + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-tm4c1294xl/usb_host_msc/startup_ccs.c + + + usb_host_msc.c + 1 + SW_ROOT/examples/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.c + + + usb_host_msc_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc_ccs.cmd + + + drivers/pinout.c + 1 + SW_ROOT/examples/boards/ek-tm4c1294xl/drivers/pinout.c + + + utils/cmdline.c + 1 + SW_ROOT/utils/cmdline.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + third_party/fatfs/port/fat_usbmsc.c + 1 + SW_ROOT/third_party/fatfs/port/fat_usbmsc.c + + + third_party/fatfs/src/ff.c + 1 + SW_ROOT/third_party/fatfs/src/ff.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ccs/Debug/usb_host_msc.bin b/boards/ek-tm4c1294xl/usb_host_msc/ccs/Debug/usb_host_msc.bin new file mode 100644 index 0000000..e6fafac Binary files /dev/null and b/boards/ek-tm4c1294xl/usb_host_msc/ccs/Debug/usb_host_msc.bin differ diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ccs/Debug/usb_host_msc.out b/boards/ek-tm4c1294xl/usb_host_msc/ccs/Debug/usb_host_msc.out new file mode 100644 index 0000000..599ea6f Binary files /dev/null and b/boards/ek-tm4c1294xl/usb_host_msc/ccs/Debug/usb_host_msc.out differ diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ccs/macros.ini_initial b/boards/ek-tm4c1294xl/usb_host_msc/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ccs/target_config.ccxml b/boards/ek-tm4c1294xl/usb_host_msc/ccs/target_config.ccxml new file mode 100644 index 0000000..7a583d5 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ewarm/Exe/usb_host_msc.bin b/boards/ek-tm4c1294xl/usb_host_msc/ewarm/Exe/usb_host_msc.bin new file mode 100644 index 0000000..dad5ec8 Binary files /dev/null and b/boards/ek-tm4c1294xl/usb_host_msc/ewarm/Exe/usb_host_msc.bin differ diff --git a/boards/ek-tm4c1294xl/usb_host_msc/ewarm/Exe/usb_host_msc.out b/boards/ek-tm4c1294xl/usb_host_msc/ewarm/Exe/usb_host_msc.out new file mode 100644 index 0000000..5b0b0f5 Binary files /dev/null and b/boards/ek-tm4c1294xl/usb_host_msc/ewarm/Exe/usb_host_msc.out differ diff --git a/boards/ek-tm4c1294xl/usb_host_msc/gcc/usb_host_msc.axf b/boards/ek-tm4c1294xl/usb_host_msc/gcc/usb_host_msc.axf new file mode 100644 index 0000000..ad5e373 Binary files /dev/null and b/boards/ek-tm4c1294xl/usb_host_msc/gcc/usb_host_msc.axf differ diff --git a/boards/ek-tm4c1294xl/usb_host_msc/gcc/usb_host_msc.bin b/boards/ek-tm4c1294xl/usb_host_msc/gcc/usb_host_msc.bin new file mode 100644 index 0000000..b192259 Binary files /dev/null and b/boards/ek-tm4c1294xl/usb_host_msc/gcc/usb_host_msc.bin differ diff --git a/boards/ek-tm4c1294xl/usb_host_msc/readme.txt b/boards/ek-tm4c1294xl/usb_host_msc/readme.txt new file mode 100644 index 0000000..7d9a841 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/readme.txt @@ -0,0 +1,34 @@ +USB Mass Storage Class Host + +This example application demonstrates reading a file system from a USB mass +storage class device. It makes use of FatFs, a FAT file system driver. It +provides a simple command console via the UART for issuing commands to view +and navigate the file system on the mass storage device. + +The first UART, which is connected to the Tiva C Series virtual serial port +on the evaluation board, is configured for 115,200 bits per second, and +8-N-1 mode. When the program is started a message will be printed to the +terminal. Type ``help'' for command help. + +For additional details about FatFs, see the following site: +http://elm-chan.org/fsw/ff/00index_e.html + +------------------------------------------------------------------------------- + +Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. diff --git a/boards/ek-tm4c1294xl/usb_host_msc/rvmdk/usb_host_msc.axf b/boards/ek-tm4c1294xl/usb_host_msc/rvmdk/usb_host_msc.axf new file mode 100644 index 0000000..7872c0c Binary files /dev/null and b/boards/ek-tm4c1294xl/usb_host_msc/rvmdk/usb_host_msc.axf differ diff --git a/boards/ek-tm4c1294xl/usb_host_msc/rvmdk/usb_host_msc.bin b/boards/ek-tm4c1294xl/usb_host_msc/rvmdk/usb_host_msc.bin new file mode 100644 index 0000000..4e6a371 Binary files /dev/null and b/boards/ek-tm4c1294xl/usb_host_msc/rvmdk/usb_host_msc.bin differ diff --git a/boards/ek-tm4c1294xl/usb_host_msc/startup_ccs.c b/boards/ek-tm4c1294xl/usb_host_msc/startup_ccs.c new file mode 100644 index 0000000..b673a9e --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/startup_ccs.c @@ -0,0 +1,276 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + IntDefaultHandler, // Ethernet + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + IntDefaultHandler, // External Bus Interface 0 + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + 0, // Reserved + IntDefaultHandler, // Tamper + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // SHA/MD5 0 + IntDefaultHandler, // AES 0 + IntDefaultHandler, // DES3DES 0 + IntDefaultHandler, // LCD Controller 0 + IntDefaultHandler, // Timer 6 subtimer A + IntDefaultHandler, // Timer 6 subtimer B + IntDefaultHandler, // Timer 7 subtimer A + IntDefaultHandler, // Timer 7 subtimer B + IntDefaultHandler, // I2C6 Master and Slave + IntDefaultHandler, // I2C7 Master and Slave + IntDefaultHandler, // HIM Scan Matrix Keyboard 0 + IntDefaultHandler, // One Wire 0 + IntDefaultHandler, // HIM PS/2 0 + IntDefaultHandler, // HIM LED Sequencer 0 + IntDefaultHandler, // HIM Consumer IR 0 + IntDefaultHandler, // I2C8 Master and Slave + IntDefaultHandler, // I2C9 Master and Slave + IntDefaultHandler // GPIO Port T +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-tm4c1294xl/usb_host_msc/startup_ewarm.c b/boards/ek-tm4c1294xl/usb_host_msc/startup_ewarm.c new file mode 100644 index 0000000..f764d14 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/startup_ewarm.c @@ -0,0 +1,307 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[512] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + IntDefaultHandler, // Ethernet + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + IntDefaultHandler, // External Bus Interface 0 + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + 0, // Reserved + IntDefaultHandler, // Tamper + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // SHA/MD5 0 + IntDefaultHandler, // AES 0 + IntDefaultHandler, // DES3DES 0 + IntDefaultHandler, // LCD Controller 0 + IntDefaultHandler, // Timer 6 subtimer A + IntDefaultHandler, // Timer 6 subtimer B + IntDefaultHandler, // Timer 7 subtimer A + IntDefaultHandler, // Timer 7 subtimer B + IntDefaultHandler, // I2C6 Master and Slave + IntDefaultHandler, // I2C7 Master and Slave + IntDefaultHandler, // HIM Scan Matrix Keyboard 0 + IntDefaultHandler, // One Wire 0 + IntDefaultHandler, // HIM PS/2 0 + IntDefaultHandler, // HIM LED Sequencer 0 + IntDefaultHandler, // HIM Consumer IR 0 + IntDefaultHandler, // I2C8 Master and Slave + IntDefaultHandler, // I2C9 Master and Slave + IntDefaultHandler // GPIO Port T +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-tm4c1294xl/usb_host_msc/startup_gcc.c b/boards/ek-tm4c1294xl/usb_host_msc/startup_gcc.c new file mode 100644 index 0000000..139dc63 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/startup_gcc.c @@ -0,0 +1,323 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[512]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + IntDefaultHandler, // Ethernet + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + IntDefaultHandler, // External Bus Interface 0 + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + 0, // Reserved + IntDefaultHandler, // Tamper + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // SHA/MD5 0 + IntDefaultHandler, // AES 0 + IntDefaultHandler, // DES3DES 0 + IntDefaultHandler, // LCD Controller 0 + IntDefaultHandler, // Timer 6 subtimer A + IntDefaultHandler, // Timer 6 subtimer B + IntDefaultHandler, // Timer 7 subtimer A + IntDefaultHandler, // Timer 7 subtimer B + IntDefaultHandler, // I2C6 Master and Slave + IntDefaultHandler, // I2C7 Master and Slave + IntDefaultHandler, // HIM Scan Matrix Keyboard 0 + IntDefaultHandler, // One Wire 0 + IntDefaultHandler, // HIM PS/2 0 + IntDefaultHandler, // HIM LED Sequencer 0 + IntDefaultHandler, // HIM Consumer IR 0 + IntDefaultHandler, // I2C8 Master and Slave + IntDefaultHandler, // I2C9 Master and Slave + IntDefaultHandler // GPIO Port T +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-tm4c1294xl/usb_host_msc/startup_rvmdk.S b/boards/ek-tm4c1294xl/usb_host_msc/startup_rvmdk.S new file mode 100644 index 0000000..2e78fd4 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/startup_rvmdk.S @@ -0,0 +1,332 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000800 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickIntHandler + EXTERN USB0OTGModeIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickIntHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD IntDefaultHandler ; Ethernet + DCD IntDefaultHandler ; Hibernate + DCD USB0OTGModeIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD IntDefaultHandler ; External Bus Interface 0 + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD 0 ; Reserved + DCD IntDefaultHandler ; Tamper + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; SHA/MD5 0 + DCD IntDefaultHandler ; AES 0 + DCD IntDefaultHandler ; DES3DES 0 + DCD IntDefaultHandler ; LCD Controller 0 + DCD IntDefaultHandler ; Timer 6 subtimer A + DCD IntDefaultHandler ; Timer 6 subtimer B + DCD IntDefaultHandler ; Timer 7 subtimer A + DCD IntDefaultHandler ; Timer 7 subtimer B + DCD IntDefaultHandler ; I2C6 Master and Slave + DCD IntDefaultHandler ; I2C7 Master and Slave + DCD IntDefaultHandler ; HIM Scan Matrix Keyboard 0 + DCD IntDefaultHandler ; One Wire 0 + DCD IntDefaultHandler ; HIM PS/2 0 + DCD IntDefaultHandler ; HIM LED Sequencer 0 + DCD IntDefaultHandler ; HIM Consumer IR 0 + DCD IntDefaultHandler ; I2C8 Master and Slave + DCD IntDefaultHandler ; I2C9 Master and Slave + DCD IntDefaultHandler ; GPIO Port T + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.c b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.c new file mode 100644 index 0000000..14bdc85 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.c @@ -0,0 +1,1469 @@ +//***************************************************************************** +// +// usb_host_msc.c - USB mass storage host application. +// +// Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "driverlib/gpio.h" +#include "driverlib/pin_map.h" +#include "driverlib/rom.h" +#include "driverlib/rom_map.h" +#include "driverlib/sysctl.h" +#include "driverlib/uart.h" +#include "driverlib/udma.h" +#include "usblib/usblib.h" +#include "usblib/usbmsc.h" +#include "usblib/host/usbhost.h" +#include "usblib/host/usbhmsc.h" +#include "utils/cmdline.h" +#include "utils/uartstdio.h" +#include "fatfs/src/ff.h" +#include "drivers/pinout.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB Mass Storage Class Host (usb_host_msc)

+//! +//! This example application demonstrates reading a file system from a USB mass +//! storage class device. It makes use of FatFs, a FAT file system driver. It +//! provides a simple command console via the UART for issuing commands to view +//! and navigate the file system on the mass storage device. +//! +//! The first UART, which is connected to the Tiva C Series virtual serial port +//! on the evaluation board, is configured for 115,200 bits per second, and +//! 8-N-1 mode. When the program is started a message will be printed to the +//! terminal. Type ``help'' for command help. +//! +//! For additional details about FatFs, see the following site: +//! http://elm-chan.org/fsw/ff/00index_e.html +// +//***************************************************************************** + +//***************************************************************************** +// +// The number of SysTick ticks per second. +// +//***************************************************************************** +#define TICKS_PER_SECOND 100 +#define MS_PER_SYSTICK (1000 / TICKS_PER_SECOND) + +//***************************************************************************** +// +// Our running system tick counter and a global used to determine the time +// elapsed since last call to GetTickms(). +// +//***************************************************************************** +uint32_t g_ui32SysTickCount; +uint32_t g_ui32LastTick; + +//***************************************************************************** +// +// Defines the size of the buffers that hold the path, or temporary data from +// the memory card. There are two buffers allocated of this size. The buffer +// size must be large enough to hold the longest expected full path name, +// including the file name, and a trailing null character. +// +//***************************************************************************** +#define PATH_BUF_SIZE 80 + +//***************************************************************************** +// +// Defines the size of the buffer that holds the command line. +// +//***************************************************************************** +#define CMD_BUF_SIZE 64 + +//***************************************************************************** +// +// Defines the number of times to call to check if the attached device is +// ready. +// +//***************************************************************************** +#define USBMSC_DRIVE_RETRY 4 + +//***************************************************************************** +// +// This buffer holds the full path to the current working directory. Initially +// it is root ("/"). +// +//***************************************************************************** +static char g_cCwdBuf[PATH_BUF_SIZE] = "/"; + +//***************************************************************************** +// +// A temporary data buffer used when manipulating file paths, or reading data +// from the memory card. +// +//***************************************************************************** +static char g_cTmpBuf[PATH_BUF_SIZE]; + +//***************************************************************************** +// +// The buffer that holds the command line. +// +//***************************************************************************** +static char g_cCmdBuf[CMD_BUF_SIZE]; + +//***************************************************************************** +// +// Current FAT fs state. +// +//***************************************************************************** +static FATFS g_sFatFs; +static DIR g_sDirObject; +static FILINFO g_sFileInfo; +static FIL g_sFileObject; + +//***************************************************************************** +// +// A structure that holds a mapping between an FRESULT numerical code, +// and a string representation. FRESULT codes are returned from the FatFs +// FAT file system driver. +// +//***************************************************************************** +typedef struct +{ + FRESULT fresult; + char *pcResultStr; +} +tFresultString; + +//***************************************************************************** +// +// A macro to make it easy to add result codes to the table. +// +//***************************************************************************** +#define FRESULT_ENTRY(f) { (f), (#f) } + +//***************************************************************************** +// +// A table that holds a mapping between the numerical FRESULT code and +// it's name as a string. This is used for looking up error codes for +// printing to the console. +// +//***************************************************************************** +tFresultString g_sFresultStrings[] = +{ + FRESULT_ENTRY(FR_OK), + FRESULT_ENTRY(FR_DISK_ERR), + FRESULT_ENTRY(FR_INT_ERR), + FRESULT_ENTRY(FR_NOT_READY), + FRESULT_ENTRY(FR_NO_FILE), + FRESULT_ENTRY(FR_NO_PATH), + FRESULT_ENTRY(FR_INVALID_NAME), + FRESULT_ENTRY(FR_DENIED), + FRESULT_ENTRY(FR_EXIST), + FRESULT_ENTRY(FR_INVALID_OBJECT), + FRESULT_ENTRY(FR_WRITE_PROTECTED), + FRESULT_ENTRY(FR_INVALID_DRIVE), + FRESULT_ENTRY(FR_NOT_ENABLED), + FRESULT_ENTRY(FR_NO_FILESYSTEM), + FRESULT_ENTRY(FR_MKFS_ABORTED), + FRESULT_ENTRY(FR_TIMEOUT), + FRESULT_ENTRY(FR_LOCKED), + FRESULT_ENTRY(FR_NOT_ENOUGH_CORE), + FRESULT_ENTRY(FR_TOO_MANY_OPEN_FILES), + FRESULT_ENTRY(FR_INVALID_PARAMETER) +}; + +//***************************************************************************** +// +// A macro that holds the number of result codes. +// +//***************************************************************************** +#define NUM_FRESULT_CODES (sizeof(g_sFresultStrings) / sizeof(tFresultString)) + +//***************************************************************************** +// +// The size of the host controller's memory pool in bytes. +// +//***************************************************************************** +#define HCD_MEMORY_SIZE 128 + +//***************************************************************************** +// +// The memory pool to provide to the Host controller driver. +// +//***************************************************************************** +uint8_t g_pHCDPool[HCD_MEMORY_SIZE]; + +//***************************************************************************** +// +// The instance data for the MSC driver. +// +//***************************************************************************** +tUSBHMSCInstance *g_psMSCInstance = 0; + +//***************************************************************************** +// +// Declare the USB Events driver interface. +// +//***************************************************************************** +DECLARE_EVENT_DRIVER(g_sUSBEventDriver, 0, 0, USBHCDEvents); + +//***************************************************************************** +// +// The global that holds all of the host drivers in use in the application. +// In this case, only the MSC class is loaded. +// +//***************************************************************************** +static tUSBHostClassDriver const * const g_ppHostClassDrivers[] = +{ + &g_sUSBHostMSCClassDriver, + &g_sUSBEventDriver +}; + +//***************************************************************************** +// +// Hold the current state for the application. +// +//***************************************************************************** +typedef enum +{ + // + // No device is present. + // + STATE_NO_DEVICE, + + // + // Mass storage device is being enumerated. + // + STATE_DEVICE_ENUM, + + // + // Mass storage device is ready. + // + STATE_DEVICE_READY, + + // + // An unsupported device has been attached. + // + STATE_UNKNOWN_DEVICE, + + // + // A mass storage device was connected but failed to ever report ready. + // + STATE_TIMEOUT_DEVICE, + + // + // A power fault has occurred. + // + STATE_POWER_FAULT +} +tState; + +volatile tState g_eState; +volatile tState g_eUIState; + +//***************************************************************************** +// +// This global holds the number of class drivers in the g_ppHostClassDrivers +// list. +// +//***************************************************************************** +static const uint32_t g_ui32NumHostClassDrivers = + sizeof(g_ppHostClassDrivers) / sizeof(tUSBHostClassDriver *); + +//***************************************************************************** +// +// The control table used by the uDMA controller. This table must be aligned +// to a 1024 byte boundary. In this application uDMA is only used for USB, +// so only the first 6 channels are needed. +// +//***************************************************************************** +#if defined(ewarm) +#pragma data_alignment=1024 +tDMAControlTable g_sDMAControlTable[6]; +#elif defined(ccs) +#pragma DATA_ALIGN(g_sDMAControlTable, 1024) +tDMAControlTable g_sDMAControlTable[6]; +#else +tDMAControlTable g_sDMAControlTable[6] __attribute__ ((aligned(1024))); +#endif + +//***************************************************************************** +// +// The current USB operating mode - Host, Device or unknown. +// +//***************************************************************************** +tUSBMode g_eCurrentUSBMode; + +//***************************************************************************** +// +// The class of the unknown device. +// +//***************************************************************************** +uint32_t g_ui32UnknownClass; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// This is the handler for this SysTick interrupt. +// +//***************************************************************************** +void +SysTickIntHandler(void) +{ + // + // Update our tick counter. + // + g_ui32SysTickCount++; +} + +//***************************************************************************** +// +// This function returns the number of ticks since the last time this function +// was called. +// +//***************************************************************************** +uint32_t +GetTickms(void) +{ + uint32_t ui32RetVal; + uint32_t ui32Saved; + + ui32RetVal = g_ui32SysTickCount; + ui32Saved = ui32RetVal; + + if(ui32Saved > g_ui32LastTick) + { + ui32RetVal = ui32Saved - g_ui32LastTick; + } + else + { + ui32RetVal = g_ui32LastTick - ui32Saved; + } + + // + // This could miss a few milliseconds but the timings here are on a + // much larger scale. + // + g_ui32LastTick = ui32Saved; + + // + // Return the number of milliseconds since the last time this was called. + // + return(ui32RetVal * MS_PER_SYSTICK); +} + +//***************************************************************************** +// +// This function returns a string representation of an error code that was +// returned from a function call to FatFs. It can be used for printing human +// readable error messages. +// +//***************************************************************************** +const char * +StringFromFresult(FRESULT fresult) +{ + uint32_t ui32Idx; + + // + // Enter a loop to search the error code table for a matching error code. + // + for(ui32Idx = 0; ui32Idx < NUM_FRESULT_CODES; ui32Idx++) + { + // + // If a match is found, then return the string name of the error code. + // + if(g_sFresultStrings[ui32Idx].fresult == fresult) + { + return(g_sFresultStrings[ui32Idx].pcResultStr); + } + } + + // + // At this point no matching code was found, so return a string indicating + // unknown error. + // + return("UNKNOWN ERROR CODE"); +} + +//***************************************************************************** +// +// This function implements the "ls" command. It opens the current directory +// and enumerates through the contents, and prints a line for each item it +// finds. It shows details such as file attributes, time and date, and the +// file size, along with the name. It shows a summary of file sizes at the end +// along with free space. +// +//***************************************************************************** +int +Cmd_ls(int argc, char *argv[]) +{ + uint32_t ui32TotalSize; + uint32_t ui32FileCount; + uint32_t ui32DirCount; + FRESULT fresult; + FATFS *pFatFs; + + // + // Do not attempt to do anything if there is not a drive attached. + // + if(g_eState != STATE_DEVICE_READY) + { + return(FR_NOT_READY); + } + + // + // Open the current directory for access. + // + fresult = f_opendir(&g_sDirObject, g_cCwdBuf); + + // + // Check for error and return if there is a problem. + // + if(fresult != FR_OK) + { + return(fresult); + } + + ui32TotalSize = 0; + ui32FileCount = 0; + ui32DirCount = 0; + + // + // Enter loop to enumerate through all directory entries. + // + while(1) + { + // + // Read an entry from the directory. + // + fresult = f_readdir(&g_sDirObject, &g_sFileInfo); + + // + // Check for error and return if there is a problem. + // + if(fresult != FR_OK) + { + return(fresult); + } + + // + // If the file name is blank, then this is the end of the listing. + // + if(!g_sFileInfo.fname[0]) + { + break; + } + + // + // If the attribute is directory, then increment the directory count. + // + if(g_sFileInfo.fattrib & AM_DIR) + { + ui32DirCount++; + } + + // + // Otherwise, it is a file. Increment the file count, and add in the + // file size to the total. + // + else + { + ui32FileCount++; + ui32TotalSize += g_sFileInfo.fsize; + } + + // + // Print the entry information on a single line with formatting to show + // the attributes, date, time, size, and name. + // + UARTprintf("%c%c%c%c%c %u/%02u/%02u %02u:%02u %9u %s\n", + (g_sFileInfo.fattrib & AM_DIR) ? 'D' : '-', + (g_sFileInfo.fattrib & AM_RDO) ? 'R' : '-', + (g_sFileInfo.fattrib & AM_HID) ? 'H' : '-', + (g_sFileInfo.fattrib & AM_SYS) ? 'S' : '-', + (g_sFileInfo.fattrib & AM_ARC) ? 'A' : '-', + (g_sFileInfo.fdate >> 9) + 1980, + (g_sFileInfo.fdate >> 5) & 15, + g_sFileInfo.fdate & 31, + (g_sFileInfo.ftime >> 11), + (g_sFileInfo.ftime >> 5) & 63, + g_sFileInfo.fsize, + g_sFileInfo.fname); + } + + // + // Print summary lines showing the file, dir, and size totals. + // + UARTprintf("\n%4u File(s),%10u bytes total\n%4u Dir(s)", + ui32FileCount, ui32TotalSize, ui32DirCount); + + // + // Get the free space. + // + fresult = f_getfree("/", &ui32TotalSize, &pFatFs); + + // + // Check for error and return if there is a problem. + // + if(fresult != FR_OK) + { + return(fresult); + } + + // + // Display the amount of free space that was calculated. + // + UARTprintf(", %10uK bytes free\n", ui32TotalSize * pFatFs->csize / 2); + + // + // Made it to here, return with no errors. + // + return(0); +} + +//***************************************************************************** +// +// This function implements the "cd" command. It takes an argument that +// specifies the directory to make the current working directory. Path +// separators must use a forward slash "/". The argument to cd can be one of +// the following: +// +// * root ("/") +// * a fully specified path ("/my/path/to/mydir") +// * a single directory name that is in the current directory ("mydir") +// * parent directory ("..") +// +// It does not understand relative paths, so don't try something like this: +// ("../my/new/path") +// +// Once the new directory is specified, it attempts to open the directory to +// make sure it exists. If the new path is opened successfully, then the +// current working directory (cwd) is changed to the new path. +// +//***************************************************************************** +int +Cmd_cd(int argc, char *argv[]) +{ + uint32_t ui32Idx; + FRESULT fresult; + + // + // Do not attempt to do anything if there is not a drive attached. + // + if(g_eState != STATE_DEVICE_READY) + { + return(FR_NOT_READY); + } + + // + // Copy the current working path into a temporary buffer so it can be + // manipulated. + // + strcpy(g_cTmpBuf, g_cCwdBuf); + + // + // If the first character is /, then this is a fully specified path, and it + // should just be used as-is. + // + if(argv[1][0] == '/') + { + // + // Make sure the new path is not bigger than the cwd buffer. + // + if(strlen(argv[1]) + 1 > sizeof(g_cCwdBuf)) + { + UARTprintf("Resulting path name is too long\n"); + return(0); + } + + // + // If the new path name (in argv[1]) is not too long, then copy it + // into the temporary buffer so it can be checked. + // + else + { + strncpy(g_cTmpBuf, argv[1], sizeof(g_cTmpBuf)); + } + } + + // + // If the argument is .. then attempt to remove the lowest level on the + // CWD. + // + else if(!strcmp(argv[1], "..")) + { + // + // Get the index to the last character in the current path. + // + ui32Idx = strlen(g_cTmpBuf) - 1; + + // + // Back up from the end of the path name until a separator (/) is + // found, or until we bump up to the start of the path. + // + while((g_cTmpBuf[ui32Idx] != '/') && (ui32Idx > 1)) + { + // + // Back up one character. + // + ui32Idx--; + } + + // + // Now we are either at the lowest level separator in the current path, + // or at the beginning of the string (root). So set the new end of + // string here, effectively removing that last part of the path. + // + g_cTmpBuf[ui32Idx] = 0; + } + + // + // Otherwise this is just a normal path name from the current directory, + // and it needs to be appended to the current path. + // + else + { + // + // Test to make sure that when the new additional path is added on to + // the current path, there is room in the buffer for the full new path. + // It needs to include a new separator, and a trailing null character. + // + if(strlen(g_cTmpBuf) + strlen(argv[1]) + 1 + 1 > sizeof(g_cCwdBuf)) + { + UARTprintf("Resulting path name is too long\n"); + return(0); + } + + // + // The new path is okay, so add the separator and then append the new + // directory to the path. + // + else + { + // + // If not already at the root level, then append a / + // + if(strcmp(g_cTmpBuf, "/")) + { + strcat(g_cTmpBuf, "/"); + } + + // + // Append the new directory to the path. + // + strcat(g_cTmpBuf, argv[1]); + } + } + + // + // At this point, a candidate new directory path is in chTmpBuf. Try to + // open it to make sure it is valid. + // + fresult = f_opendir(&g_sDirObject, g_cTmpBuf); + + // + // If it can't be opened, then it is a bad path. Inform user and return. + // + if(fresult != FR_OK) + { + UARTprintf("cd: %s\n", g_cTmpBuf); + return(fresult); + } + + // + // Otherwise, it is a valid new path, so copy it into the CWD. + // + else + { + strncpy(g_cCwdBuf, g_cTmpBuf, sizeof(g_cCwdBuf)); + } + + // + // Return success. + // + return(0); +} + +//***************************************************************************** +// +// This function implements the "pwd" command. It simply prints the current +// working directory. +// +//***************************************************************************** +int +Cmd_pwd(int argc, char *argv[]) +{ + // + // Do not attempt to do anything if there is not a drive attached. + // + if(g_eState != STATE_DEVICE_READY) + { + return(FR_NOT_READY); + } + + // + // Print the CWD to the console. + // + UARTprintf("%s\n", g_cCwdBuf); + + // + // Return success. + // + return(0); +} + +//***************************************************************************** +// +// This function implements the "cat" command. It reads the contents of a file +// and prints it to the console. This should only be used on text files. If +// it is used on a binary file, then a bunch of garbage is likely to printed on +// the console. +// +//***************************************************************************** +int +Cmd_cat(int argc, char *argv[]) +{ + FRESULT fresult; + uint32_t ui32BytesRead; + + // + // Do not attempt to do anything if there is not a drive attached. + // + if(g_eState != STATE_DEVICE_READY) + { + return(FR_NOT_READY); + } + + // + // First, check to make sure that the current path (CWD), plus the file + // name, plus a separator and trailing null, will all fit in the temporary + // buffer that will be used to hold the file name. The file name must be + // fully specified, with path, to FatFs. + // + if(strlen(g_cCwdBuf) + strlen(argv[1]) + 1 + 1 > sizeof(g_cTmpBuf)) + { + UARTprintf("Resulting path name is too long\n"); + return(0); + } + + // + // Copy the current path to the temporary buffer so it can be manipulated. + // + strcpy(g_cTmpBuf, g_cCwdBuf); + + // + // If not already at the root level, then append a separator. + // + if(strcmp("/", g_cCwdBuf)) + { + strcat(g_cTmpBuf, "/"); + } + + // + // Now finally, append the file name to result in a fully specified file. + // + strcat(g_cTmpBuf, argv[1]); + + // + // Open the file for reading. + // + fresult = f_open(&g_sFileObject, g_cTmpBuf, FA_READ); + + // + // If there was some problem opening the file, then return an error. + // + if(fresult != FR_OK) + { + return(fresult); + } + + // + // Enter a loop to repeatedly read data from the file and display it, until + // the end of the file is reached. + // + do + { + // + // Read a block of data from the file. Read as much as can fit in the + // temporary buffer, including a space for the trailing null. + // + fresult = f_read(&g_sFileObject, g_cTmpBuf, sizeof(g_cTmpBuf) - 1, + (UINT *)&ui32BytesRead); + + // + // If there was an error reading, then print a newline and return the + // error to the user. + // + if(fresult != FR_OK) + { + UARTprintf("\n"); + return(fresult); + } + + // + // Null terminate the last block that was read to make it a null + // terminated string that can be used with printf. + // + g_cTmpBuf[ui32BytesRead] = 0; + + // + // Print the last chunk of the file that was received. + // + UARTprintf("%s", g_cTmpBuf); + + // + // Continue reading until less than the full number of bytes are read. + // That means the end of the buffer was reached. + // + } + while(ui32BytesRead == sizeof(g_cTmpBuf) - 1); + + // + // Return success. + // + return(0); +} + +//***************************************************************************** +// +// This function implements the "help" command. It prints a simple list of the +// available commands with a brief description. +// +//***************************************************************************** +int +Cmd_help(int argc, char *argv[]) +{ + tCmdLineEntry *pEntry; + + // + // Print some header text. + // + UARTprintf("\nAvailable commands\n"); + UARTprintf("------------------\n"); + + // + // Point at the beginning of the command table. + // + pEntry = &g_psCmdTable[0]; + + // + // Enter a loop to read each entry from the command table. The end of the + // table has been reached when the command name is NULL. + // + while(pEntry->pcCmd) + { + // + // Print the command name and the brief description. + // + UARTprintf("%s%s\n", pEntry->pcCmd, pEntry->pcHelp); + + // + // Advance to the next entry in the table. + // + pEntry++; + } + + // + // Return success. + // + return(0); +} + +//***************************************************************************** +// +// This is the table that holds the command names, implementing functions, and +// brief description. +// +//***************************************************************************** +tCmdLineEntry g_psCmdTable[] = +{ + { "help", Cmd_help, " : Display list of commands" }, + { "h", Cmd_help, " : alias for help" }, + { "?", Cmd_help, " : alias for help" }, + { "ls", Cmd_ls, " : Display list of files" }, + { "chdir", Cmd_cd, ": Change directory" }, + { "cd", Cmd_cd, " : alias for chdir" }, + { "pwd", Cmd_pwd, " : Show current working directory" }, + { "cat", Cmd_cat, " : Show contents of a text file" }, + { 0, 0, 0 } +}; + +//***************************************************************************** +// +// This is the callback from the MSC driver. +// +// \param ui32Instance is the driver instance which is needed when +// communicating with the driver. +// \param ui32Event is one of the events defined by the driver. +// \param pvData is a pointer to data passed into the initial call to register +// the callback. +// +// This function handles callback events from the MSC driver. The only events +// currently handled are the MSC_EVENT_OPEN and MSC_EVENT_CLOSE. This allows +// the main routine to know when an MSC device has been detected and +// enumerated and when an MSC device has been removed from the system. +// +// \return Returns \e true on success or \e false on failure. +// +//***************************************************************************** +void +MSCCallback(tUSBHMSCInstance *ps32Instance, uint32_t ui32Event, void *pvData) +{ + // + // Determine the event. + // + switch(ui32Event) + { + // + // Called when the device driver has successfully enumerated an MSC + // device. + // + case MSC_EVENT_OPEN: + { + // + // Proceed to the enumeration state. + // + g_eState = STATE_DEVICE_ENUM; + break; + } + + // + // Called when the device driver has been unloaded due to error or + // the device is no longer present. + // + case MSC_EVENT_CLOSE: + { + // + // Go back to the "no device" state and wait for a new connection. + // + g_eState = STATE_NO_DEVICE; + + break; + } + + default: + { + break; + } + } +} + +//***************************************************************************** +// +// This is the generic callback from host stack. +// +// \param pvData is actually a pointer to a tEventInfo structure. +// +// This function will be called to inform the application when a USB event has +// occurred that is outside those related to the mass storage device. At this +// point this is used to detect unsupported devices being inserted and removed. +// It is also used to inform the application when a power fault has occurred. +// This function is required when the g_USBGenericEventDriver is included in +// the host controller driver array that is passed in to the +// USBHCDRegisterDrivers() function. +// +// \return None. +// +//***************************************************************************** +void +USBHCDEvents(void *pvData) +{ + tEventInfo *pEventInfo; + + // + // Cast this pointer to its actual type. + // + pEventInfo = (tEventInfo *)pvData; + + switch(pEventInfo->ui32Event) + { + // + // Unknown device detected. + // + case USB_EVENT_UNKNOWN_CONNECTED: + { + // + // Save the unknown class. + // + g_ui32UnknownClass = pEventInfo->ui32Instance; + + // + // An unknown device was detected. + // + g_eState = STATE_UNKNOWN_DEVICE; + + break; + } + + // + // Keyboard has been unplugged. + // + case USB_EVENT_DISCONNECTED: + { + // + // Unknown device has been removed. + // + g_eState = STATE_NO_DEVICE; + + break; + } + + case USB_EVENT_POWER_FAULT: + { + // + // No power means no device is present. + // + g_eState = STATE_POWER_FAULT; + + break; + } + + default: + { + break; + } + } +} + +//***************************************************************************** +// +// This function reads a line of text from the UART console. The USB host main +// function is called throughout this process to keep USB alive and well. +// +//***************************************************************************** +void +ReadLine(void) +{ + uint32_t ui32Idx, ui32Prompt; + uint8_t ui8Char; + tState eStateCopy; + uint32_t ui32DriveTimeout; + + // + // Start reading at the beginning of the command buffer and print a prompt. + // + g_cCmdBuf[0] = '\0'; + ui32Idx = 0; + ui32Prompt = 1; + + // + // Initialize the drive timeout. + // + ui32DriveTimeout = USBMSC_DRIVE_RETRY; + + // + // Loop forever. This loop will be explicitly broken out of when the line + // has been fully read. + // + while(1) + { + // + // See if a mass storage device has been enumerated. + // + if(g_eState == STATE_DEVICE_ENUM) + { + // + // Take it easy on the Mass storage device if it is slow to + // start up after connecting. + // + if(USBHMSCDriveReady(g_psMSCInstance) != 0) + { + // + // Wait about 500ms before attempting to check if the + // device is ready again. + // + SysCtlDelay(SysCtlClockGet()/(3*2)); + + // + // Decrement the retry count. + // + ui32DriveTimeout--; + + // + // If the timeout is hit then go to the + // STATE_TIMEOUT_DEVICE state. + // + if(ui32DriveTimeout == 0) + { + g_eState = STATE_TIMEOUT_DEVICE; + } + + break; + } + + // + // Reset the working directory to the root. + // + g_cCwdBuf[0] = '/'; + g_cCwdBuf[1] = '\0'; + + // + // Attempt to open the directory. Some drives take longer to + // start up than others, and this may fail (even though the USB + // device has enumerated) if it is still initializing. + // + f_mount(0, &g_sFatFs); + if(f_opendir(&g_sDirObject, g_cCwdBuf) == FR_OK) + { + // + // The drive is fully ready, so move to that state. + // + g_eState = STATE_DEVICE_READY; + } + } + + // + // See if the state has changed. We make a copy of g_eUIState to + // prevent a compiler warning about undefined order of volatile + // accesses. + // + eStateCopy = g_eUIState; + if(g_eState != eStateCopy) + { + // + // Determine the new state. + // + switch(g_eState) + { + // + // A previously connected device has been disconnected. + // + case STATE_NO_DEVICE: + { + if(g_eUIState == STATE_UNKNOWN_DEVICE) + { + UARTprintf("\nUnknown device disconnected.\n"); + } + else + { + UARTprintf("\nMass storage device disconnected.\n"); + } + ui32Prompt = 1; + break; + } + + // + // A mass storage device is being enumerated. + // + case STATE_DEVICE_ENUM: + { + break; + } + + // + // A mass storage device has been enumerated and initialized. + // + case STATE_DEVICE_READY: + { + UARTprintf("\nMass storage device connected.\n"); + ui32Prompt = 1; + break; + } + + // + // An unknown device has been connected. + // + case STATE_UNKNOWN_DEVICE: + { + UARTprintf("Unknown Device Class (0x%02x) Connected.\n", + g_ui32UnknownClass); + ui32Prompt = 1; + break; + } + + // + // The connected mass storage device is not reporting ready. + // + case STATE_TIMEOUT_DEVICE: + { + // + // If this is the first time in this state then print a + // message. + // + UARTprintf("Device Timeout.\n"); + ui32Prompt = 1; + + break; + } + + // + // A power fault has occurred. + // + case STATE_POWER_FAULT: + { + UARTprintf("\nPower fault.\n"); + ui32Prompt = 1; + break; + } + } + + // + // Save the current state. + // + g_eUIState = g_eState; + } + + // + // Print a prompt if necessary. + // + if(ui32Prompt) + { + // + // Print the prompt based on the current state. + // + if(g_eState == STATE_DEVICE_READY) + { + UARTprintf("%s> %s", g_cCwdBuf, g_cCmdBuf); + } + else if(g_eState == STATE_UNKNOWN_DEVICE) + { + UARTprintf("UNKNOWN> %s", g_cCmdBuf); + } + else + { + UARTprintf("NODEV> %s", g_cCmdBuf); + } + + // + // The prompt no longer needs to be printed. + // + ui32Prompt = 0; + } + + // + // Loop while there are characters that have been received from the + // UART. + // + while(ROM_UARTCharsAvail(UART0_BASE)) + { + // + // Read the next character from the UART. + // + ui8Char = UARTgetc(); + + // + // See if this character is a backspace and there is at least one + // character in the input line. + // + if((ui8Char == '\b') && (ui32Idx != 0)) + { + // + // Erase the lsat character from the input line. + // + UARTprintf("\b \b"); + ui32Idx--; + g_cCmdBuf[ui32Idx] = '\0'; + } + + // + // See if this character is a newline. + // + else if((ui8Char == '\r') || (ui8Char == '\n')) + { + // + // Return to the caller. + // + UARTprintf("\n"); + return; + } + + // + // See if this character is an escape or Ctrl-U. + // + else if((ui8Char == 0x1b) || (ui8Char == 0x15)) + { + // + // Erase all characters in the input buffer. + // + while(ui32Idx) + { + UARTprintf("\b \b"); + ui32Idx--; + } + g_cCmdBuf[0] = '\0'; + } + + // + // See if this is a printable ASCII character. + // + else if((ui8Char >= ' ') && (ui8Char <= '~') && + (ui32Idx < (sizeof(g_cCmdBuf) - 1))) + { + // + // Add this character to the input buffer. + // + g_cCmdBuf[ui32Idx++] = ui8Char; + g_cCmdBuf[ui32Idx] = '\0'; + UARTprintf("%c", ui8Char); + } + } + + // + // Tell the OTG state machine how much time has passed in + // milliseconds since the last call. + // + USBOTGMain(GetTickms()); + } +} + +//***************************************************************************** +// +// This is the main loop that runs the application. +// +//***************************************************************************** +int +main(void) +{ + int iStatus; + uint32_t ui32SysClock; + + // + // Initially wait for device connection. + // + g_eState = STATE_NO_DEVICE; + g_eUIState = STATE_NO_DEVICE; + + // + // Run from the PLL at 120 MHz. + // + ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | + SYSCTL_OSC_MAIN | + SYSCTL_USE_PLL | + SYSCTL_CFG_VCO_480), 120000000); + + // + // Configure the device pins. + // + PinoutSet(false, true); + + // + // Enable the UART and print a brief message. + // + UARTStdioConfig(0, 115200, ui32SysClock); + UARTprintf("\033[2J\033[H"); + UARTprintf("USB Mass Storage Host program\n"); + UARTprintf("Type \'help\' for help.\n\n"); + + // + // Configure SysTick for a 100Hz interrupt. + // + ROM_SysTickPeriodSet(ui32SysClock / TICKS_PER_SECOND); + ROM_SysTickEnable(); + ROM_SysTickIntEnable(); + + // + // Enable the uDMA controller and set up the control table base. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); + ROM_uDMAEnable(); + ROM_uDMAControlBaseSet(g_sDMAControlTable); + + // + // Initialize the USB stack mode and pass in a mode callback. + // + USBStackModeSet(0, eUSBModeHost, 0); + + // + // Register the host class drivers. + // + USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ui32NumHostClassDrivers); + + // + // Open an instance of the mass storage class driver. + // + g_psMSCInstance = USBHMSCDriveOpen(0, MSCCallback); + + // + // Initialize the power configuration. This sets the power enable signal + // to be active high and does not enable the power fault. + // + USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER); + + // + // Initialize the USB controller for host operation. + // + USBHCDInit(0, g_pHCDPool, HCD_MEMORY_SIZE); + + // + // Initialize the file system. + // + f_mount(0, &g_sFatFs); + + // + // Enter an infinite loop for reading and processing commands from the + // user. + // + while(1) + { + // + // Get a line of text from the user. + // + ReadLine(); + if(g_cCmdBuf[0] == '\0') + { + continue; + } + + // + // Pass the line from the user to the command processor. + // It will be parsed and valid commands executed. + // + iStatus = CmdLineProcess(g_cCmdBuf); + + // + // Handle the case of bad command. + // + if(iStatus == CMDLINE_BAD_CMD) + { + UARTprintf("Bad command!\n"); + } + + // + // Handle the case of too many arguments. + // + else if(iStatus == CMDLINE_TOO_MANY_ARGS) + { + UARTprintf("Too many arguments for command processor!\n"); + } + + // + // Otherwise the command was executed. Print the error + // code if one was returned. + // + else if(iStatus != 0) + { + UARTprintf("Command returned error code %s\n", + StringFromFresult((FRESULT)iStatus)); + } + } +} + diff --git a/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewd b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewd new file mode 100644 index 0000000..9c3f3df --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewp b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewp new file mode 100644 index 0000000..f14cc64 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ewp @@ -0,0 +1,809 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\..\..\..\..\utils\cmdline.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\port\fat_usbmsc.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\src\ff.c + + + $PROJ_DIR$\..\drivers\pinout.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\usb_host_msc.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.icf b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.icf new file mode 100644 index 0000000..0dc23f3 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_host_msc.icf - Linker configuration file for usb_host_msc. +// +// Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x000fffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x2003ffff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ld b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ld new file mode 100644 index 0000000..0c28745 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_host_msc.ld - Linker configuration file for usb_host_msc. + * + * Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00100000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.sct b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.sct new file mode 100644 index 0000000..15cbed5 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_host_msc.sct - Linker configuration file for usb_host_msc. +; +; Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00100000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00100000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00040000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvopt b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvopt new file mode 100644 index 0000000..3342ee8 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvopt @@ -0,0 +1,387 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_host_msc + 0x4 + ARM-ADS + + 25000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C1294NCPDT.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S1 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\cmdline.c + cmdline.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\port\fat_usbmsc.c + fat_usbmsc.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\src\ff.c + ff.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\pinout.c + pinout.c + + + 1 + 5 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 7 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_host_msc.c + usb_host_msc.c + + + 1 + 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 9 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 10 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 11 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvproj b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvproj new file mode 100644 index 0000000..9f0dba5 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc.uvproj @@ -0,0 +1,459 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_host_msc + 0x4 + ARM-ADS + + + TM4C1294NCPDT + Texas Instruments + IRAM(0x20000000-0x2003FFFF) IROM(0-0xFFFFF) CLOCK(25000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_1024 -FS00 -FL0100000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_host_msc + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_host_msc.bin .\rvmdk\usb_host_msc.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x40000 + + + 1 + 0x0 + 0x100000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x100000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x40000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C1294NCPDT TARGET_IS_TM4C129_RA0 + + ..;..\..\..\..;..\..\..\..\third_party; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_host_msc.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cmdline.c + 1 + ..\..\..\..\utils\cmdline.c + + + fat_usbmsc.c + 1 + ..\..\..\..\third_party\fatfs\port\fat_usbmsc.c + + + ff.c + 1 + ..\..\..\..\third_party\fatfs\src\ff.c + + + pinout.c + 1 + ..\drivers\pinout.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + usb_host_msc.c + 1 + .\usb_host_msc.c + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc_ccs.cmd b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc_ccs.cmd new file mode 100644 index 0000000..5326af0 --- /dev/null +++ b/boards/ek-tm4c1294xl/usb_host_msc/usb_host_msc_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_host_msc_ccs.cmd - CCS linker configuration file for usb_host_msc. + * + * Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00100000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00040000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 2048; -- cgit v1.3.1