STM32-p103, Olimex arm-usb-ocd flash problem

Hi,

I am trying to use stm32-p103 for an application. So I got a stm32-

p103 evaluation board and arm-usb-ocd JTAG. I installed the

development software, eclips, + Openocd + arm-eabi-gcc tool chains.

With the tool I tried to do the stm_p103_blink_flash demo. I managed

to compile and link the code. It generated two file main.bin and

main.list. After I setup the openOCD config file. I ran the external

tool from inside of the eclips. I got this message:

Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00

CEST)

The only thing I can see it that the jtag lcd turns yellow from green.

I have waited for 30 minutes. Nothing happened. Anyone know what is

happening?

I have not changed any code from the demo, which I found it from

OpenOCD-projects100, ver 1.0. I connected my arm-usb-ocd using a usb

cable. The JTAG cable is plugged into the development board. The board

gets its power from an other USB to my computer. (It’s power LCD

lights up).

Any suggestions are greatly appreciated.

Everett X. Wang

I got some further after I downloaded a newer version of OpenOCD and run is outside of Eclips. But I still have problem flashing the main.bin into my p103.

software:

window XP

OpenOCD r717 released on 6/19/2008. The main.bin and main.list are from OpenOCD-projects100 for stm_p103. So is the cfg file.

Here is the procedure I used:

in a DOS window I type:

Openocd-ftd2xx –l log.txt –f lpc2xx_armusbocd.cfg

I open an other dos window and type this:

telnet localhost 4444

Open On-chip debugger

flash probe 0

device id = 0x20016410

flash size = 128kbytes

flash ‘stm32x’ found at 0x08000000

flash info 0

#0: stm32x at 0x08000000 …

flash write_bank 0 main.bin 0

not enough working area available<requested 8192, free 8144>

flash write failed with error code: 0xfffffc7a

error writing to flash at address 0x08000000 at offset 0x00000000 <-902>

wrote 4104 byte from main.bin to flash bank 0 at offset 0x00000000 in 0.296875s (13.500000 kb/s)

reset init

Why do I get this “not enough working area” error even though the file has been written into the STM. And the no blinking LED. :frowning:

Here is the content of cfg file:

#daemon configuration

telnet_port 4444

gdb_port 3333

#interface

interface ft2232

ft2232_device_desc “Olimex OpenOCD JTAG A”

ft2232_layout jtagkey

jtag_speed 10

#use combined on interfaces or targets that can’t set TRST/SRST separately

reset_config trst_and_srst

#jtag scan chain

#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)

jtag_device 4 0x1 0xf 0xe

jtag_device 5 0x1 0x1 0x1e

#target configuration

daemon_startup reset

#target

#target cortex_m3

target cortex_m3 little run_and_halt 0

run_and_halt_time 0 30

working_area 0 0x20000000 16384 nobackup

#flash bank <chip_width> <bus_width>

flash bank stm32x 0x08000000 0x00010000 0 0 0

4k working area at base of ram

#working_area 0 0x20000800 0x1200 nobackup

all ram

working_area 0 0x20000000 0x2000 nobackup

For more information about the configuration files, take a look at:

http://openfacts.berlios.de/index-en.phtml?title=Open On-Chip Debugger

The openOCD output this log file:

Info: options.c:50 configuration_output_handler(): jtag_speed: 10, 10

Info: options.c:50 configuration_output_handler(): Open On-Chip Debugger (2008-06-19 19:00) svn: 717

Info: jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x3ba00477 (Manufacturer: 0x23b, Part: 0xba00, Version: 0x3)

Info: jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x16410041 (Manufacturer: 0x020, Part: 0x6410, Version: 0x1)

Info: jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x3ba00477 (Manufacturer: 0x23b, Part: 0xba00, Version: 0x3)

Info: jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x16410041 (Manufacturer: 0x020, Part: 0x6410, Version: 0x1)

Info: server.c:78 add_connection(): accepting ‘telnet’ connection from 0

Info: stm32x.c:631 stm32x_probe(): device id = 0x20016410

Info: stm32x.c:670 stm32x_probe(): flash size = 128kbytes

Warning: target.c:853 target_alloc_working_area(): not enough working area available(requested 8192, free 8144)

Error: stm32x.c:556 stm32x_write(): flash writing failed with error code: 0xfffffc7a

Error: flash.c:103 flash_driver_write(): error writing to flash at address 0x08000000 at offset 0x00000000 (-902)

Info: jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x3ba00477 (Manufacturer: 0x23b, Part: 0xba00, Version: 0x3)

Info: jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x16410041 (Manufacturer: 0x020, Part: 0x6410, Version: 0x1)

User: target.c:957 target_arch_state(): target state: halted

User: armv7m.c:451 armv7m_arch_state(): target halted due to breakpoint, current mode: Handler HardFault

xPSR: 0x21000003 pc: 0x20000026

Hi All,

Any one got an answer for this issue?

I’ve the same problem here and don’t know how to resolve it.

Please help to provide some clues.

Thank you.

Hi,

I just saw your message. Have you got it sorted yet?

When I get to the office I will dig out and post some info that may be helpful.

Here are instructions that worked for me:

http://fun-tech.se/stm32/OpenOCD/gdb.php

Hi,

Thank you for your reply.

I have tried different but similar sample on Linux and it was o.k.

I have tried the stm_p103_blink_flash program under Windows before and got the following:

Open On-Chip Debugger

flash probe 0

device id = 0x10016418

Cannot identify target as a STM32 family.

unknown error when probing flash bank ‘#0’ at

0x08000000

Do you think it is because the OpenOCD came with the Olimix-arm-usb-ocd CD is too old for the stm3210c-eval board? And I need to get the latest version?

I will tried STM32-p103 some time later based on your demo on linux.

You provide a great demo!

Thanks again.