{"id":22100882,"url":"https://github.com/123swk123/openocd-wch-linke-multilink","last_synced_at":"2025-03-24T02:18:13.099Z","repository":{"id":169468112,"uuid":"645448029","full_name":"123swk123/openocd-wch-linke-multilink","owner":"123swk123","description":"Openocd for WCH-LinkE with support for multi-WCHLinkE debugging","archived":false,"fork":false,"pushed_at":"2023-05-25T17:39:04.000Z","size":3598,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T08:21:45.246Z","etag":null,"topics":["ch32v003","openocd","openocd-riscv","wch","wch-link"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/123swk123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-25T17:14:02.000Z","updated_at":"2024-11-13T19:17:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"a159136d-8150-4e83-b115-5fc03fb6055a","html_url":"https://github.com/123swk123/openocd-wch-linke-multilink","commit_stats":null,"previous_names":["123swk123/openocd-wch-linke-multilink"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/123swk123%2Fopenocd-wch-linke-multilink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/123swk123%2Fopenocd-wch-linke-multilink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/123swk123%2Fopenocd-wch-linke-multilink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/123swk123%2Fopenocd-wch-linke-multilink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/123swk123","download_url":"https://codeload.github.com/123swk123/openocd-wch-linke-multilink/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245195964,"owners_count":20575938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ch32v003","openocd","openocd-riscv","wch","wch-link"],"created_at":"2024-12-01T05:17:13.069Z","updated_at":"2025-03-24T02:18:13.079Z","avatar_url":"https://github.com/123swk123.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Openocd for multi-WCHLinkE debugging\n\nconfiguration to connect first enumerated WCH-LinkE device; file: [wch-riscv.cfg](bin/wch-riscv.cfg)\n```tcl\n#interface wlink\nadapter driver wlinke\n# use index 0, 1, 2... to select each wchlink\nwlink_set_index 0\nadapter speed 6000\ntransport select sdi\n\nwlink_set_address 0x00000000\nset _CHIPNAME wch_riscv\nsdi newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x00001\n\nset _TARGETNAME $_CHIPNAME.cpu\n\ntarget create $_TARGETNAME.0 wch_riscv -chain-position $_TARGETNAME\n$_TARGETNAME.0 configure  -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1\nset _FLASHNAME $_CHIPNAME.flash\n\nflash bank $_FLASHNAME wch_riscv 0x00000000 0 0 0 $_TARGETNAME.0\n\nlappend post_init_commands {echo \"Ready for Remote Connections\"}\n```\nconfiguration to connect second enumerated WCH-LinkE device; file: [wch-1-riscv.cfg](bin/wch-1-riscv.cfg)\n```tcl\n#interface wlink\nadapter driver wlinke\n# use index 0, 1, 2... to select each wchlink\nwlink_set_index 1\nadapter speed 6000\ntransport select sdi\n\nwlink_set_address 0x00000000\nset _CHIPNAME wch_riscv\nsdi newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x00001\n\nset _TARGETNAME $_CHIPNAME.cpu\n\ntarget create $_TARGETNAME.0 wch_riscv -chain-position $_TARGETNAME\n$_TARGETNAME.0 configure  -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1\nset _FLASHNAME $_CHIPNAME.flash\n\nflash bank $_FLASHNAME wch_riscv 0x00000000 0 0 0 $_TARGETNAME.0\n\nlappend post_init_commands {\n    echo \"Ready for Remote Connections\"\n}\n```\n\n## openocd configuration setup in Eclipse or similar IDE\n\n*Note: Make sure for each openocd instance use differenct port numbers for telnet/tcl/gdb*\n![image](https://github.com/123swk123/openocd-wch-linke-multilink/assets/903389/0c139b1d-18e1-4c95-84e1-1552219947e8)\n\n## To manually read Flash info\n\n*for example on ch32v003, run this from openocd bin dir*\n\n`openocd.exe -f .\\wch-riscv.cfg -c 'wch_riscv.cpu.0 configure -event reset-end {flash probe 0}' -c init -c reset -c exit`\n```log\nOpen On-Chip Debugger 0.11.0+dev-snapshot (2023-04-23-01:01)\nLicensed under GNU GPL v2\nFor bug reports, read\n        http://openocd.org/doc/doxygen/bugs.html\nInfo : only one transport option; autoselect 'sdi'\nWarn : Transport \"sdi\" was already selected\n{echo \"Ready for Remote Connections\"}\nInfo : WCH-LinkE  mode:RV version 2.9\nInfo : wlink_init ok\nInfo : clock speed 6000 kHz\nInfo : [wch_riscv.cpu.0] datacount=2 progbufsize=8\nInfo : [wch_riscv.cpu.0] Examined RISC-V core; found 1 harts\nInfo : [wch_riscv.cpu.0]  XLEN=32, misa=0x40800014\n[wch_riscv.cpu.0] Target successfully examined.\nInfo : starting gdb server for wch_riscv.cpu.0 on 3333\nInfo : Listening on port 3333 for gdb connections\nInfo : device id = 0x83a7abcd\nInfo : flash size = 16kbytes\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F123swk123%2Fopenocd-wch-linke-multilink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F123swk123%2Fopenocd-wch-linke-multilink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F123swk123%2Fopenocd-wch-linke-multilink/lists"}