From 4a82069f1526ef9412a153fad786e4a505a3a8eb Mon Sep 17 00:00:00 2001 From: ksb Date: Sat, 11 Jul 2009 14:18:01 +0000 Subject: [PATCH] OpenOCD configuration for SAM7S. Should be merged into ../../common/openocd --- .../at91sam7s/openocd/AT91SAM7x_init.script | 1 + cpu/arm/at91sam7s/openocd/arm7_wig.cfg | 18 ++++++++++ cpu/arm/at91sam7s/openocd/arm7_wig_flash.cfg | 30 ++++++++++++++++ cpu/arm/at91sam7s/openocd/arm7_wig_reset.cfg | 30 ++++++++++++++++ cpu/arm/at91sam7s/openocd/openocd_flash | 10 ++++++ cpu/arm/at91sam7s/openocd/openocd_reset | 4 +++ cpu/arm/at91sam7s/openocd/target/sam7s.cfg | 36 +++++++++++++++++++ 7 files changed, 129 insertions(+) create mode 100644 cpu/arm/at91sam7s/openocd/AT91SAM7x_init.script create mode 100644 cpu/arm/at91sam7s/openocd/arm7_wig.cfg create mode 100644 cpu/arm/at91sam7s/openocd/arm7_wig_flash.cfg create mode 100644 cpu/arm/at91sam7s/openocd/arm7_wig_reset.cfg create mode 100644 cpu/arm/at91sam7s/openocd/openocd_flash create mode 100644 cpu/arm/at91sam7s/openocd/openocd_reset create mode 100644 cpu/arm/at91sam7s/openocd/target/sam7s.cfg diff --git a/cpu/arm/at91sam7s/openocd/AT91SAM7x_init.script b/cpu/arm/at91sam7s/openocd/AT91SAM7x_init.script new file mode 100644 index 000000000..b21e278fa --- /dev/null +++ b/cpu/arm/at91sam7s/openocd/AT91SAM7x_init.script @@ -0,0 +1 @@ +arm7_9 force_hw_bkpts enable diff --git a/cpu/arm/at91sam7s/openocd/arm7_wig.cfg b/cpu/arm/at91sam7s/openocd/arm7_wig.cfg new file mode 100644 index 000000000..d640f83e5 --- /dev/null +++ b/cpu/arm/at91sam7s/openocd/arm7_wig.cfg @@ -0,0 +1,18 @@ + + +# Change the default telnet port... +telnet_port 4444 +# GDB connects here +gdb_port 3333 +# GDB can also flash my flash! +gdb_memory_map enable +gdb_flash_program enable + +# Wiggler interface +interface parport +parport_port 0 +parport_cable wiggler +jtag_speed 0 +set CPUTAPID 0x3f0f0f0f +source [find target/sam7s.cfg] + diff --git a/cpu/arm/at91sam7s/openocd/arm7_wig_flash.cfg b/cpu/arm/at91sam7s/openocd/arm7_wig_flash.cfg new file mode 100644 index 000000000..818665fe2 --- /dev/null +++ b/cpu/arm/at91sam7s/openocd/arm7_wig_flash.cfg @@ -0,0 +1,30 @@ +#daemon configuration +telnet_port 4444 +gdb_port 3333 + +#interface +interface parport +parport_port 0 +parport_cable wiggler +jtag_speed 0 +#use combined on interfaces or targets that can't set TRST/SRST separately +reset_config srst_only + +#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 +#target arm7tdmi +target arm7tdmi little run_and_init 0 arm7tdmi_r4 +#target_script 0 reset h2294_init.script +target_script 0 reset openocd_flash +run_and_halt_time 0 30 +working_area 0 0x40000000 0x4000 nobackup + +#flash configuration +#flash bank lpc2000 0x0 0x40000 0 0 lpc2000_v1 0 14765 calc_checksum +#flash bank cfi 0x80000000 0x400000 2 2 0 +flash bank at91sam7 0 0 0 0 0 diff --git a/cpu/arm/at91sam7s/openocd/arm7_wig_reset.cfg b/cpu/arm/at91sam7s/openocd/arm7_wig_reset.cfg new file mode 100644 index 000000000..c21e46067 --- /dev/null +++ b/cpu/arm/at91sam7s/openocd/arm7_wig_reset.cfg @@ -0,0 +1,30 @@ +#daemon configuration +telnet_port 4444 +gdb_port 3333 + +#interface +interface parport +parport_port 0 +parport_cable wiggler +jtag_speed 0 +#use combined on interfaces or targets that can't set TRST/SRST separately +reset_config srst_only + +#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 +#target arm7tdmi +target arm7tdmi little run_and_init 0 arm7tdmi_r4 +#target_script 0 reset h2294_init.script +target_script 0 reset openocd_reset +run_and_halt_time 0 30 +working_area 0 0x40000000 0x4000 nobackup + +#flash configuration +#flash bank lpc2000 0x0 0x40000 0 0 lpc2000_v1 0 14765 calc_checksum +#flash bank cfi 0x80000000 0x400000 2 2 0 +flash bank at91sam7 0 0 0 0 0 diff --git a/cpu/arm/at91sam7s/openocd/openocd_flash b/cpu/arm/at91sam7s/openocd/openocd_flash new file mode 100644 index 000000000..60ad35f10 --- /dev/null +++ b/cpu/arm/at91sam7s/openocd/openocd_flash @@ -0,0 +1,10 @@ +poll +mww 0xffffff64 0x5a000004 +sleep 250 +mww 0xffffff64 0x5a002004 +sleep 250 +flash probe 0 +flash write 0 /tmp/openocd_write.bin 0x0 +reset run +sleep 500 +shutdown diff --git a/cpu/arm/at91sam7s/openocd/openocd_reset b/cpu/arm/at91sam7s/openocd/openocd_reset new file mode 100644 index 000000000..6c138449e --- /dev/null +++ b/cpu/arm/at91sam7s/openocd/openocd_reset @@ -0,0 +1,4 @@ +poll +reset run +sleep 500 +shutdown diff --git a/cpu/arm/at91sam7s/openocd/target/sam7s.cfg b/cpu/arm/at91sam7s/openocd/target/sam7s.cfg new file mode 100644 index 000000000..9b6b68b51 --- /dev/null +++ b/cpu/arm/at91sam7s/openocd/target/sam7s.cfg @@ -0,0 +1,36 @@ +# ATMEL sam7s + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME sam7s +} + +if { [info exists ENDIAN] } { + set _ENDIAN $ENDIAN +} else { + set _ENDIAN little +} + +if { [info exists CPUTAPID ] } { + set _CPUTAPID $CPUTAPID +} else { + # force an error till we get a good number + set _CPUTAPID 0xffffffff +} + +#use combined on interfaces or targets that can't set TRST/SRST separately +reset_config srst_only + +#jtag scan chain +jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID + +# The target +set _TARGETNAME [format "%s.cpu" $_CHIPNAME] +target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi + +$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x4000 -work-area-backup 0 + +flash bank at91sam7 0 0 0 0 0 + +