OpenOCD/GDB AT91SAM7

I’m stumped trying to get things working on a Olimex AT91SAM7-P256

evaluation board.

Here’s the setup:

  • Olimex SAM7-Pxxx evaluation board

  • ARM-USB-TINY JTAG

  • Using OpenOCD 0.3.1 2009-11-13

  • Running YAGARTO

(yagarto-bu-2.20_gcc-4.4.2-c-c++_nl-1.18.0_gdb-7.0.1_20091223.exe)

I’m trying to get the example blinker program from Peter Lynch’s

tutorial running (that tutorial is quite old). It looks like OpenOCD

has been extensively modified.

I’m able to compile and link the example.

I’m able to run OpenOCD.

I’m able to run GDB and load the file and run to a break point placed at

the start of main().

However, when I get there, the program doesn’t seem to really modify any

of the memory. For example, there is a variable that is in memory

location 0xfe20. I try to set that variable to some value and it always

ends up reading back -1.

Here is the script that I’m using for gdb:

#copy this to the init command box in Eclipse Gdb settings

target remote localhost:3333

monitor reset

monitor sleep 500

monitor poll

monitor soft_reset_halt

#monitor arm7_9 sw_bkpts enable

monitor gdb_breakpoint_override hard

select the core state

monitor armv4_5 core_state arm

WDT_MR, disable watchdog

monitor mww 0xFFFFFD44 0xa0008000

RSTC_MR, enable user reset

monitor mww 0xfffffd08 0xa5000401

CKGR_MOR

monitor mww 0xFFFFFC20 0x00000601

monitor sleep 100

CKGR_PLLR

monitor mww 0xFFFFFC2C 0x00480a0e

monitor sleep 200

PMC_MCKR

monitor mww 0xFFFFFC30 0x00000007

monitor sleep 100

PMC_IER, set flash wait state (AT91C_MC_FMR)

monitor mww 0xffffff60 0x00320100

monitor sleep 100

#Go ahead

load

break main

continue

When doing “load” do not ever use “soft_reset_halt” command in OpenOCD - replace that with “reset halt” and it should work fine. When you debug a program flashed previously (so no “load” in the commands) use soft_reset_halt as you do now.

4/3!!