I stay trying this: https://nc-pin.com/index.php/category/wch/ch32v-series/ch32v307/ Debugging CH32V307V with Visual Studio Code on macOS
The part more confuse is this: “I saved a workspace of Visual Studio Code into the ch32v307/EVT/EXAM/GPIO/GPIO_Toggle/User directory and added this directory to the workspace also±”
But I can create a lauch.json with workspace(3) and GDB(4)
After I mounted with hdid, mount and export PATH, etc…
But in Final I have issue: Failed to attach: :3333: Operation timed out. (from target-select remote :3333)
Note:
Will I need task.json to resolve my issue?
https://github.com/neuberfran/ch32v307
How can I solve?
Pls
edited in 06-11-2022. The solution for this issue is use wch-link version 2.3(Not 2.4 upstream today). But so far, it has not been possible to Downgrade from 2.4 to 2.3. Look wehnelt comment in this post:https://www.reddit.com/r/embedded/comments/ut94i3/the_riscv_mcu_ch32v307_is_a_bad_boy/
Due to the need to update in wch-link v2.4 (for Mac OS and Ubuntu), this answer (2022-07-23) comes to complement the tutorial: https://nc-pin.com/index.php/category/wch/ch32v-series/ch32v307/
1.1) https://github.com/neuberfran/openocd (openocd it's working ok)
1.2) go to /Users/username/csfs/openocd: ./openocd -f wch-riscv.cfg -c init -c halt -c "flash erase_sector wch_riscv 0 last" -c exit
git clone https://github.com/neuberfran/GPIO_Toggle 2.1) go to Finder -> GPIO_Toggle/User -> double click in GPIO_Toggle.code-workspace
in VsCode go to Terminal: export PATH="$HOME/csfs/x-tools/riscv32-unknown-elf/bin:$HOME/csfs/openocd:$PATH"
note.: You have probably already run: hdid -nomount csfs.sparseimage
mount -t hfs /dev/diskXs2 csfs
3.1) mark line 56 in main.c File (debug breakpoint)
Press F5 ...(If a warning screen appears, click Debug Anyway). Next Debug Console will automatically open and debugger will stop at line 56. Click F5 agin (Continue button, up there in VsCode). The Led will blink. Click F6 to stop and F5 to continue.
Remove And Reconnect the USB-C cables from the board. Go to the Mac OS terminal that you open in Step nr.: 1.2. Execute again Step 1.2. Go to Step 4.