Thank you a lot Antonio for the information, I have to find an alternative 
debugger then.


---

** [tickets:#280] stlink-v2 not working with bcm2835 raspberry pi**

**Status:** new
**Milestone:** 0.9.0
**Created:** Thu Oct 15, 2020 02:42 PM UTC by Christian Tenllado
**Last Updated:** Thu Oct 15, 2020 04:19 PM UTC
**Owner:** nobody


Hi:

I am trying to use a stlink-v2 to debug a raspberry pi (bcm2835) using jtag, 
but I am not succeding. I have tryied with two transports, hla and dapdirect, 
and each of them is giving me different problems.

Using the openocd snapshot from debian unstable (from 2020-08-19). The commands 
I use to connect and the debug output from openocd are  the following:

- Using hla:

$ openocd -d3 -f interface/stlink-v2.cfg -c "transport select hla_jtag" -c 
"adapter speed 100"  -c "hla newtap raspi arm -irlen 5 -expected-id 0x07b7617F" 
-c "target create raspi.arm arm11 -chain-position raspi.arm"

Open On-Chip Debugger 0.10.0+dev-snapshot (2020-10-14-11:42)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
User : 13 5 options.c:63 configuration_output_handler(): debug_level: 3
User : 14 5 options.c:63 configuration_output_handler(): 
Debug: 15 5 options.c:187 add_default_dirs(): bindir=/usr/bin
Debug: 16 5 options.c:188 add_default_dirs(): pkgdatadir=/usr/share/openocd
Debug: 17 5 options.c:189 add_default_dirs(): exepath=/usr/bin
Debug: 18 5 options.c:190 add_default_dirs(): bin2data=../share/openocd
Debug: 19 5 configuration.c:42 add_script_search_dir(): adding 
/home/christian/.openocd
Debug: 20 5 configuration.c:42 add_script_search_dir(): adding 
/usr/bin/../share/openocd/site
Debug: 21 5 configuration.c:42 add_script_search_dir(): adding 
/usr/bin/../share/openocd/scripts
Debug: 22 6 configuration.c:97 find_file(): found 
/usr/bin/../share/openocd/scripts/interface/stlink-v2.cfg
Debug: 23 6 command.c:146 script_debug(): command - echo WARNING: 
interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
User : 25 6 command.c:767 jim_echo(): WARNING: interface/stlink-v2.cfg is 
deprecated, please switch to interface/stlink.cfg
Debug: 26 6 configuration.c:97 find_file(): found 
/usr/bin/../share/openocd/scripts/interface/stlink.cfg
Debug: 27 6 command.c:146 script_debug(): command - adapter driver hla
Debug: 29 6 command.c:352 register_command_handler(): registering 
'hla_device_desc'...
Debug: 30 6 command.c:352 register_command_handler(): registering 
'hla_serial'...
Debug: 31 6 command.c:352 register_command_handler(): registering 
'hla_layout'...
Debug: 32 6 command.c:352 register_command_handler(): registering 
'hla_vid_pid'...
Debug: 33 6 command.c:352 register_command_handler(): registering 
'hla_command'...
Debug: 34 6 command.c:146 script_debug(): command - hla_layout stlink
Debug: 36 6 hla_interface.c:242 hl_interface_handle_layout_command(): 
hl_interface_handle_layout_command
Debug: 37 6 command.c:146 script_debug(): command - hla_device_desc ST-LINK
Debug: 39 6 hla_interface.c:216 hl_interface_handle_device_desc_command(): 
hl_interface_handle_device_desc_command
Debug: 40 6 command.c:146 script_debug(): command - hla_vid_pid 0x0483 0x3744 
0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 
0x3752 0x0483 0x3753
Debug: 42 6 command.c:146 script_debug(): command - transport select hla_jtag
Debug: 43 6 hla_transport.c:189 hl_transport_select(): hl_transport_select
Debug: 44 6 command.c:352 register_command_handler(): registering 'hla'...
Debug: 45 6 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 46 6 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 47 6 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 48 6 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 49 6 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 50 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 51 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 52 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 53 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 54 7 command.c:352 register_command_handler(): registering 
'jtag_ntrst_delay'...
User : 55 7 options.c:63 configuration_output_handler(): hla_jtagUser : 56 7 
options.c:63 configuration_output_handler(): 
Debug: 57 7 command.c:146 script_debug(): command - adapter speed 100
Debug: 59 7 core.c:1822 jtag_config_khz(): handle jtag khz
Debug: 60 7 core.c:1785 adapter_khz_to_speed(): convert khz to interface 
specific speed value
Debug: 61 7 core.c:1785 adapter_khz_to_speed(): convert khz to interface 
specific speed value
User : 62 7 options.c:63 configuration_output_handler(): adapter speed: 100 kHz
User : 63 7 options.c:63 configuration_output_handler(): 
Debug: 64 7 command.c:146 script_debug(): command - hla newtap raspi arm -irlen 
5 -expected-id 0x07b7617F
Debug: 65 7 hla_tcl.c:111 jim_hl_newtap_cmd(): Creating New Tap, Chip: raspi, 
Tap: arm, Dotted: raspi.arm, 4 params
Debug: 66 7 hla_tcl.c:121 jim_hl_newtap_cmd(): Processing option: -irlen
Debug: 67 7 hla_tcl.c:121 jim_hl_newtap_cmd(): Processing option: -expected-id
Debug: 68 7 core.c:1488 jtag_tap_init(): Created Tap: raspi.arm @ abs position 
0, irlen 0, capture: 0x0 mask: 0x0
Debug: 69 7 command.c:146 script_debug(): command - target create raspi.arm 
arm11 -chain-position raspi.arm
**Error: 70 7 target.c:5458 target_create(): The selected transport doesn't 
support this target**
User : 71 8 command.c:692 command_run_line(): invalid command name "raspi.arm"

- Using dapdirect:

$ openocd -d3 -f interface/stlink-dap.cfg -c "transport select dapdirect_jtag" 
-c "adapter speed 100" -c "jtag newtap raspi arm -irlen 5 -expected-id 
0x07b7617F" -c "target create raspi.arm arm11 -chain-position raspi.arm"

Open On-Chip Debugger 0.10.0+dev-snapshot (2020-10-14-11:42)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
User : 13 6 options.c:63 configuration_output_handler(): debug_level: 3
User : 14 6 options.c:63 configuration_output_handler(): 
Debug: 15 6 options.c:187 add_default_dirs(): bindir=/usr/bin
Debug: 16 6 options.c:188 add_default_dirs(): pkgdatadir=/usr/share/openocd
Debug: 17 6 options.c:189 add_default_dirs(): exepath=/usr/bin
Debug: 18 6 options.c:190 add_default_dirs(): bin2data=../share/openocd
Debug: 19 6 configuration.c:42 add_script_search_dir(): adding 
/home/christian/.openocd
Debug: 20 6 configuration.c:42 add_script_search_dir(): adding 
/usr/bin/../share/openocd/site
Debug: 21 7 configuration.c:42 add_script_search_dir(): adding 
/usr/bin/../share/openocd/scripts
Debug: 22 7 configuration.c:97 find_file(): found 
/usr/bin/../share/openocd/scripts/interface/stlink-dap.cfg
Debug: 23 7 command.c:146 script_debug(): command - adapter driver st-link
Debug: 25 7 command.c:352 register_command_handler(): registering 'st-link'...
Debug: 26 7 command.c:352 register_command_handler(): registering 'st-link'...
Debug: 27 7 command.c:146 script_debug(): command - st-link vid_pid 0x0483 
0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 
0x0483 0x3752 0x0483 0x3753
Debug: 29 7 command.c:146 script_debug(): command - transport select 
dapdirect_jtag
Debug: 30 7 adi_v5_dapdirect.c:168 dapdirect_jtag_select(): 
dapdirect_jtag_select()
Debug: 31 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 32 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 33 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 34 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 35 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 36 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 37 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 38 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 39 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 40 7 command.c:352 register_command_handler(): registering 'jtag'...
Debug: 41 7 command.c:352 register_command_handler(): registering 
'jtag_ntrst_delay'...
User : 42 7 options.c:63 configuration_output_handler(): dapdirect_jtagUser : 
43 7 options.c:63 configuration_output_handler(): 
Debug: 44 7 command.c:146 script_debug(): command - adapter speed 100
Debug: 46 7 core.c:1822 jtag_config_khz(): handle jtag khz
Debug: 47 7 core.c:1785 adapter_khz_to_speed(): convert khz to interface 
specific speed value
Debug: 48 7 core.c:1785 adapter_khz_to_speed(): convert khz to interface 
specific speed value
User : 49 7 options.c:63 configuration_output_handler(): adapter speed: 100 kHz
User : 50 8 options.c:63 configuration_output_handler(): 
**Debug: 51 8 command.c:146 script_debug(): command - jtag newtap raspi arm 
-irlen 5 -expected-id 0x07b7617F
Debug: 52 8 tcl.c:567 jim_newtap_cmd(): Creating New Tap, Chip: raspi, Tap: 
arm, Dotted: raspi.arm, 4 params
Debug: 53 8 core.c:1488 jtag_tap_init(): Created Tap: raspi.arm @ abs position 
0, irlen 0, capture: 0x0 mask: 0x0
Debug: 54 8 command.c:146 script_debug(): command - target create raspi.arm 
arm11 -chain-position raspi.arm
Debug: 55 8 target.c:1996 target_free_all_working_areas_restore(): freeing all 
working areas
Error: 56 8 arm11.c:1104 arm11_target_create(): 'target arm11' expects IR 
LENGTH = 5**
Debug: 57 8 target.c:5609 target_create(): target_create failed
User : 58 8 command.c:692 command_run_line(): raspi.arm

As you can see, the hla transport seems to not support arm11 as target. On the 
other hand, the dapdirect transport seems to ignore the -irlen flag passed to 
the jtag newtap command, and then the openocd complains when the tap is 
initialized.

Can anyone help me to solve this problem or at least throw some light on it? 
Have anyone succed in using stlink-v2 to debug a raspberry pi using the jtag 
protocol?

Thank you all.

Christian.


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to