Hi,
I have recently bought an Olimex ARM-USB-OCD and Olimex AT91SAM7x256. Then I try to follow the tutorial from James Lynch (titled AT91SAM7 Serial Communication), which I think is very well written.
I use the following for my setup:
-
WindowsXP Service Pack 3
-
OpenOCD SVN 1888 (from Yagarto website, before it was removed recently).
-
Yagarto tools (binutils: 2.19.1, gcc: 4.3.3, newlib: 1.17.0, gdb: 6.8.50-20080308-cvs).
-
Eclipse 3.4.2 that is updated with CDT 5.0.1 and Zylin Embedded 4.7.1
-
Olimex ARM-USB-OCD and Olimex AT91SAM7x256.
Output of Make with Eclipse looks like this…
**** Build of configuration Default for project demo_sam7ex256 ****
make all
arm-elf-as -mapcs-32 -g -o crt.o crt.s
arm-elf-gcc -mcpu=arm7tdmi -I./ -c -fno-common -O0 -g -fomit-frame-pointer -Wcast-align -c -o main.o main.c
arm-elf-gcc -mcpu=arm7tdmi -I./ -c -fno-common -O0 -g -fomit-frame-pointer -Wcast-align -c -o lowlevelinit.o lowlevelinit.c
arm-elf-gcc -mcpu=arm7tdmi -I./ -c -fno-common -O0 -g -fomit-frame-pointer -Wcast-align -c -o usart0_setup.o usart0_setup.c
arm-elf-gcc -mcpu=arm7tdmi -I./ -c -fno-common -O0 -g -fomit-frame-pointer -Wcast-align -c -o usart0_isr.o usart0_isr.c
arm-elf-gcc -mcpu=arm7tdmi -I./ -c -fno-common -O0 -g -fomit-frame-pointer -Wcast-align -c -o isrsupport.o isrsupport.c
…linking
arm-elf-ld -v -omain.out -Tdemo_sam7ex256.cmd -Map main.map --cref -omain.out crt.o main.o lowlevelinit.o usart0_setup.o usart0_isr.o isrsupport.o libgcc.a
GNU ld (GNU Binutils) 2.19.1
…create binary file
arm-elf-objcopy --output-target=binary main.out main.bin
…create dump file
arm-elf-objdump -x --syms main.out > main.dmp
However, when I setup the second make target for flash programming, following the tutorial from James, I run into several problems. Mostly are related to deprecated commands in OpenOCD configuration files. In the tutorial, there two *.cfg file, the openocd_program.cfg and the openocd.cfg.
After reading the OpenOCD document and tweaking the files, I have the following results for the target build…
**** Build of configuration Default for project demo_sam7ex256 ****
make program
Flash Programming with OpenOCD…
'C:/Program Files/openocd-r1888/bin/'openocd-ftd2xx.exe -s ‘C:/Program Files/openocd-r1888/bin/’ -f openocd_program.cfg # program the onchip FLASH here
Open On-Chip Debugger 0.2.0-in-development (2009-05-23-14:36) svn:1888M
(snapshot 1888 from SVN tree + patch, no official release)
BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
2000 kHz
Unknown command: reset run
make: *** [program] Error 1
My openocd_program.cfg (updated from James’ version) looks like
telnet_port 4444
gdb_port 3333
interface ft2232
ft2232_device_desc “Olimex OpenOCD JTAG A”
ft2232_layout “olimex-jtag”
ft2232_vid_pid 0x15BA 0x0003
jtag_khz 2000
jtag_nsrst_delay 200
jtag_ntrst_delay 200
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_r4
#run_and_halt_time <target#> <time_in_ms>
#run_and_halt_time 0 30 deprecated
reset run
sleep 100
halt
commands below are specific to AT91sam7 Flash Programming
---------------------------------------------------------
#$_TARGETNAME configure -event reset-init “script script.ocd”
$_TARGETNAME configure -work-area-phys 0x00200000 -work-area-size 0x4000 -work-area-backup 0
#flash bank at91sam7 0 0 0 0 <target#>
flash bank at91sam7 0 0 0 0 0
init
reset halt
Now the questions…
-
According to OpenOCd manual, I should replace run_and_halt_time 0 30 with the reset run, sleep 100 and halt. I may not be doing it right, since the target build failed on the “reset run”. Can anybody please shed some lights on this?
-
The “daemon_startup reset” is also deprecated and can be replaced with init and reset halt. Have I placed it at the right spot?
-
Calling the script.ocd was done using event handler, have I used the correct event name? Notice that I used reset-init for event name.
Thank you very much for your time to look at my posting. I appreciate any feedback or directions that any of you may give me.
Chris