Add OpenOCD support for LM4F120 LaunchPad. From JP Carballo

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5747 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-03-16 01:57:34 +00:00
parent a2888902dd
commit d0a8966719
6 changed files with 170 additions and 13 deletions

View File

@ -136,16 +136,33 @@ Using OpenOCD and GDB with an FT2232 JTAG emulator
Building OpenOCD under Cygwin:
Refer to configs/lm4f120-launchpad/README.txt
Refer to configs/olimex-lpc1766stk/README.txt
Installing OpenOCD in Linux:
sudo apt-get install openocd
sudo apt-get install openocd
As of this writing, there is no support for the lm4f120 in the package
above. You will have to build openocd from its source (as of this writing
the latest commit was b9b4bd1a6410ff1b2885d9c2abe16a4ae7cb885f):
git clone http://git.code.sf.net/p/openocd/code openocd
cd openocd
Then, add the patches provided by http://openocd.zylin.com/922:
git fetch http://openocd.zylin.com/openocd refs/changes/22/922/14 && git checkout FETCH_HEAD
./bootstrap
./configure --enable-maintainer-mode --enable-ti-icdi
make
sudo make install
For additional help, see http://processors.wiki.ti.com/index.php/Stellaris_Launchpad_with_OpenOCD_and_Linux
Helper Scripts.
I have been using the on-board FT2232 JTAG/SWD/SWO interface. OpenOCD
requires a configuration file. I keep the one I used last here:
I have been using the on-board In-Circuit Debug Interface (ICDI) interface.
OpenOCD requires a configuration file. I keep the one I used last here:
configs/lm4f120-launchpad/tools/lm4f120-launchpad.cfg
@ -155,9 +172,9 @@ Using OpenOCD and GDB with an FT2232 JTAG emulator
/usr/share/openocd/scripts. As of this writing, the configuration
files of interest were:
/usr/share/openocd/scripts/interface/luminary.cfg
/usr/share/openocd/scripts/board/ek-lm3s6965.cfg
/usr/share/openocd/scripts/target/stellaris.cfg
/usr/local/share/openocd/scripts/board/ek-lm4f120xl.cfg
/usr/local/share/openocd/scripts/interface/ti-icdi.cfg
/usr/local/share/openocd/scripts/target/stellaris_icdi.cfg
There is also a script on the tools/ directory that I use to start
the OpenOCD daemon on my system called oocd.sh. That script will
@ -169,9 +186,14 @@ Using OpenOCD and GDB with an FT2232 JTAG emulator
Starting OpenOCD
Then you should be able to start the OpenOCD daemon like:
If you are in the top-level NuttX build directlory then you should
be able to start the OpenOCD daemon like:
configs/lm4f120-launchpad/tools/oocd.sh $PWD
oocd.sh $PWD
The relative path to the oocd.sh script is configs/lm4f120-launchpad/tools,
but that should have been added to your PATH variable when you sourced
the setenv.sh script.
Connecting GDB

View File

@ -1,7 +1,7 @@
#!/bin/bash
# configs/lm4f120-launchpad/ostest/setenv.sh
#
# Copyright (C) 2010 Gregory Nutt. All rights reserved.
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -64,7 +64,10 @@ fi
# toolchain.
export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
# Add the path to the toolchain to the PATH varialble
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
# The lm4f120-launchpad/tools directory
export TOOL_DIR="${WD}/configs/lm4f120-launchpad/tools"
# Add the path to the toolchain and tools directory to the PATH varialble
export PATH="${TOOLCHAIN_BIN}:${TOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"

View File

@ -0,0 +1,71 @@
#
# TI Stellaris Launchpad ek-lm4f120xl Evaluation Kits
#
# http://www.ti.com/tool/ek-lm4f120xl
#
#
# NOTE: using the bundled ICDI interface is optional!
# This interface is not ftdi based as previous boards were
#
# Interface configuration
#
# TI Stellaris In-Circuit Debug Interface (ICDI) Board
#
# This is the propriety ICDI interface used on newer boards such as
# LM4F232 Evaluation Kit - http://www.ti.com/tool/ek-lm4f232
# Stellaris Launchpad - http://www.ti.com/stellaris-launchpad
# http://www.ti.com/tool/ek-lm4f232
#
interface hla
hla_layout ti-icdi
hla_vid_pid 0x1cbe 0x00fd
# Board configuration
# unused but set to disable warnings
adapter_khz 1000
set WORKAREASIZE 0x8000
set CHIPNAME lm4f120h5qr
# Target configuration
#
# lm3s icdi pseudo target
#
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME lm3s
}
# Work-area is a space in RAM used for flash programming
# By default use 16kB
if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
set _WORKAREASIZE 0x4000
}
#
# possible value are hla_jtag
# currently swd is not supported
#
transport select hla_jtag
# do not check id as icdi currently does not support it
hla newtap $_CHIPNAME cpu -expected-id 0
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME hla_target -chain-position $_TARGETNAME
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
# flash configuration ... autodetects sizes, autoprobed
flash bank $_CHIPNAME.flash stellaris 0 0 0 0 $_TARGETNAME

View File

@ -0,0 +1,58 @@
#!/bin/sh
#
# See configs/lm4f120-launchpad/README.txt for information about
# this file.
TOPDIR=$1
USAGE="$0 <TOPDIR> [-d]"
if [ -z "${TOPDIR}" ]; then
echo "Missing argument"
echo $USAGE
exit 1
fi
# Assume that OpenOCD was installed and at /usr/local/bin. Uncomment
# the following to run directly from the build directory
# OPENOCD_PATH="/home/OpenOCD/openocd/src"
# OPENOCD_PATH="/usr/bin"
OPENOCD_PATH="/usr/local/bin"
# TARGET_PATH="/home/OpenOCD/openocd/tcl"
# TARGET_PATH="/usr/share/openocd/scripts"
TARGET_PATH="/usr/local/share/openocd/scripts"
# Assume a Unix development environment. Uncomment to use a Windows
# like environment
# OPENOCD_EXE=openocd.exe
OPENOCD_EXE=openocd
OPENOCD_CFG="${TOPDIR}/configs/lm4f120-launchpad/tools/lm4f120-launchpad.cfg"
OPENOCD_ARGS="-f ${OPENOCD_CFG} -s ${TARGET_PATH}"
if [ "X$2" = "X-d" ]; then
OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
set -x
fi
if [ ! -d ${OPENOCD_PATH} ]; then
echo "OpenOCD path does not exist: ${OPENOCD_PATH}"
exit 1
fi
if [ ! -x ${OPENOCD_PATH}/${OPENOCD_EXE} ]; then
echo "OpenOCD does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
exit 1
fi
if [ ! -f ${OPENOCD_CFG} ]; then
echo "OpenOCD config file does not exist: ${OPENOCD_CFG}"
exit 1
fi
echo "Starting OpenOCD"
cd ${OPENOCD_PATH} || { echo "Failed to CD to ${OPENOCD_PATH}"; exit 1; }
${OPENOCD_EXE} ${OPENOCD_ARGS} &
echo "OpenOCD daemon started"
ps -ef | grep openocd
echo "In GDB: target remote localhost:3333"

View File

@ -307,6 +307,9 @@ CONFIGURATION
Make the user-space binaries first (pass1), then make the the kernel-space
binaries (pass2)
There are ordering dependencies so, for example, 'make -j 6' fails.
'make -j 6 pass1 pass2' does work fine, however.
NOTES:
1. This configuration uses the mconf-based configuration tool. To

View File

@ -64,7 +64,7 @@ fi
# toolchain.
export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
# The Olimex-lpc1766stk/tools directory
# The open1788/tools directory
export LPCTOOL_DIR="${WD}/configs/open1788/tools"
# Add the path to the toolchain and tools directory to the PATH varialble