Occasional problem with OpenOCD after programming the FLASH

Hello,

I’m using the OpenOCD to debug and program the flash of my AT91SAM7S128 MCU.

From time to time, lets say 90% of the cases, I got the following output info from the OCD:

Programming with OPENOCD

cp FIR0AEUEVMLX.bin main.bin

…........\Products\DemoBoards\Software\Library_ARM\OpenOCD\openocd_at91sam7s_flash.cmd -usb_port

Info: openocd.c:84 main(): Open On-Chip Debugger (2007-01-31 12:00 CET)

Warning: arm7_9_common.c:683 arm7_9_assert_reset(): srst resets test logic, too

Info: target.c:223 target_init_handler(): executing reset script ‘…........\Products\DemoBoards\Software\Library_ARM\OpenOCD\openocd_at91sam7s_flash.script’

Info: configuration.c:50 configuration_output_handler(): target state: halted

Info: configuration.c:50 configuration_output_handler(): target halted in ARM state due to debug request, current mode: Supervisor

Info: configuration.c:50 configuration_output_handler(): cpsr: 0x600000d3 pc: 0x00100e78

Info: configuration.c:50 configuration_output_handler(): dcc downloads are enabled

Info: configuration.c:50 configuration_output_handler(): successfully checked protect state

Info: configuration.c:50 configuration_output_handler(): cleared protection for sectors 0 through 7 on flash bank 0

Info: configuration.c:50 configuration_output_handler(): erased sectors 0 through 7 on flash bank 0 in 0s 50072us

Info: configuration.c:50 configuration_output_handler(): #1: at91sam7 at 0x00100000, size 0x00020000, buswidth 4, chipwidth 0

Info: configuration.c:50 configuration_output_handler():

Info: configuration.c:50 configuration_output_handler(): at91sam7 information: Chip is AT91SAM7S128

Info: configuration.c:50 configuration_output_handler(): cidr: 0x270c0740, arch: 0x0070, eproc: ARM7TDMI, version:0x000, flashsize: 0x00020000

Info: configuration.c:50 configuration_output_handler(): master clock(estimated): 51298kHz

Info: configuration.c:50 configuration_output_handler(): pagesize: 256, lockbits: 8 0x0000, pages in lock region: 64

Info: configuration.c:50 configuration_output_handler(): securitybit: 0, nvmbits: 0x3

Info: configuration.c:50 configuration_output_handler():

Info: configuration.c:50 configuration_output_handler(): wrote file main.bin to flash bank 0 at offset 0x00000000 in 1s 211742us

Error: arm7_9_common.c:561 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
Error: arm7_9_common.c:561 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
Warning: arm7_9_common.c:1798 arm7_9_read_memory(): memory read caused data abort (address: 0xffffff68, size: 0x4, count: 0x1)
Error: arm7_9_common.c:561 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
Warning: arm7_9_common.c:1798 arm7_9_read_memory(): memory read caused data abort (address: 0xffffff68, size: 0x4, count: 0x1)
Error: arm7_9_common.c:561 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
Warning: arm7_9_common.c:1798 arm7_9_read_memory(): memory read caused data abort (address: 0xfffffc24, size: 0x4, count: 0x1)
Error: arm7_9_common.c:561 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
Warning: arm7_9_common.c:1798 arm7_9_read_memory(): memory read caused data abort (address: 0xfffffc30, size: 0x4, count: 0x1)
Error: arm7_9_common.c:561 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
Warning: arm7_9_common.c:1798 arm7_9_read_memory(): memory read caused data abort (address: 0xfffffc2c, size: 0x4, count: 0x1)
Warning: arm7_9_common.c:1963 arm7_9_write_memory(): memory write caused data abort (address: 0xffffff60, size: 0x4, count: 0x1)

Warning: arm7_9_common.c:683 arm7_9_assert_reset(): srst resets test logic, too

rm main.bin

Sometimes I have to wat a little bit more, sometimes not, but the flash is always programmed.

I’m using this CFG file:

#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

jtag_nsrst_delay 200

jtag_ntrst_delay 200

#use combined on interfaces or targets that can’t set TRST/SRST separately

#reset_config [combination] [trst_type] [srst_type]

reset_config srst_only srst_pulls_trst

#jtag scan chain

#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)

#jtag_device

jtag_device 4 0x1 0xf 0xe

#target configuration

#Tells the OpenOCD whether it should reset the target when the daemon is launched, or if it should just attach to the target.

#daemon_startup <‘attach’|‘reset’>

daemon_startup reset

#target arm7tdmi <reset_mode> <jtag#> [variant]

target arm7tdmi little run_and_init 0 arm7tdmi

#run_and_halt_time <target#> <time_in_ms>

run_and_halt_time 0 30

flash-options AT91

#target_script 0 reset …\Library_ARM\OpenOCD\openocd_at91sam7s_flash.script

target_script 0 reset …........\Products\DemoBoards\Software\Library_ARM\OpenOCD\openocd_at91sam7s_flash.script

#working_area <target#> <‘backup’|‘nobackup’>

working_area 0 0x00200000 0x4000 nobackup

#flash bank <chip_width> <bus_width> [driver_options …]

flash bank at91sam7 0 0 0 0 0

and this script file:

#halt

#sleep 10

Init - taken form the script openocd_at91sam7_ecr.script

mww 0xfffffd44 0x00008000 # disable watchdog

mww 0xfffffd08 0xa5000001 # enable user reset

mww 0xfffffc20 0x00000601 # CKGR_MOR : enable the main oscillator

sleep 10

mww 0xfffffc2c 0x00481c0e # CKGR_PLLR: 96.1097 MHz

sleep 10

mww 0xfffffc30 0x00000007 # PMC_MCKR : MCK = PLL / 2 ~= 48 MHz

sleep 10

mww 0xffffff60 0x003c0100 # MC_FMR: flash mode (FWS=1,FMCN=60)

arm7_9 force_hw_bkpts enable # program resides in flash

AT91SAM7 flash command-“batch”

adapted by Martin Thomas based on information from Dominic Rath - Thanks

modified by DAL

poll

#flash probe 0

#flash info 0

arm7_9 dcc_downloads enable

sleep 10

flash protect_check 0

flash protect 0 0 7 off

sleep 10

flash erase 0 0 7

sleep 10

#flash probe 0

flash info 0

flash write 0 main.bin 0x0

at91sam7 gpnvm 0 0 set

at91sam7 gpnvm 0 1 set

reset run

sleep 10

shutdown

Does somebody knows why this could happen?

It is not a big problem, but it bugs me.

Sorry for the big post :frowning:

Thanks in advance!