Command line programming

Hi all,

I’m trying to flash an image using OpenOCD via the command line…

It works with commands issued through telnet 4444, but fails with the same commands supplied via -f file.cfg on the command line (and -c options fail in the same way too).

This is using OpenOCD 0.4.0 pre-compiled binaries from http://www.freddiechopin.info/

I’m new to OpenOCD, and copied the commands from a HowTo I found. Can anyone tell me if the error is a bug or did I do something wrong?

Thanks.

D:\tmp>type arm-usb-ocd.cfg
#
# Olimex ARM-USB-OCD
#
# http://www.olimex.com/dev/arm-usb-ocd.html
#

interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003


D:\tmp>type olimex_stm32_h103.cfg
# Olimex STM32-H103 eval board
# http://olimex.com/dev/stm32-h103.html

# Work-area size (RAM size) = 20kB for STM32F103RB device
set WORKAREASIZE 0x5000

source [find target/stm32.cfg]

D:\tmp>type main.cfg
reset halt
flash probe 0
stm32x mass_erase 0
flash write_bank 0 main.bin 0
reset halt

D:\tmp>openocd -f arm-usb-ocd.cfg -f olimex_stm32_h103.cfg -f main.cfg
Open On-Chip Debugger 0.4.0 (2010-02-22-19:05)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.berlios.de/doc/doxygen/bugs.html
1000 kHz
jtag_nsrst_delay: 100
jtag_ntrst_delay: 100
Runtime error, file "main.cfg", line 1:                                      <<------ *** THE ERROR ***
    invalid command name "reset"

D:\tmp>openocd -f arm-usb-ocd.cfg -f olimex_stm32_h103.cfg
Open On-Chip Debugger 0.4.0 (2010-02-22-19:05)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.berlios.de/doc/doxygen/bugs.html
1000 kHz
jtag_nsrst_delay: 100
jtag_ntrst_delay: 100
Info : clock speed 1000 kHz
Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba0
0, ver: 0x3)
Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410
, ver: 0x1)
Info : stm32.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection from 0
Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba0
0, ver: 0x3)
Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410
, ver: 0x1)
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000010 msp: 0x20000800
Info : device id = 0x20036410
Info : flash size = 128kbytes
flash 'stm32x' found at 0x08000000
stm32x mass erase complete
wrote 4052 bytes from file main.bin to flash bank 0 at offset 0x00000000 in 0.50
0000s (7.914 kb/s)
Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba0
0, ver: 0x3)
Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410
, ver: 0x1)
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000010 msp: 0x20000800

Cut-n-paste from telnet session :-

Open On-Chip Debugger
> reset halt
JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000010 msp: 0x20000800
> flash probe 0
device id = 0x20036410
flash size = 128kbytes
flash 'stm32x' found at 0x08000000
> stm32x mass_erase 0
stm32x mass erase complete
> flash write_bank 0 main.bin 0
wrote 4052 bytes from file main.bin to flash bank 0 at offset 0x00000000 in 0.500000s (7.914 kb/s)
> reset halt
JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000010 msp: 0x20000800
>

https://lists.berlios.de/pipermail/open … 15349.html

4/3!!