Hi there,
First off I’m new to Arms, though I have a reasonable amount of experience programming AVRs.
I recently purchased an Olimex ARM-USB-OCD as it seemed to kill two birds with one stone, JTAG and serial port for debug.
However I’m having problems getting openocd to program my chip (AT91SAM7s256).
My config script is as follows :
#define our ports
telnet_port 4444
gdb_port 3333
#commands specific to the Amontec JTAGKey
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 2
jtag_nsrst_delay 200
jtag_ntrst_delay 200
#reset_config <signals> [combination] [trst_type] [srst_type]
reset_config srst_only srst_pulls_trst
#jtag_device <IR length> <IR capture> <IR mask> <IDCODE instruction>
jtag_device 4 0x1 0xf 0xe
#daemon_startup <'attach'|'reset'>
daemon_startup reset
#target <type> <endianess> <reset_mode> <jtag#> [variant]
target arm7tdmi little run_and_init 0 arm7tdmi_r4
#run_and_halt_time <target#> <time_in_ms>
run_and_halt_time 0 30
My prgramming script is this :
# OpenOCD Target Script for Atmel AT91SAM7S256
#
# Programmer: James P Lynch
#
# halt the processor and wait
wait_halt
# select the core state
armv4_5 core_state arm
# set flash wait state (AT91C_MC_FMR)
mww 0xffffff60 0x00320100
# watchdog disable (AT91C_WDTC_WDMR)
mww 0xfffffd44 0xa0008000
# enable main oscillator (AT91C_PMC_MOR)
mww 0xfffffc20 0xa0000601
# wait 100 ms
wait 100
# set PLL register (AT91C_PMC_PLLR)
mww 0xfffffc2c 0x00480a0e
# wait 200 ms
wait 200
# set master clock to PLL (AT91C_PMC_MCKR)
mww 0xfffffc30 0x7
# wait 100 ms
wait 100
# enable user reset AT91C_RSTC_RMR
mww 0xfffffd08 0xa5000401
# program the onchip flash
flash write 0 getting-started-project-at91sam7s-ek-at91sam7s256-flash.bin 0x0
# reset processor
reset
# stop OpenOCD
shutdown
however when I try and program the chip I always get the error “flash write command write not found”
See dump from telnet session
Open On-Chip Debugger
> wait_halt
>
> armv4_5 core_state arm
core state: ARM
>
> mww 0xffffff60 0x00320100
>
> mww 0xfffffd44 0xa0008000
>
> mww 0xfffffc20 0xa0000601
>
> wait 100
>
> mww 0xfffffc2c 0x00480a0e
>
> wait 200
>
> mww 0xfffffc30 0x7
>
> wait 100
>
> mww 0xfffffd08 0xa5000401
>
> flash write 0 getting-started-project-at91sam7s-ek-at91sam7s256-flash.bin 0x0
Command write not found
>
> reset
JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)
target state: halted
target halted in ARM state due to debug request, current mode: Supervisor
cpsr: 0x60000053 pc: 0x00100268
>
> shutdown
Connection to host lost.
What am I doing wrong ?
Cheers.
Phill.