forked from Archive/PX4-Autopilot
More updated LPC4300 scripts and README files
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4923 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
b3b69f16eb
commit
f756e3a738
|
@ -270,20 +270,42 @@ IDEs
|
|||
Code Red IDE
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Command Line Flash Programming
|
||||
------------------------------
|
||||
Booting the LPCLink
|
||||
-------------------
|
||||
|
||||
The first step is to active the LPCLink's boot mode. For my installation
|
||||
path, that can be done using the following steps in a Cygwin bash shell:
|
||||
The first step is to activate the LPCLink's boot mode. Some general
|
||||
instructions to do this are provided here:
|
||||
|
||||
http://support.code-red-tech.com/CodeRedWiki/BootingLPCLink
|
||||
|
||||
For my RedSuite installation path, that can be done using the following
|
||||
steps in a Cygwin bash shell:
|
||||
|
||||
$ /cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin/Scripts/bootLPCXpresso.cmd winusb
|
||||
Booting LPC-Link with LPCXpressoWIN.enc
|
||||
Press any key to continue . . .
|
||||
|
||||
The same file logic can be found the less restrictive LPCXpresso package at:
|
||||
|
||||
/cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin
|
||||
|
||||
(The "free" RedSuite version has a download limit of 8K; the "free" LPCXpresso
|
||||
version has a download limit of 128K).
|
||||
|
||||
NOTE that the following alias is defined in the setenv.sh file and
|
||||
can be used to enter the boot mode with a simpler command:
|
||||
|
||||
alias lpc43xx='${REDSUITE_BIN}/Scripts/bootLPCXpresso.cmd winusb'
|
||||
alias lpc43xx='${SCRIPT_BIN}/Scripts/bootLPCXpresso.cmd winusb'
|
||||
|
||||
Be default, the setenv.sh scripts uses the LPCXpresso path shown above.
|
||||
Once setenv.sh has been sources, then entering boot mode becomes simply:
|
||||
|
||||
$ lpc43xx
|
||||
Booting LPC-Link with LPCXpressoWIN.enc
|
||||
Press any key to continue . . .
|
||||
|
||||
Using GDB
|
||||
---------
|
||||
|
||||
The underlying debugger within Red Suite/LPCXpresso is GDB. That GDB
|
||||
used from the command line. The GDB configuration details for command
|
||||
|
@ -307,7 +329,8 @@ Code Red IDE
|
|||
can be found. For my installation, the driver for the LPC18xx and LPC43xx
|
||||
is located at:
|
||||
|
||||
/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin/crt_emu_lpc18_43_nxp.exe
|
||||
/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin/crt_emu_lpc18_43_nxp.exe, OR
|
||||
/cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin/crt_emu_lpc18_43_nxp.exe
|
||||
|
||||
And <options> are:
|
||||
|
||||
|
@ -326,7 +349,15 @@ Code Red IDE
|
|||
|
||||
target extended-remote | crt_emu_lpc18_43_nxp -2 -pLPC4330 -wire=winusb
|
||||
|
||||
NOTE: Don't forget to enable CONFIG_DEBUG_SYMBOLS=y in your NuttX
|
||||
DDD. This command can be used to start GDB under the graphics front-end
|
||||
DDD:
|
||||
|
||||
$ ddd --debugger arm-none-eabi-gdb nuttx &
|
||||
|
||||
NOTE 1: Don't forget to put the LPCLink in boot mode as described above
|
||||
before starting GDB.
|
||||
|
||||
NOTE 2: Don't forget to enable CONFIG_DEBUG_SYMBOLS=y in your NuttX
|
||||
configuration file when you build NuttX. That option is necessary to build
|
||||
in debugging symbols.
|
||||
|
||||
|
@ -335,31 +366,13 @@ Code Red IDE
|
|||
|
||||
http://support.code-red-tech.com/CodeRedWiki/LPCLinkDiagnostics
|
||||
|
||||
For example:
|
||||
Command Line Flash Programming
|
||||
------------------------------
|
||||
|
||||
C:\code_red\RedSuite_4.2.3_379\redsuite\bin\Scripts>bootLPCXpresso winusb
|
||||
Booting LPC-Link with LPCXpressoWIN.enc
|
||||
Press any key to continue . . .
|
||||
C:\code_red\RedSuite_4.2.3_379\redsuite\bin\Scripts>set CRT_DEBUG_TRACE=1
|
||||
C:\code_red\RedSuite_4.2.3_379\redsuite\bin\Scripts>cd ..
|
||||
C:\code_red\RedSuite_4.2.3_379\redsuite\bin>crt_emu_lpc18_43_nxp.exe -info-emu -wire=winusb
|
||||
Ni: Code Red Technologies Debug Driver v4.0 (May 21 2012 22:04:03)
|
||||
1 Emulators available:
|
||||
0. T1S6RGRIA LPC-Link Probe v1.1 (Code Red - LPCXpresso)
|
||||
|
||||
C:\code_red\RedSuite_4.2.3_379\redsuite\bin>crt_emu_lpc18_43_nxp.exe -info-target -wire=winusb
|
||||
Ni: Code Red Technologies Debug Driver v4.0 (May 21 2012 22:04:03)
|
||||
Nc: Looked for vendor directory XML file in C:/code_red/RedSuite_4.2.3_379/redsuite/bin/nxp_directory.xml
|
||||
|
||||
Nc: Found generic directory XML file in C:/code_red/RedSuite_4.2.3_379/redsuite/bin/crt_directory.xml
|
||||
|
||||
AP Ack: 04
|
||||
Nc: Mem-AP ID: 0x24770011 ROM Addr: 0xE00FF003
|
||||
Nc: Emu(0): Conn&Reset. DpID: 2BA01477. Info: T1S6RGRIA
|
||||
Nc: SWD Frequency: 3000 KHz. RTCK: False. Vector catch: False.
|
||||
Nc: Packet delay: 16 Poll delay: 0.
|
||||
Wc: XML Error in info file C:/code_red/RedSuite_4.2.3_379/redsuite/bin/nxp_lpc2xxx.xme: no matching info '*'
|
||||
Ed:03: Failed on chip setup: Ec(01). Invalid, mismatched, or unknown part
|
||||
The LPC18xx/LPC43xx debug driver can also be used to program the LPC43xx
|
||||
flash directly from the command line. The script flash.sh that may be
|
||||
found in the configs/lpc4330-xplorer/scripts directory can do that with
|
||||
a single command line command.
|
||||
|
||||
NuttX buildroot Toolchain
|
||||
=========================
|
||||
|
|
|
@ -69,6 +69,10 @@
|
|||
#define BOARD_RTCCLK_FREQUENCY (32768) /* RTC oscillator frequency (Y1) */
|
||||
#define BOARD_INTRCOSC_FREQUENCY (4000000) /* Internal RC oscillator frequency */
|
||||
|
||||
/* TODO: The LPC43xx is capable of running at much higher frequencies, but requires
|
||||
* a ramp-up in several stages.
|
||||
*/
|
||||
|
||||
/* Integer and direct modes are supported:
|
||||
*
|
||||
* In integer mode:
|
||||
|
|
|
@ -52,13 +52,14 @@ fi
|
|||
# Code Red toolchain in any other location or if you install a different
|
||||
# version
|
||||
export TOOLCHAIN_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/Tools/bin"
|
||||
export REDSUITE_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin"
|
||||
#export SCRIPT_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin"
|
||||
export SCRIPT_BIN="/cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin"
|
||||
|
||||
# This the Cygwin path to the location where I installed the CodeSourcery
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the CodeSourcery toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||
#export REDSUITE_BIN=
|
||||
#export SCRIPT_BIN=
|
||||
|
||||
# These are the Cygwin paths to the locations where I installed the Atollic
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
|
@ -67,19 +68,19 @@ export REDSUITE_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin"
|
|||
# at those locations as well.
|
||||
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
|
||||
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
|
||||
#export REDSUITE_BIN=
|
||||
#export SCRIPT_BIN=
|
||||
|
||||
# This the Cygwin path to the location where I build the buildroot
|
||||
# toolchain.
|
||||
#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
#export REDSUITE_BIN=
|
||||
#export SCRIPT_BIN=
|
||||
|
||||
# And add the selected toolchain path[s] to the PATH variable
|
||||
|
||||
export PATH="/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
if [ ! -z ${REDSUITE_BIN} ]; then
|
||||
export PATH="${REDSUITE_BIN}:${PATH}"
|
||||
if [ ! -z ${SCRIPT_BIN} ]; then
|
||||
export PATH="${SCRIPT_BIN}:${PATH}"
|
||||
fi
|
||||
|
||||
export PATH="${TOOLCHAIN_BIN}:${PATH}"
|
||||
|
@ -87,4 +88,4 @@ echo "PATH : ${PATH}"
|
|||
|
||||
# Set an alias that can be used to put the LPC43xx in boot mode
|
||||
|
||||
alias lpc43xx='${REDSUITE_BIN}/Scripts/bootLPCXpresso.cmd winusb'
|
||||
alias lpc43xx='${SCRIPT_BIN}/Scripts/bootLPCXpresso.cmd winusb'
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
#!/bin/bash
|
||||
####################################################################################
|
||||
# flash.sh
|
||||
#
|
||||
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
####################################################################################
|
||||
set -x
|
||||
|
||||
USAGE="$0 <nuttx-path>"
|
||||
|
||||
# LPCXpresso 3.6 installed at /cygdrive/c/nxp/lpcxpresso_3.6"
|
||||
BINDIR="/cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin"
|
||||
|
||||
# RedSuite with LPC4330 support installed at /cygdrive/c/code_red/RedSuite_4.2.3_379 "
|
||||
#BINDIR="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin"
|
||||
|
||||
TARGET=LPC4330
|
||||
|
||||
echo "############################################################################"
|
||||
echo "# Assumptions:"
|
||||
echo "#"
|
||||
echo "# - Windows 7"
|
||||
echo "# - Binaries installed at ${BINDIR}"
|
||||
echo "# - AXF image built with Code Red"
|
||||
echo "# - ${TARGET}"
|
||||
echo "#"
|
||||
echo "# You will need to edit this is any of the above are false"
|
||||
echo "#"
|
||||
echo "############################################################################"
|
||||
echo ""
|
||||
|
||||
# This is the default install location for binaries on Windows (note that this
|
||||
# path could change with the Code Red version number)
|
||||
|
||||
if [ ! -d "${BINDIR}" ]; then
|
||||
echo "Directory ${BINDIR} does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This is the relative path to the booLPCXpresso utility.
|
||||
|
||||
BOOTLPC="Scripts/bootLPCXpresso.cmd"
|
||||
if [ ! -x "${BINDIR}/${BOOTLPC}" ]; then
|
||||
echo "No executable at ${BINDIR}/${BOOTLPC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# bootLPCXpresso arguments
|
||||
|
||||
BOOTLPC_ARG=winusb # Win7
|
||||
|
||||
# Use the LPC18xx/LPC43xx flash utility
|
||||
|
||||
FLASHUTIL="crt_emu_lpc18_43_nxp" # for LPC18xx/LPC43xx parts
|
||||
|
||||
if [ ! -x "${BINDIR}/${FLASHUTIL}" ]; then
|
||||
echo "No executable file at ${BINDIR}/${FLASHUTIL}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# FLUSHUTIL arguements
|
||||
|
||||
WIRE="-wire=winusb" # for LPC-Link on Windows Vista/Windows 7)
|
||||
|
||||
# The nuttx directory must be provided as an argument
|
||||
|
||||
NUTTX=$1
|
||||
if [ -z "${NUTTX}" ]; then
|
||||
echo "Missing argument"
|
||||
echo $USAGE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "${NUTTX}" ]; then
|
||||
echo "Directory ${NUTTX} does not exist"
|
||||
echo $USAGE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The binary to download:
|
||||
|
||||
if [ ! -f "${NUTTX}/nuttx.axf" ]; then
|
||||
if [ -f "${NUTTX}/nuttx" ]; then
|
||||
echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf"
|
||||
mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf
|
||||
fi
|
||||
else
|
||||
if [ -f "${NUTTX}/nuttx" ]; then
|
||||
echo "Both ${NUTTX}/nuttx ${NUTTX}/nuttx.axf exist.."
|
||||
echo " Deleting ${NUTTX}/nuttx.axf"
|
||||
rm -f ${NUTTX}/nuttx.axf
|
||||
echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf"
|
||||
mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf
|
||||
fi
|
||||
fi
|
||||
NUTTXPATH=`cygpath -w "${NUTTX}/nuttx.axf"`
|
||||
|
||||
# First of all boot the LPC-Link using the script: ${BINDIR}/${BOOTLPC}
|
||||
|
||||
cd ${BINDIR} || \
|
||||
{ echo "Failed to CD to ${BINDIR}"; exit 1; }
|
||||
./${BOOTLPC} ${BOOTLPC_ARG} || \
|
||||
{ echo "'${BOOTLPC} ${BOOTLPC_ARG}' Failed"; }
|
||||
|
||||
echo ""
|
||||
echo "Wait a bit"
|
||||
echo "5..."
|
||||
sleep 1
|
||||
echo "4..."
|
||||
sleep 1
|
||||
echo "3..."
|
||||
sleep 1
|
||||
echo "2..."
|
||||
sleep 1
|
||||
echo "1..."
|
||||
sleep 1
|
||||
echo "0..."
|
||||
echo ""
|
||||
|
||||
# Then program the FLASH
|
||||
|
||||
cd ${BINDIR} || \
|
||||
{ echo "Failed to CD to ${BINDIR}"; exit 1; }
|
||||
./${FLASHUTIL} ${WIRE} -p${TARGET} -flash-load-exec="${NUTTXPATH}"
|
Loading…
Reference in New Issue