Initial debugging fixes

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2648 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-05-03 03:32:48 +00:00
parent acf82c0a9d
commit 74ef4fdabd
6 changed files with 105 additions and 63 deletions

View File

@ -287,6 +287,43 @@ ENC28J60 Module
UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
interrupt conflict with TIM1.
Using OpenOCD and GDB
^^^^^^^^^^^^^^^^^^^^^
I have been using the Olimex ARM-USB-OCD JTAG debugger with the STR-P711
(http://www.olimex.com). The OpenOCD configuration file is here:
scripts/oocd_ft2xx.cfg. There is also a script on the scripts/ directory that
I used to start the OpenOCD daemon on my system called oocd.sh. That
script would probably require some modifications to work in another
environment:
- possibly the value of OPENOCD_PATH
- If you are working under Linux you will need to change any
occurances of `cygpath -w blablabla` to just blablabla
The setenv.sh file includes some environment varialble settings
that are needed by oocd.sh. If you have $PATH and other environment
variables set up, then you should be able to start the OpenOCD daemon like:
oocd.sh
Where it is assumed that you are executing oocd.sh from the top level
directory where NuttX is installed.
Once the OpenOCD daemon has been started, you can connect to it via
GDB using the following GDB command:
arm-elf-gdb
(gdb) target remote localhost:3333
And you can load the NuttX ELF file:
(gdb) load nuttx
(There are also some files in the scripts/ directory that I used to
get OpenOCD working with a Wriggler clone... I never got that stuff
working).
Configurations:
---------------

View File

@ -2,8 +2,17 @@
# Set up pathes to binaries, scripts, configuration files
installdir=/usr/local/bin
openocd=$installdir/openocd
hostos=`uname -o`
if [ "X${hostos}" = "XCygwin" ]; then
installdir=/cygdrive/c/gccfd/openocd/bin
ft2exe=$installdir/openocd-ftd2xx.exe
ppexe=$installdir/openocd-ppdev.exe
else
installdir=/usr/local/bin
ft2exe=$installdir/openocd
ppexe=$installdir/openocd
SUDO=sudo
fi
# The root to the top-level NuttX directory should be in an environment variable
@ -15,7 +24,7 @@ if [ -z $STR41XSCRIPTS ]; then
fi
# Check that at least one configuration file exists at that point
if [ ! -f $STR41XSCRIPTS/oocd_wiggler.cfg ]; then
if [ ! -f $STR41XSCRIPTS/oocd_ft2xx.cfg ]; then
echo "No configuration files found at $STR41XSCRIPTS"
echo "Path to configuration files unknown"
exit 1
@ -23,11 +32,11 @@ fi
# Parse command line inputs
usage="USAGE: $0 [-h] [-d] [-pp] [-ftdi]"
usage="USAGE: $0 [-h] [-d] [-pp] [-ft2xx]"
debug=no
interface=pp
oocdcfg=$STR41XSCRIPTS/oocd_wiggler.cfg
oocdcfg=$STR41XSCRIPTS/oocd_ft2xx.cfg
openocd=$ft2exe
while [ ! -z "$1" ]; do
case $1 in
-d )
@ -35,12 +44,12 @@ while [ ! -z "$1" ]; do
set -x
;;
-pp )
interface=pp
oocdcfg=$STR41XSCRIPTS/oocd_wiggler.cfg
openocd=$ppexe
;;
-ftdi )
interface=ftdi
oocdcfg=$STR41XSCRIPTS/oocd_ftdi.cfg
-ft2xx )
oocdcfg=$STR41XSCRIPTS/oocd_ft2xx.cfg
openocd=$ft2exe
;;
-h )
echo $usage
@ -62,4 +71,9 @@ export options="-d 1"
# Run OpenOCD -- here it is assumed (1) that you must have root priveleges to
# execute OpenOCD and (2) that your user is listed in the /etc/sudoers file.
sudo $openocd $options -f $oocdcfg
$SUDO $openocd $options -f $oocdcfg
if [ "X${hostos}" = "XCygwin" ]; then
$openocd $options -f `cygpath -w $oocdcfg`
else
sudo $openocd $options -f $oocdcfg
fi

View File

@ -0,0 +1,37 @@
#daemon configuration
telnet_port 4444
gdb_port 3333
#interface
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 0
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst
#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe
#target configuration
daemon_startup reset
#target <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little run_and_halt 0 arm7tdmi
run_and_halt_time 0 30
working_area 0 0x2000C000 0x4000 nobackup
#flash bank <driver> <base> <size> <chip_width> <bus_width>
flash bank str7x 0x40000000 0x00040000 0 0 0 STR71x
#flash bank cfi 0x60000000 0x00400000 2 2 0
#Script used for FLASH programming
#target_script 0 reset str71x_flashprogram.ocd
# For more information about the configuration files, take a look at:
# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger

View File

@ -1,47 +0,0 @@
# Daemon configuration
telnet_port 4444
gdb_port 3333
# Interface - FTDI JTAG-device (see /usr/local/lib/openocd/interface/jtagkey.cfg)
interface ft2232
ft2232_device_desc "Amontec JTAGkey A"
ft2232_layout jtagkey
ft2232_vid_pid 0x0403 0xcff8
jtag_speed 0
jtag_nsrst_delay 200
jtag_ntrst_delay 200
# Start the OpenOCD daemon and reset the processor
init
reset halt
# (See /usr/local/lib/openocd/target/str710.cfg)
# Start slow, speed up after reset
jtag_khz 10
# Use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst
# Jtag scan chain
# format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe
# target <type> <startup mode>
# target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little 0 arm7tdmi
[new_target_name] configure -event reset-start { jtag_khz 10 }
[new_target_name] configure -event reset-init { jtag_khz 6000 }
[new_target_name] configure -event old-gdb_program_config { script event/str710_program.script }
target_script 0 reset oocd_flash.script
# Flash-configuration STR710FZ2/STR711FR2:
# internal flash at address 0x40000000 size 256kB (0x40000)
# internal ram at address 0x20000000 size 64kB (0x10000)
# a 16kB working area inside RAM:
working_area 0 0x2000C000 0x4000 nobackup
# Flash bank str7x <base> <size> 0 0 <target#> <variant>
flash bank str7x 0x40000000 0x00040000 0 0 0 STR71x
flash bank str7x 0x400C0000 0x00004000 0 0 0 STR71x

View File

@ -947,7 +947,7 @@ static int enc_uiptxpoll(struct uip_driver_s *dev)
* the field d_len is set to a value > 0.
*/
nllvdbg("Poll result: d_len=%d\n", priv->ld_dev.d_len);
nllvdbg("Poll result: d_len=%d\n", priv->dev.d_len);
if (priv->dev.d_len > 0)
{
uip_arp_out(&priv->dev);
@ -1130,7 +1130,7 @@ static void enc_rxdispath(FAR struct enc_driver_s *priv)
if (BUF->type == HTONS(UIP_ETHTYPE_IP))
#endif
{
nllvdbg("IP packet received (%02x)\n", ETHBUF->type);
nllvdbg("IP packet received (%02x)\n", BUF->type);
uip_arp_ipin();
uip_input(&priv->dev);
@ -1146,7 +1146,7 @@ static void enc_rxdispath(FAR struct enc_driver_s *priv)
}
else if (BUF->type == htons(UIP_ETHTYPE_ARP))
{
nllvdbg("ARP packet received (%02x)\n", ETHBUF->type);
nllvdbg("ARP packet received (%02x)\n", BUF->type);
uip_arp_arpin(&priv->dev);
/* If the above function invocation resulted in data that should be
@ -1160,7 +1160,7 @@ static void enc_rxdispath(FAR struct enc_driver_s *priv)
}
else
{
nlldbg("Unsupported packet type dropped (%02x)\n", htons(ETHBUF->type));
nlldbg("Unsupported packet type dropped (%02x)\n", htons(BUF->type));
}
}
@ -1223,7 +1223,7 @@ static void enc_pktif(FAR struct enc_driver_s *priv)
if ((rxstat & RXSTAT_OK) == 0)
{
nlldbg("ERROR: RXSTAT: %04x\n", RXSTAT);
nlldbg("ERROR: RXSTAT: %04x\n", rxstat);
#ifdef CONFIG_ENC28J60_STATS
priv->stats.rxnotok++;
#endif

View File

@ -49,6 +49,7 @@ GARBAGEDIRS="\
configs/m68332evb/src/doc\
configs/sim/doc/include\
configs/sim/doc/src\
configs/olimex-strp711/tools\
arch/c5471\
arch/dm320\
netutils/thttpd/extras