olimex AT91sams256 + ARM-USB-TINY unable to debug from RAM

Hi,

I am using Olimex ARM-USB-TINY for debugging. I installed the yogarto toolchain with the help of the .exe supplied with the ARM-USB-TINY cd. I am able to run the flash version of the example project given for my board with AT91sam7s256. But there is no project to run from RAM. So I followed James P. Lynch’s tutorial and downloaded the example projects for olimex AT91sams64 and modified as mentioned by the author for sam256. Although the project builds with few quirks but I am unable to debug it. :frowning:

Modifications to build-

  • I use sam7flash.script instead of script.ocd as supplied with tutorial since I got a build error which asked for this file. I do not know how to specify script.ocd instead of sam7flash.script.

  • I Added armusbocd_tiny.cfg and armusbocd.cfg which must be present in the project directory for the toolcain to work

Following Peter’s tutorial I created debug launch configuration for debugging from RAM as:

Initialize command:

“target remote localhost:3333

Run command:

monitor soft_reset_halt
monitor armv4_5 core_state arm
monitor mww 0xffffff60 0x00320100
monitor mww 0xfffffd44 0xa0008000
monitor mww 0xfffffc20 0xa0000601
monitor wait 100
monitor mww 0xfffffc2c 0x00480a0e
monitor wait 200
monitor mww 0xfffffc30 0x7
monitor wait 100
monitor mww 0xfffffd08 0xa5000401
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
monitor mww 0xfffffd00 0xa5000004
monitor mww 0xffffff00 0x01
monitor reg pc 0x00000000
monitor arm7_9 sw_bkpts enable
load
continue

Now when I launch debug configuration it gives following output in console:

target remote localhost:3333
0x0000080c in ?? ()
Warning: /cygdrive/C/gccfd/projects/demo_at91sam7_p64_blink_ram: No such file or directory.
monitor soft_reset_halt
requesting target halt and executing a soft reset
monitor armv4_5 core_state arm
core state: ARM
monitor mww 0xffffff60 0x00320100
memory write caused data abort (address: 0xffffff60, size: 0x4, count: 0x1)
monitor mww 0xfffffd44 0xa0008000
monitor mww 0xfffffc20 0xa0000601
monitor wait 100
monitor mww 0xfffffc2c 0x00480a0e
monitor wait 200
monitor mww 0xfffffc30 0x7
monitor wait 100
monitor mww 0xfffffd08 0xa5000401
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
monitor mww 0xfffffd00 0xa5000004
monitor mww 0xffffff00 0x01
monitor reg pc 0x00000000
pc (/32): 0x00000000
monitor arm7_9 sw_bkpts enable
software breakpoints enabled
load
Loading section .text, size 0xf48 lma 0x200000
Loading section .data, size 0x44c lma 0x200f48
Start address 0x200000, load size 5012
Transfer rate: 10 KB/sec, 835 bytes/write.
continue

It hangs after that and shows "launching 27% progress

Can anybody suggest me how to make it work.

Regards

Rohit

Hi again,

I thought it’d be better to provide experts with complete details so please find the two files

sam7flash.script - Used in project:

# 
# The following command wills be executed on
# reset (because of run_and_init in the config-file)
# - halt target
# - init ecr
# - flash content of file main.bin into target-memory
# - shutdown openocd
#
# created by Martin Thomas 
# http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects
# based on information from Dominic Rath 
#

halt
sleep 10
wait_halt

# 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"
arm7_9 dcc_downloads enable
wait_halt
armv4_5 core_state arm
flash probe 0
flash info 0
flash protect 0 0 15 off
at91sam7 gpnvm 0 2 set
flash erase_sector 0 0 0
#flash protect 0 0 1 off
flash write_image main.bin 0x00100000

and script.ocd - removed from project:

wait_halt							# halt the processor and wait
armv4_5 core_state arm				# select the core state
mww 0xffffff60 0x00320100			# set flash wait state (AT91C_MC_FMR)
mww 0xfffffd44 0xa0008000			# watchdog disable (AT91C_WDTC_WDMR)
mww 0xfffffc20 0xa0000601			# enable main oscillator (AT91C_PMC_MOR)
wait 100							# wait 100 ms
mww 0xfffffc2c 0x00480a0e			# set PLL register (AT91C_PMC_PLLR)
wait 200							# wait 200 ms
mww 0xfffffc30 0x7					# set master clock to PLL (AT91C_PMC_MCKR)
wait 100							# wait 100 ms
mww 0xfffffd08 0xa5000401			# enable user reset AT91C_RSTC_RMR
flash write 0 main.bin 0x0			# program the onchip flash
reset								# reset processor
shutdown							# stop OpenOCD

Regards

Rohit