SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By sd_tom
#182191
Ok i'm trying to use OpenOCD within VisualGDB (I don't think this is a visualGDB thing just yet, short of not being able to upgrade to 0.9.0 just yet). This is with a STM32F103RE (64k RAM, 512KB ROM) I have an image i'm trying to debug. It is offset 0x3000; bringing that up just in case.. openocd logs seem to recognize it though, just not working. I can flash the image via the stlink utility, works fine. Any thoughts? Is this something that would improve with 0.9.0?

Command Line:
openocd.exe -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg -c init -c "reset init"

Log:
Code: Select all
Open On-Chip Debugger 0.8.0 (2014-05-02-12:11)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v23 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.205243
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080028d0 msp: 0x20000a30
Info : accepting 'gdb' connection from 3333
Info : device id = 0x10036414
Info : flash size = 512kbytes
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080028d0 msp: 0x20000a30
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080028d0 msp: 0x20000a30
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080028d0 msp: 0x20000a30
Info : Padding image section 0 with 4 bytes
Info : Padding image section 1 with 412852 bytes
Error: flash write algorithm aborted by target
Error: flash write failed at address 0x801b002
Error: flash memory not erased before writing
Error: error writing to flash at address 0x08000000 at offset 0x00003000
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (2990). Wo
rkaround: increase "set remotetimeout" in GDB
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080028d0 msp: 0x20000a30

Scripts (standard i think / unless visualgdb guys changed):


stlink-v2.cfg
Code: Select all
#
# STMicroelectronics ST-LINK/V2 in-circuit debugger/programmer
#

interface hla
hla_layout stlink
hla_device_desc "ST-LINK/V2"
hla_vid_pid 0x0483 0x3748
stm32f1x_stlink.cfg
Code: Select all
#
# STM32f1x stlink pseudo target
#

if { [info exists CHIPNAME] == 0 } {
   set CHIPNAME stm32f1x
}

if { [info exists CPUTAPID] == 0 } {
   set CPUTAPID 0x1ba01477
}

if { [info exists WORKAREASIZE] == 0 } {
   set WORKAREASIZE 0x1000
}

source [find target/stm32_stlink.cfg]

set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME stm32f1x 0 0 0 0 $_TARGETNAME
stm32_stlink.cfg
Code: Select all
#
# stm32 stlink pseudo target
#

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

# Work-area is a space in RAM used for flash programming
# By default use 4kB (as found on some STM32F100s)
if { [info exists WORKAREASIZE] } {
   set _WORKAREASIZE $WORKAREASIZE
} else {
   set _WORKAREASIZE 0x1000
}

if { [info exists CPUTAPID] } {
   set _CPUTAPID $CPUTAPID
} else {
   # this is the SW-DP tap id not the jtag tap id
   set _CPUTAPID 0x1ba01477
}

if { [info exists TRANSPORT] } {
   set _TRANSPORT $TRANSPORT
   if { $TRANSPORT == "hla_jtag" } {
      if { [info exists CPUTAPID] == 0 } {
         # jtag requires us to use the jtag tap id
         set _CPUTAPID 0x3ba00477
      }
   }
} else {
   set _TRANSPORT hla_swd
}

# add deprecated transport name check
if { $_TRANSPORT == "stlink_swd" } {
	set _TRANSPORT "hla_swd"
	echo "DEPRECATED! use 'hla_swd' transport not 'stlink_swd'"
}

if { $_TRANSPORT == "stlink_jtag" } {
	set _TRANSPORT "hla_jtag"
	echo "DEPRECATED! use 'hla_jtag' transport not 'stlink_jtag'"
}
# end deprecated checks

#
# possibles value are hla_swd or hla_jtag
#
transport select $_TRANSPORT

hla newtap $_CHIPNAME cpu -expected-id $_CPUTAPID

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME hla_target -chain-position $_TARGETNAME

$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
By sd_tom
#182234
Ok somehow it went away. Changing too many variables to know for sure:
- upgraded to 0.9.0
- borrowed 0.9.0 nucleo-f103 scripts
- increased working space
- went to true stlink driver (got rid of winusb)
- erased the chip and replaced boot loader with st link utility (st link wasn't recognized by utility with other driver)
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]