Add configuration of Olimex-STR-P711

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1103 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2008-10-30 00:23:38 +00:00
parent 26b73d53f0
commit 6ae932a3b5
10 changed files with 1077 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
For a debug environment, I am using OpenOCD with a Wiggler-clone JTAG interface. The
following steps worked for me with a 20081028 OpenOCD snapshot.
GENERAL STEPS:
1. Check out OpenOCD
svn checkout svn://svn.berlios.de/openocd/trunk openocd
2. Build OpenOCD
Read the INSTALL file from the files you just downloaded. You probably just need
to run:
./bootstrap
Then configure OpenOCD using the configure script created by ./bootstrap.
./configure --enable-parport
Build OpenOCD with:
make
Install OpenOCD. Since we used the default configuration the code will be
installed at /usr/local/bin/openocd. Other files will be installed at
/usr/local/lib/openocd (configuration files, scripts, etc.) and /usr/local/share/info
(online documentation accessable via 'info openocd'). You need root priviledges
to do the following:
make install.
3. Setup
OpenOCD reads its configuration from the file openocd.cfg in the current directory
when started. You have two different options:
* Create a symbolic link named openocd.cfg to one of the configuration files in
/usr/local/lib/openocd, or
* Use a custom configuration file specified with the -f <conf.file> command line
switch opeion when starting OpenOCD.
For the STR-P711, I have included bash scripts in the scripts sub-directory.
4. Running OpenOCD
Make sure the ARM7TDMI board is powered and the JTAG cable is connected
Run 'src/openocd -d' (might be required to be root) and check for any errors
reported. The '-d' option enables debugging info.
5. Telnet interface
telnet into port 4444 to get a command interface: 'telnet localhost 4444'
6. GDB
start arm-elf-gdb
type 'file <executable.elf>' to load the executable
type 'set debug remote 1' to enable tracing of gdb protocol (if required)
type 'target remote localhost:3333' to connect to the target
The same commands from the telnet interface can now be accessed through the
'monitor' command, e.g. 'monitor help'
+97
View File
@@ -0,0 +1,97 @@
##############################################################################
# configs/olimex-strp711/ostest/Make.defs
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
##############################################################################
include ${TOPDIR}/.config
ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce \
-fomit-frame-pointer
endif
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifeq ("${CONFIG_DEBUG}","y")
LDFLAGS += -g
endif
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+95
View File
@@ -0,0 +1,95 @@
/****************************************************************************
* configs/olimex-strp711/ostest/ld.script
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* 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.
*
****************************************************************************/
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
/* The str71x has 256Kb of non-volatile memory beginning at address
* 0x00000000 for program storage (Bank0, an addition 16Kb is avalable
* for data storage in Bank1). The OS entry point is via the reset vector
* at address 0x00000000 where the FLASH is remapped at reset.
*/
. = 0x00000000;
.text : {
_stext = ABSOLUTE(.);
*(.text)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata.str1.4)
*(.glue_7)
*(.glue_7t)
*(.got) /* Global offset table */
_etext = ABSOLUTE(.);
}
_eronly = ABSOLUTE(.); /* This is where the .data section
* is relocated for execution out
* FLASH */
/* The str71x has 64Kb of on-chip static RAM beginning at address
* 0x20000000. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
. = 0x20000000;
.data : {
_sdata = ABSOLUTE(.);
*(.data)
CONSTRUCTORS
_edata = ABSOLUTE(.);
}
.bss : { /* BSS */
_sbss = ABSOLUTE(.);
*(.bss)
*(COMMON)
_ebss = ABSOLUTE(.);
}
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
# configs/olimex-strp711/ostest/setenv.sh
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
if [ "$(basename $0)" = "setenv.sh" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
WD=`pwd`
export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
export STR41XCFGS=$WD/configs/olimex-strp711/scripts
export PATH=${BUILDROOT_BIN}:${STR41XCFGS}:/sbin:/usr/sbin:${PATH_ORIG}
echo "PATH : ${PATH}"
+41
View File
@@ -0,0 +1,41 @@
#
# The following command wills be executed on
# reset (because of run_and_init in the config-file)
# - wait for target halt
# - erase memory
# - flash content of file main.bin into target-memory
# - shutdown openocd
#
# created by Martin Thomas 8/2007
# http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects
# based on information from Dominic Rath
#
arm7_9 dcc_downloads enable
wait_halt
sleep 10
poll
flash probe 0
# STR710FZ2 erase all banks:
#flash erase 0 0 9
# STR710FZ2 erase first 5 banks (0-4)
flash erase 0 0 4
# if flash earse is not available in your OpenOCD-version use
# flash erase_sector but also read the documentation on
# flash auto_erase which can be used together with flash write_image
flash write 0 main.bin 0x0
# flash write may not be available in your OpenOCD-version
# alternative: flash write_binary (flash write_binary <bank-num> <file> <offset>)
# flash write_binary 0 main.bin 0x0
# flash write_binary may not be available in your OpenOCD-version
# alternatives: flash write_bank or flash write_image
# syntax: flash write_image <file> [offset] [type] where type can
# be ihex, bin, elf or s19
# flash write_bank flash-bank bin-filename offset
# i.e. flash write_bank 0 main.bin 0x0
reset run
sleep 10
shutdown
+65
View File
@@ -0,0 +1,65 @@
#!/bin/sh
# Set up pathes to binaries, scripts, configuration files
installdir=/usr/local/bin
openocd=$installdir/openocd
# The root to the top-level NuttX directory should be in an environment variable
if [ -z $STR41XCFGS ]; then
echo "Environment variable $STR41XCFGS is not defined"
echo "Has NuttX been configured?"
echo "If so, try sourcing the setenv.sh script in the top-level directory"
exit 1
fi
# Check that at least one configuration file exists at that point
if [ ! -f $STR41XCFGS/oocd_wiggler.cfg ]; then
echo "No configuration files found at $STR41XCFGS"
echo "Path to configuration files unknown"
exit 1
fi
# Parse command line inputs
usage="USAGE: $0 [-h] [-d] [-pp] [-ftdi]"
debug=no
interface=pp
oocdcfg=$STR41XCFGS/oocd_wiggler.cfg
while [ ! -z "$1" ]; do
case $1 in
-d )
debug=yes
set -x
;;
-pp )
interface=pp
oocdcfg=$STR41XCFGS/oocd_wiggler.cfg
;;
-ftdi )
interface=ftdi
oocdcfg=$STR41XCFGS/oocd_ftdi.cfg
;;
-h )
echo $usage
exit 0
;;
* )
echo "Unrecognized option: $1"
echo $usage
exit 1
;;
esac
shift
done
# Setup debug options
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
@@ -0,0 +1,26 @@
#
# The following command will be executed on reset
# - wait for target halt
# - erase memory
# - flash content of file nuttx.bin into target-memory
# - shutdown openocd
#
# Based on file originally created by Martin Thomas
#
arm7_9 dcc_downloads enable
wait_halt
sleep 10
poll
flash probe 0
# STR710 erase all banks:
#flash erase 0 0 9
# STR710 erase first 4 banks (32kB)
flash erase 0 0 4
flash write 0 nuttx.bin 0x0
reset run
sleep 10
shutdown
@@ -0,0 +1,47 @@
# 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
# (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
# Start the OpenOCD daemon and reset the processor
init
reset halt
@@ -0,0 +1,46 @@
# Daemon configuration
telnet_port 4444
gdb_port 3333
# Interface - Wiggler-Type JTAG-device (see /usr/local/lib/openocd/interface/parport.cfg)
interface parport
parport_port 0x378
parport_cable wiggler
jtag_speed 0
jtag_nsrst_delay 20
jtag_ntrst_delay 20
# (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
# Start the OpenOCD daemon and reset the processor
init
reset halt