[En-Nut-Discussion] Debug SAM7x256 with Jlink and OpenOCD 0.3.0

Krzysztof Sroczyński k.sroczynski at gmail.com
Fri Mar 12 20:25:01 CET 2010


Hello
I am trying to debug sample application httpd for some time. I did manage to
connect to OpenOCD but i can't load corectly data to SAM7x256.
I am using propox ev. board (http://www.propox.com/products/t_208.html) with
Jlink from ATMEL (SAM-ICE). Configuration file: at91sam7x-ek.conf with
at91sam7x256_rom.ld script init.
I don't know if I have correct code for OpenOCD. Can someone verify this.

JLink driver for OOCD:
#########################################################################################
# daemon configuration
telnet_port 4444
gdb_port 3333
tcl_port 6666

# tell gdb our flash memory map
# and enable flash programming
gdb_memory_map enable
gdb_flash_program enable

interface jlink

# Start slow, speed up after reset
jtag_khz 30

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config srst_only srst_pulls_trst

if { [info exists CHIPNAME] } {
   set  _CHIPNAME $CHIPNAME
} else {
   set  _CHIPNAME sam7x256
}

if { [info exists ENDIAN] } {
   set  _ENDIAN $ENDIAN
} else {
   set  _ENDIAN little
}

if { [info exists CPUTAPID ] } {
   set _CPUTAPID $CPUTAPID
} else {
   set _CPUTAPID 0x3f0f0f0f
}

jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id
$_CPUTAPID

set _TARGETNAME [format "%s.cpu" $_CHIPNAME]

target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position
$_TARGETNAME -variant arm7tdmi

$_TARGETNAME configure -event reset-start {
    #wait_halt
    #sleep 10
    #poll
    # Ethernut 3 remapping is required to access external flash memory.
    #mww 0xffe00000 0x1000212d
    #mww 0xffe00004 0x20003025
    #mww 0xffe00008 0x21002026
    #mww 0xffe00010 0x22002e3e
    #mww 0xffe00020 0x00000001
    jtag_khz 6000
}

$_TARGETNAME configure -event reset-init {
    # disable watchdog
    mww 0xfffffd44 0x00008000
    # enable user reset
    mww 0xfffffd08 0xa5000001
    # CKGR_MOR : enable the main oscillator
    mww 0xfffffc20 0x00000601
    sleep 10
    # CKGR_PLLR: 96.1097 MHz
    mww 0xfffffc2c 0x00481c0e
    sleep 10
    # PMC_MCKR : MCK = PLL / 2 ~= 48 MHz
    mww 0xfffffc30 0x00000007
    sleep 10
    # MC_FMR: flash mode (FWS=1,FMCN=60)
    mww 0xffffff60 0x003c0100
    sleep 100

    wait_halt
    sleep 10
    poll
    # Ethernut 3 remapping is required to access external flash memory.
    mww 0xffe00000 0x1000212d
    mww 0xffe00004 0x20003025
    mww 0xffe00008 0x21002026
    mww 0xffe00010 0x22002e3e
    mww 0xffe00020 0x00000001

    jtag_khz 6000
}

$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x00200000
-work-area-size 0x4000 -work-area-backup 0

#flash bank <driver> <base_addr> <size> <chip_width> <bus_width>
<target_number> [<target_name> <banks> <sectors_per_bank> <pages_per_sector>
<page_size> <num_nvmbits> <ext_freq_khz>]
#flash bank at91sam7 0 0 0 0 0 0 0 0 0 0 0 0 18432
#flash bank cfi 0x10000000 0x400000 2 2 0


init

reset init
#########################################################################################

Debug command for Zylin plugin in Eclipse:

#########################################################################################
target remote localhost:3333
monitor reset init
monitor sleep 500
monitor poll
monitor soft_reset_halt

# WDT_MR, disable watchdog
monitor mww 0xFFFFFD44 0x00008000

# RSTC_MR, enable user reset
monitor mww 0xfffffd08 0xa5000001

# CKGR_MOR
monitor mww 0xFFFFFC20 0x00000601
monitor sleep 10

# CKGR_PLLR
monitor mww 0xFFFFFC2C 0x00481c0e
monitor sleep 10

# PMC_MCKR
monitor mww 0xFFFFFC30 0x00000007
monitor sleep 10

# PMC_IER
monitor mww 0xFFFFFF60 0x00480100
monitor sleep 100

# Ethernut 3 remapping is required to access external flash memory.
monitor mww 0xffe00000 0x1000212d
monitor mww 0xffe00004 0x20003025
monitor mww 0xffe00008 0x21002026
monitor mww 0xffe00010 0x22002e3e
monitor mww 0xffe00020 0x00000001

# needed for gdb 6.8 and higher
set mem inaccessible-by-default off

load
break main
continue
#########################################################################################

At main i got that result: Unable to set 32 bit software breakpoint at
address 00000de8 - check that memory is read/writable.
Inside JLink driver i have comment part with flash bank (I don't know if is
necessary)
I am working with large project with Nut/OS (FatFS filesystem with AT45DB)
but without debug I can't locate bugs...
-- 
Best regards!
Krzysztof Sroczynski



More information about the En-Nut-Discussion mailing list