macos下使用官方给的openocd无法识别芯片ch585

错误信息如下:

?  bin ./openocd -f wch-riscv.cfg -c "chip_id CH58x"

Open On-Chip Debugger 0.11.0+dev-02415-gfad123a16-dirty (2024-08-08-14:01)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.org/doc/doxygen/bugs.html

Info : only one transport option; autoselect 'sdi'

Warn : Transport "sdi" was already selected

Ready for Remote Connections

Info : Listening on port 6666 for tcl connections

Info : Listening on port 4444 for telnet connections

Info : WCH-LinkE  mode:RV version 2.14

Error:  communication fail,please contact [个人信息保护,已隐藏]


Windows版本的openocd可以正常使用,没有问题。


您好,可以参考解压之后目录文件下的MAC-README.md中的操作方式,安装下LIBusb库。


libusb安装正常。

如下是测试命令和调试输出,请帮忙诊断下是否是MAC兼容性问题。


?  bin sudo ./openocd -f wch-riscv.cfg -c init -c halt -c wlink_reset_resume    -c exit -d

Open On-Chip Debugger 0.11.0+dev-02415-gfad123a16-dirty (2024-08-08-14:01)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.org/doc/doxygen/bugs.html

User : 3 1 options.c:63 configuration_output_handler(): debug_level: 3

User : 4 1 options.c:63 configuration_output_handler():

Debug: 5 1 options.c:244 add_default_dirs(): bindir=/Users/yy/openocd192/opout/bin

Debug: 6 1 options.c:245 add_default_dirs(): pkgdatadir=/Users/yy/openocd192/opout/share/openocd

Debug: 7 1 options.c:246 add_default_dirs(): exepath=/Users/solosky/Downloads/MRS_Toolchain_MAC_V1921111/MRS_Toolchain_MAC_V192/openocd_x86_64/openocd_x86_64/bin

Debug: 8 1 options.c:247 add_default_dirs(): bin2data=../share/openocd

Debug: 9 1 configuration.c:44 add_script_search_dir(): adding /Users/solosky/Library/Preferences/org.openocd

Debug: 10 1 configuration.c:44 add_script_search_dir(): adding /Users/solosky/.config/openocd

Debug: 11 1 configuration.c:44 add_script_search_dir(): adding /Users/solosky/.openocd

Debug: 12 1 configuration.c:44 add_script_search_dir(): adding /Users/solosky/Downloads/MRS_Toolchain_MAC_V1921111/MRS_Toolchain_MAC_V192/openocd_x86_64/openocd_x86_64/bin/../share/openocd/site

Debug: 13 1 configuration.c:44 add_script_search_dir(): adding /Users/solosky/Downloads/MRS_Toolchain_MAC_V1921111/MRS_Toolchain_MAC_V192/openocd_x86_64/openocd_x86_64/bin/../share/openocd/scripts

Debug: 14 1 command.c:166 script_debug(): command - ocd_find wch-riscv.cfg

Debug: 15 1 configuration.c:99 find_file(): found wch-riscv.cfg

Debug: 16 1 command.c:166 script_debug(): command - adapter driver wlinke

Info : 17 1 transport.c:118 allow_transports(): only one transport option; autoselect 'sdi'

Debug: 18 1 sdi.c:94 sdi_transport_select(): sdi_transport_select

Debug: 19 1 command.c:166 script_debug(): command - adapter speed 6000

Debug: 20 1 adapter.c:176 adapter_config_khz(): handle adapter khz

Debug: 21 1 adapter.c:140 adapter_khz_to_speed(): convert khz to adapter specific speed value

Debug: 22 1 adapter.c:140 adapter_khz_to_speed(): convert khz to adapter specific speed value

Debug: 23 1 command.c:166 script_debug(): command - transport select sdi

Warn : 24 1 transport.c:287 jim_transport_select(): Transport "sdi" was already selected

Debug: 25 1 command.c:166 script_debug(): command - wlink_set_address 0x00000000

Debug: 26 1 command.c:166 script_debug(): command - sdi newtap wch_riscv cpu -irlen 5 -expected-id 0x00001

Debug: 27 1 sdi.c:60 handle_sdi_newtap_command(): Creating new sdi "tap", Chip: wch_riscv, Tap: cpu, Dotted: wch_riscv.cpu

Debug: 28 1 core.c:1472 jtag_tap_init(): Created Tap: wch_riscv.cpu @ abs position 0, irlen 0, capture: 0x0 mask: 0x0

Debug: 29 1 command.c:166 script_debug(): command - target create wch_riscv.cpu.0 wch_riscv -chain-position wch_riscv.cpu

Debug: 30 1 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas

Debug: 31 1 wch_riscv.c:73 wch_riscv_create_target(): wch_riscv_create_target()

Debug: 32 1 command.c:166 script_debug(): command - wch_riscv.cpu.0 configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1

Debug: 33 1 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas

Debug: 34 1 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas

Debug: 35 1 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas

Debug: 36 1 command.c:166 script_debug(): command - flash bank wch_riscv.flash wch_riscv 0x00000000 0 0 0 wch_riscv.cpu.0

Debug: 37 1 tcl.c:1354 handle_flash_bank_command(): 'wch_riscv' driver usage field missing

Debug: 38 1 command.c:166 script_debug(): command - echo Ready for Remote Connections

User : 39 1 command.c:697 handle_echo(): Ready for Remote Connections

Debug: 40 1 command.c:166 script_debug(): command - init

Debug: 41 1 command.c:166 script_debug(): command - target init

Debug: 42 1 command.c:166 script_debug(): command - target names

Debug: 43 1 command.c:166 script_debug(): command - wch_riscv.cpu.0 cget -event gdb-flash-erase-start

Debug: 44 1 command.c:166 script_debug(): command - wch_riscv.cpu.0 configure -event gdb-flash-erase-start reset init

Debug: 45 1 command.c:166 script_debug(): command - wch_riscv.cpu.0 cget -event gdb-flash-write-end

Debug: 46 1 command.c:166 script_debug(): command - wch_riscv.cpu.0 configure -event gdb-flash-write-end reset halt

Debug: 47 1 command.c:166 script_debug(): command - wch_riscv.cpu.0 cget -event gdb-attach

Debug: 48 1 command.c:166 script_debug(): command - wch_riscv.cpu.0 configure -event gdb-attach halt 1000

Debug: 49 1 target.c:1671 handle_target_init_command(): Initializing targets...

Debug: 50 1 wch_riscv.c:86 wch_riscv_init_target(): wch_riscv_init_target()

Debug: 51 1 semihosting_common.c:130 semihosting_common_init():

Info : 52 7 wlinke.c:1897 wlink_init(): WCH-LinkE  mode:RV version 2.14

Error: 53 95 wlinke.c:2180 wlink_init():  communication fail,please contact [个人信息保护,已隐藏]

Debug: 54 98 command.c:557 run_command(): Command 'init' failed with error code -4

User : 55 98 command.c:620 command_run_line():

Debug: 56 98 wch_riscv.c:114 wch_riscv_deinit_target(): wch_riscv_deinit_target()

Debug: 57 98 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas



您好,请参考解压之后目录文件下的MAC-README.md中的操作方式,加上对应芯片型号。



感谢回复,参考了MAC-README.md  测试了多个参数均无法识别芯片。


?  bin sudo ./openocd -f wch-riscv.cfg -c "chip_id CH58x" -c init -c halt -c wlink_reset_resume    -c exit  -d

Open On-Chip Debugger 0.11.0+dev-02415-gfad123a16-dirty (2024-08-08-14:01)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.org/doc/doxygen/bugs.html

User : 3 2 options.c:63 configuration_output_handler(): debug_level: 3

User : 4 2 options.c:63 configuration_output_handler():

Debug: 5 2 options.c:244 add_default_dirs(): bindir=/Users/yy/openocd192/opout/bin

Debug: 6 2 options.c:245 add_default_dirs(): pkgdatadir=/Users/yy/openocd192/opout/share/openocd

Debug: 7 2 options.c:246 add_default_dirs(): exepath=/Users/solosky/Downloads/MRS_Toolchain_MAC_V1921111/MRS_Toolchain_MAC_V192/openocd_x86_64/openocd_x86_64/bin

Debug: 8 2 options.c:247 add_default_dirs(): bin2data=../share/openocd

Debug: 9 2 configuration.c:44 add_script_search_dir(): adding /Users/solosky/Library/Preferences/org.openocd

Debug: 10 2 configuration.c:44 add_script_search_dir(): adding /Users/solosky/.config/openocd

Debug: 11 2 configuration.c:44 add_script_search_dir(): adding /Users/solosky/.openocd

Debug: 12 2 configuration.c:44 add_script_search_dir(): adding /Users/solosky/Downloads/MRS_Toolchain_MAC_V1921111/MRS_Toolchain_MAC_V192/openocd_x86_64/openocd_x86_64/bin/../share/openocd/site

Debug: 13 2 configuration.c:44 add_script_search_dir(): adding /Users/solosky/Downloads/MRS_Toolchain_MAC_V1921111/MRS_Toolchain_MAC_V192/openocd_x86_64/openocd_x86_64/bin/../share/openocd/scripts

Debug: 14 2 command.c:166 script_debug(): command - ocd_find wch-riscv.cfg

Debug: 15 2 configuration.c:99 find_file(): found wch-riscv.cfg

Debug: 16 2 command.c:166 script_debug(): command - adapter driver wlinke

Info : 17 2 transport.c:118 allow_transports(): only one transport option; autoselect 'sdi'

Debug: 18 2 sdi.c:94 sdi_transport_select(): sdi_transport_select

Debug: 19 2 command.c:166 script_debug(): command - adapter speed 6000

Debug: 20 2 adapter.c:176 adapter_config_khz(): handle adapter khz

Debug: 21 2 adapter.c:140 adapter_khz_to_speed(): convert khz to adapter specific speed value

Debug: 22 2 adapter.c:140 adapter_khz_to_speed(): convert khz to adapter specific speed value

Debug: 23 2 command.c:166 script_debug(): command - transport select sdi

Warn : 24 2 transport.c:287 jim_transport_select(): Transport "sdi" was already selected

Debug: 25 2 command.c:166 script_debug(): command - wlink_set_address 0x00000000

Debug: 26 2 command.c:166 script_debug(): command - sdi newtap wch_riscv cpu -irlen 5 -expected-id 0x00001

Debug: 27 2 sdi.c:60 handle_sdi_newtap_command(): Creating new sdi "tap", Chip: wch_riscv, Tap: cpu, Dotted: wch_riscv.cpu

Debug: 28 2 core.c:1472 jtag_tap_init(): Created Tap: wch_riscv.cpu @ abs position 0, irlen 0, capture: 0x0 mask: 0x0

Debug: 29 2 command.c:166 script_debug(): command - target create wch_riscv.cpu.0 wch_riscv -chain-position wch_riscv.cpu

Debug: 30 2 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas

Debug: 31 2 wch_riscv.c:73 wch_riscv_create_target(): wch_riscv_create_target()

Debug: 32 2 command.c:166 script_debug(): command - wch_riscv.cpu.0 configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1

Debug: 33 2 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas

Debug: 34 2 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas

Debug: 35 2 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas

Debug: 36 2 command.c:166 script_debug(): command - flash bank wch_riscv.flash wch_riscv 0x00000000 0 0 0 wch_riscv.cpu.0

Debug: 37 2 tcl.c:1354 handle_flash_bank_command(): 'wch_riscv' driver usage field missing

Debug: 38 2 command.c:166 script_debug(): command - echo Ready for Remote Connections

User : 39 2 command.c:697 handle_echo(): Ready for Remote Connections

Debug: 40 2 command.c:166 script_debug(): command - chip_id CH58x

Debug: 41 2 command.c:166 script_debug(): command - init

Debug: 42 2 command.c:166 script_debug(): command - target init

Debug: 43 2 command.c:166 script_debug(): command - target names

Debug: 44 2 command.c:166 script_debug(): command - wch_riscv.cpu.0 cget -event gdb-flash-erase-start

Debug: 45 2 command.c:166 script_debug(): command - wch_riscv.cpu.0 configure -event gdb-flash-erase-start reset init

Debug: 46 2 command.c:166 script_debug(): command - wch_riscv.cpu.0 cget -event gdb-flash-write-end

Debug: 47 2 command.c:166 script_debug(): command - wch_riscv.cpu.0 configure -event gdb-flash-write-end reset halt

Debug: 48 2 command.c:166 script_debug(): command - wch_riscv.cpu.0 cget -event gdb-attach

Debug: 49 2 command.c:166 script_debug(): command - wch_riscv.cpu.0 configure -event gdb-attach halt 1000

Debug: 50 2 target.c:1671 handle_target_init_command(): Initializing targets...

Debug: 51 2 wch_riscv.c:86 wch_riscv_init_target(): wch_riscv_init_target()

Debug: 52 2 semihosting_common.c:130 semihosting_common_init():

Info : 53 9 wlinke.c:1897 wlink_init(): WCH-LinkE  mode:RV version 2.14

Error: 54 96 wlinke.c:2180 wlink_init():  communication fail,please contact [个人信息保护,已隐藏]

Debug: 55 99 command.c:557 run_command(): Command 'init' failed with error code -4

User : 56 99 command.c:620 command_run_line():

Debug: 57 99 wch_riscv.c:114 wch_riscv_deinit_target(): wch_riscv_deinit_target()

Debug: 58 99 target.c:2214 target_free_all_working_areas_restore(): freeing all working areas



您好,之前没有注意到您使用的CH585芯片,此芯片的支持在非win系统还未更新,后续会逐渐更新。


谢谢回复,请尽快更新下,我这边常在macos开发,否则非常不方便。


只有登录才能回复,可以选择微信账号登录