{"id":25700973,"url":"https://github.com/ghostiam/ch32v003_zig","last_synced_at":"2025-02-25T04:15:56.787Z","repository":{"id":279327068,"uuid":"938405833","full_name":"ghostiam/ch32v003_zig","owner":"ghostiam","description":"ch32v003 from scratch in Zig. Just using `zig build`!","archived":false,"fork":false,"pushed_at":"2025-02-25T01:31:29.000Z","size":3606,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-25T02:29:48.413Z","etag":null,"topics":["ch32v","ch32v003","embedded","embedded-zig","wch","zig","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghostiam.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":"2025-02-24T22:49:14.000Z","updated_at":"2025-02-25T01:34:37.000Z","dependencies_parsed_at":"2025-02-25T02:29:51.759Z","dependency_job_id":"4d572dea-7958-4898-b699-eb6d5a736722","html_url":"https://github.com/ghostiam/ch32v003_zig","commit_stats":null,"previous_names":["ghostiam/ch32v003_zig"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostiam%2Fch32v003_zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostiam%2Fch32v003_zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostiam%2Fch32v003_zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostiam%2Fch32v003_zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghostiam","download_url":"https://codeload.github.com/ghostiam/ch32v003_zig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240599194,"owners_count":19826959,"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":["ch32v","ch32v003","embedded","embedded-zig","wch","zig","ziglang"],"created_at":"2025-02-25T04:15:56.210Z","updated_at":"2025-02-25T04:15:56.753Z","avatar_url":"https://github.com/ghostiam.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ch32v003 from scratch in Zig\n\nExamples range from simple to complex. Everything is compiled with a simple `zig build`. \\\nThe [minichlink](tools/minichlink) flasher is also included and can be\ncompiled using `zig build` as well.\n\n## Getting Started\n\n\u003e [!NOTE]\n\u003e If you are using `nix`, you can simply run `nix develop` in the root of the project, and it will automatically install\n\u003e `zig`, `zigscient`, and `minichlink` in your environment.\n\u003e And you can skip to the [Build and upload the example](#build-and-upload-the-example) section.\n\n### Install Zig\n\nCurrently, the examples are tested with `0.14.0-dev.3328`.\\\nYou can download the latest version from:\nhttps://ziglang.org/download/\n\n### Build the flasher\n\n```shell\ncd tools/minichlink\nzig build --release=safe\n\n# Add the `minichlink` to your `PATH`:\nexport PATH=$PATH:$(pwd)/zig-out/bin\n```\n\n### Build and upload the example\n\n```shell\ncd 001_blink_minimal\nzig build\nminichlink -w zig-out/firmware/ch32v003_blink.bin flash -b\n```\n\n## Useful Notes\n\n### Flashing\n\n```shell\n# Write and reboot.\nminichlink -w zig-out/firmware/ch32v003_blink.bin flash -b\n```\n\n### Debugging\n\n```shell\n# Run GDB server.\nminichlink -G\n# Reboot into halt and run GDB server \n# (firmware will be halted until GDB is connected).\nminichlink -a -G\n```\n\nIn `CLion`: add a new `Remote Debug` configuration.\n\n![clion_debug_configuration.png](.assets/clion_debug_configuration.png)\n\n### Show firmware info\n\n```shell\n# Size (clang)\nsize zig-out/firmware/ch32v003_blink.elf\n# Sections info (clang)\nobjdump -h zig-out/firmware/ch32v003_blink.elf \nbloaty zig-out/firmware/ch32v003_blink.elf\n````\n\n### Dump memory\n\n```shell\nminichlink -r memory.bin 0x20000000 2048\n```\n\n### UART\n\n```shell\nscreen /dev/tty.usbmodem* 115200 \n```\n\n`Ctrl + A`, `Ctrl + \\` - Exit screen and terminate all programs in this screen. \\\n`Ctrl + D`, `D` or `Ctrl + A`, `Ctrl + D` - \"minimize\" screen and `screen -r` to restore it.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostiam%2Fch32v003_zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghostiam%2Fch32v003_zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostiam%2Fch32v003_zig/lists"}