SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By lcharpen
#171803
Hi

Does anyone has the chance to use openocd with new nucleo stm32l053?
The idea is to use stlink v2 to flash your binary under linux env.
My current status is that I can correctly connect to the slink target.
Then flashing is not possible.

I am currently modifing openocd t add the support of the cpuid but if someone has already done the job it would be great ;)!

Thanks

Ludovic
By lcharpen
#171839
Hi again

There's no more JTAG on Nucleo stm32l053. It uses SWD only.
During the flahing procedure I can see:

"target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x08000f70 msp: 0x20000478
STM32L: Enabling HSI
Info : STM32L flash size is 64kb, base address is 0x8000000
erased sectors 0 through 15 on flash bank 0 in 0.368820s
Error: jtag status contains invalid mode value - communication failure
Polling target stm32lx.cpu failed, GDB will be halted. Polling again in 100ms
Warn : couldn't use loader, falling back to page memory writes
wrote 12519 bytes from file hello-world.bin in 0.419905s (29.115 KiB/s)
Error: JTAG failure
Error: JTAG failure"

Does it mean that it is using JTAG?

I forced th use of swd in my cfg file.

Thanks

Ludovic
By lcharpen
#171844
I also changed clock to use MSI instaed of HSI

in stm32lx_stlink.cfg:

#
# STM32lx stlink pseudo target
#

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

if { [info exists CPUTAPID] == 0 } {
set CPUTAPID 0x0bc11477
#set CPUTAPID 0x2ba01477
}

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

source [find stm32_stlink.cfg]

# Flash base address is known by driver. Flash size will be probed.
#
# Please note that the larger stm32lx targets (256Kb and 384Kb) uses dual
# bank flash. For such targets use target/stm32lx_dual_bank.cfg.
#
# Some samples of ST's stm32lx chips are known to have incorrect flash size
# values programmed in their FLASH_SIZE register. The driver will warn
# for strange values. It is possible to override the flash size probe by
# defining the correct size here. Notice though that it is the size of
# the flash bank
#
# flash bank stm32lx <base> <size> 0 0 <target#> <variant>
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME stm32lx 0 0 0 0 $_TARGETNAME

proc stm32l_enable_MSI {} {
# Enable MSI as clock source
echo "STM32L: Enabling MSI"

# Set MSI in RCC_CR
mww 0x40021000 0x00000010

# Set MSI as SYSCLK
mww 0x4002100C 0x00000000
}

$_TARGETNAME configure -event reset-init {
stm32l_enable_MSI
}


More logs when trying to load an vrify the image:

Open On-Chip Debugger 0.8.0 (2014-05-23-18:50)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
target is stm32l
using hla_swd
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v20 API v2 SWIM v4 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.249641
Info : stm32l.cpu: hardware has 4 breakpoints, 2 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x08000f70 msp: 0x20000478
STM32L: Enabling MSI
Info : STM32L flash size is 64kb, base address is 0x8000000
erased sectors 0 through 15 on flash bank 0 in 0.369260s
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l.cpu failed, GDB will be halted. Polling again in 100ms
Warn : couldn't use loader, falling back to page memory writes
wrote 12519 bytes from file hello-world.bin in 0.333790s (36.627 KiB/s)
Error: JTAG failure
Error: JTAG failure
Error: timed out while waiting for target halted
target state: halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x01000003 pc: 0xfffffffe msp: 0x20000478
Error: error executing cortex_m crc algorithm
Error: checksum mismatch - attempting binary compare
diff 0 address 0x08000000. Was 0x78 instead of 0xff
diff 1 address 0x08000001. Was 0x04 instead of 0x1f
diff 2 address 0x08000004. Was 0x71 instead of 0xdd
diff 3 address 0x08000005. Was 0x0f instead of 0x0a
diff 4 address 0x08000008. Was 0xe3 instead of 0x29
diff 5 address 0x08000009. Was 0x08 instead of 0x0b
diff 6 address 0x0800000c. Was 0xe7 instead of 0x29
diff 7 address 0x0800000d. Was 0x08 instead of 0x0b
diff 8 address 0x0800002c. Was 0x37 instead of 0x29
diff 9 address 0x0800002d. Was 0x0e instead of 0x0b
diff 10 address 0x08000030. Was 0x27 instead of 0x29
diff 11 address 0x08000031. Was 0x0f instead of 0x0b
diff 12 address 0x08000038. Was 0x4f instead of 0x29
diff 13 address 0x08000039. Was 0x0f instead of 0x0b
diff 14 address 0x0800003c. Was 0x1b instead of 0x55
diff 15 address 0x0800003d. Was 0x0f instead of 0x10
diff 16 address 0x08000040. Was 0x5b instead of 0x29
diff 17 address 0x08000041. Was 0x0f instead of 0x0b
diff 18 address 0x08000044. Was 0x8d instead of 0x29
diff 19 address 0x08000045. Was 0x0f instead of 0x0b
diff 20 address 0x08000048. Was 0x8f instead of 0x29
diff 21 address 0x08000049. Was 0x0f instead of 0x0b
diff 22 address 0x0800004c. Was 0x91 instead of 0x29
diff 23 address 0x0800004d. Was 0x0f instead of 0x0b
diff 24 address 0x08000050. Was 0x93 instead of 0x29
diff 25 address 0x08000051. Was 0x0f instead of 0x0b
diff 26 address 0x08000054. Was 0x95 instead of 0x29
diff 27 address 0x08000055. Was 0x0f instead of 0x0b
diff 28 address 0x08000058. Was 0x97 instead of 0x29
diff 29 address 0x08000059. Was 0x0f instead of 0x0b
diff 30 address 0x0800005c. Was 0x99 instead of 0x29
diff 31 address 0x0800005d. Was 0x0f instead of 0x0b
diff 32 address 0x08000060. Was 0x9b instead of 0x29
diff 33 address 0x08000061. Was 0x0f instead of 0x0b
diff 34 address 0x08000064. Was 0x9d instead of 0x29
diff 35 address 0x08000065. Was 0x0f instead of 0x0b
diff 36 address 0x08000068. Was 0x9f instead of 0x29
diff 37 address 0x08000069. Was 0x0f instead of 0x0b
diff 38 address 0x0800006c. Was 0xa1 instead of 0x29
diff 39 address 0x0800006d. Was 0x0f instead of 0x0b
diff 40 address 0x08000070. Was 0xa3 instead of 0x29
diff 41 address 0x08000071. Was 0x0f instead of 0x0b
diff 42 address 0x08000074. Was 0xa5 instead of 0x29
diff 43 address 0x08000075. Was 0x0f instead of 0x0b
diff 44 address 0x0800007c. Was 0xa7 instead of 0x29
diff 45 address 0x0800007d. Was 0x0f instead of 0x0b
diff 46 address 0x08000084. Was 0xa9 instead of 0x29
diff 47 address 0x08000085. Was 0x0f instead of 0x0b
diff 48 address 0x08000090. Was 0xab instead of 0x29
diff 49 address 0x08000091. Was 0x0f instead of 0x0b
diff 50 address 0x08000098. Was 0x0d instead of 0x29
diff 51 address 0x08000099. Was 0x0f instead of 0x0b
diff 52 address 0x0800009c. Was 0xad instead of 0x29
diff 53 address 0x0800009d. Was 0x0f instead of 0x0b
diff 54 address 0x080000a0. Was 0xaf instead of 0x29
diff 55 address 0x080000a1. Was 0x0f instead of 0x0b
diff 56 address 0x080000a4. Was 0xb1 instead of 0x29
diff 57 address 0x080000a5. Was 0x0f instead of 0x0b
diff 58 address 0x080000a8. Was 0xb3 instead of 0x29
diff 59 address 0x080000a9. Was 0x0f instead of 0x0b
diff 60 address 0x080000ac. Was 0xb5 instead of 0x45
diff 61 address 0x080000ad. Was 0x0f instead of 0x10
diff 62 address 0x080000b0. Was 0xb7 instead of 0x29
diff 63 address 0x080000b1. Was 0x0f instead of 0x0b
diff 64 address 0x080000b4. Was 0xb9 instead of 0x29
diff 65 address 0x080000b5. Was 0x0f instead of 0x0b
diff 66 address 0x080000b8. Was 0xbb instead of 0x29
diff 67 address 0x080000b9. Was 0x0f instead of 0x0b
diff 68 address 0x080000bc. Was 0xbd instead of 0x29
diff 69 address 0x080000bd. Was 0x0f instead of 0x0b
diff 70 address 0x080000c0. Was 0xf8 instead of 0x02
diff 71 address 0x080000c1. Was 0xb5 instead of 0xb4
diff 72 address 0x080000c2. Was 0x04 instead of 0x71
diff 73 address 0x080000c3. Was 0x00 instead of 0x46
diff 74 address 0x080000c4. Was 0xa2 instead of 0x49
diff 75 address 0x080000c5. Was 0x4d instead of 0x08
diff 76 address 0x080000c6. Was 0x20 instead of 0x49
diff 77 address 0x080000c7. Was 0x78 instead of 0x00
diff 78 address 0x080000c8. Was 0xc0 instead of 0x09
diff 79 address 0x080000c9. Was 0x07 instead of 0x5c
diff 80 address 0x080000ca. Was 0x16 instead of 0x49
diff 81 address 0x080000cb. Was 0xd5 instead of 0x00
diff 82 address 0x080000cc. Was 0x80 instead of 0x8e
diff 83 address 0x080000cd. Was 0x27 instead of 0x44
diff 84 address 0x080000ce. Was 0xbf instead of 0x02
diff 85 address 0x080000cf. Was 0x02 instead of 0xbc
diff 86 address 0x080000d0. Was 0xe8 instead of 0x70
diff 87 address 0x080000d1. Was 0x68 instead of 0x47
diff 88 address 0x080000d2. Was 0x0c instead of 0xc0
diff 89 address 0x080000d3. Was 0x21 instead of 0x46
diff 90 address 0x080000d4. Was 0x01 instead of 0x00
diff 91 address 0x080000d5. Was 0x40 instead of 0x29
diff 92 address 0x080000d6. Was 0x08 instead of 0x34
diff 93 address 0x080000d7. Was 0x29 instead of 0xd0
diff 94 address 0x080000d8. Was 0x07 instead of 0x01
diff 95 address 0x080000d9. Was 0xd0 instead of 0x23
diff 96 address 0x080000da. Was 0xe8 instead of 0x00
diff 97 address 0x080000db. Was 0x68 instead of 0x22
diff 98 address 0x080000dc. Was 0x0c instead of 0x10
diff 99 address 0x080000dd. Was 0x21 instead of 0xb4
diff 100 address 0x080000de. Was 0x01 instead of 0x88
diff 101 address 0x080000df. Was 0x40 instead of 0x42
diff 102 address 0x080000e0. Was 0x0c instead of 0x2c
diff 103 address 0x080000e1. Was 0x29 instead of 0xd3
diff 104 address 0x080000e2. Was 0x5c instead of 0x01
diff 105 address 0x080000e3. Was 0xd1 instead of 0x24
diff 106 address 0x080000e4. Was 0xe8 instead of 0x24
diff 107 address 0x080000e5. Was 0x68 instead of 0x07
diff 108 address 0x080000e6. Was 0xc0 instead of 0xa1
diff 109 address 0x080000e7. Was 0x03 instead of 0x42
diff 110 address 0x080000e8. Was 0x59 instead of 0x04
diff 111 address 0x080000e9. Was 0xd5 instead of 0xd2
diff 112 address 0x080000ea. Was 0x28 instead of 0x81
diff 113 address 0x080000eb. Was 0x68 instead of 0x42
diff 114 address 0x080000ec. Was 0x07 instead of 0x02
diff 115 address 0x080000ed. Was 0x40 instead of 0xd2
diff 116 address 0x080000ee. Was 0x04 instead of 0x09
diff 117 address 0x080000ef. Was 0xd0 instead of 0x01
diff 118 address 0x080000f0. Was 0x60 instead of 0x1b
diff 119 address 0x080000f1. Was 0x68 instead of 0x01
diff 120 address 0x080000f2. Was 0x80 instead of 0xf8
diff 121 address 0x080000f3. Was 0x21 instead of 0xe7
diff 122 address 0x080000f4. Was 0x49 instead of 0xe4
diff 123 address 0x080000f5. Was 0x02 instead of 0x00
diff 124 address 0x080000f6. Was 0x88 instead of 0xa1
diff 125 address 0x080000f8. Was 0x36 instead of 0x04
diff 126 address 0x080000f9. Was 0xd1 instead of 0xd2
diff 127 address 0x080000fa. Was 0x04 instead of 0x81
More than 128 errors, the rest are not printed.
Runtime Error: load_bin.cfg:6:
in procedure 'script'
at file "embedded:startup.tcl", line 58
in procedure 'verify_image' called at file "load_bin.cfg", line 6