{"id":13710691,"url":"https://github.com/ZigEmbeddedGroup/regz","last_synced_at":"2025-05-06T19:32:25.207Z","repository":{"id":39661061,"uuid":"465175028","full_name":"ZigEmbeddedGroup/regz","owner":"ZigEmbeddedGroup","description":"Generate zig code from ATDF or SVD files for microcontrollers.","archived":true,"fork":false,"pushed_at":"2024-07-23T19:16:43.000Z","size":6236,"stargazers_count":82,"open_issues_count":27,"forks_count":29,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-13T21:44:33.132Z","etag":null,"topics":["arm","avr","embedded","mcu","microcontroller","svd","svd2zig","tooling","zig"],"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/ZigEmbeddedGroup.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":"2022-03-02T05:52:27.000Z","updated_at":"2024-10-09T07:41:12.000Z","dependencies_parsed_at":"2024-07-23T22:29:12.967Z","dependency_job_id":"cc10f197-88c1-4492-8917-0d124ac9093a","html_url":"https://github.com/ZigEmbeddedGroup/regz","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZigEmbeddedGroup%2Fregz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZigEmbeddedGroup%2Fregz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZigEmbeddedGroup%2Fregz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZigEmbeddedGroup%2Fregz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZigEmbeddedGroup","download_url":"https://codeload.github.com/ZigEmbeddedGroup/regz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252753698,"owners_count":21798997,"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":["arm","avr","embedded","mcu","microcontroller","svd","svd2zig","tooling","zig"],"created_at":"2024-08-02T23:00:59.863Z","updated_at":"2025-05-06T19:32:20.190Z","avatar_url":"https://github.com/ZigEmbeddedGroup.png","language":"Zig","readme":"# Archived\n\nThis repository has been moved into the [monorepo](https://github.com/ZigEmbeddedGroup/microzig/tree/main/website)\n\n# regz\n\n[![build](https://github.com/ZigEmbeddedGroup/regz/actions/workflows/ci.yml/badge.svg)](https://github.com/ZigEmbeddedGroup/regz/actions/workflows/ci.yml)\n\nregz is a Zig code generator for microcontrollers. Vendors often publish files\nthat have the details of special function registers, for ARM this is called a\n\"System View Description\" (SVD), for AVR the format is called ATDF. This tool\noutputs a single file for you to start interacting with the hardware:\n\n```zig\nconst regs = @import(\"nrf52.zig\").registers;\n\npub fn main() void {\n    regs.P0.PIN_CNF[17].modify(.{\n        .DIR = 1,\n        .INPUT = 1,\n        .PULL = 0,\n        .DRIVE = 0,\n        .SENSE = 0,\n    });\n    regs.P0.OUT.modify(.{ .PIN17 = 1 });\n}\n```\n\nNOTE: just including that file is not enough to run code on a microcontroller,\nthis is a fairly low-level tool and it is intended that the generated code be\nused with something like [microzig](https://github.com/ZigEmbeddedGroup/microzig).\n\nOne can get SVD files from your vendor, or another good place is\n[posborne/cmsis-svd](https://github.com/posborne/cmsis-svd/tree/master/data),\nit's a python based SVD parser and they have a large number of files available.\n\nFor ATDF you need to unzip the appropriate atpack from the\n[registry](https://packs.download.microchip.com).\n\n## Building\n\nregz targets zig master.\n\n```\ngit clone --recursive https://github.com/ZigEmbeddedGroup/regz.git\ncd regz\nzig build\n```\n\n## Using regz to generate code\n\nFiles provided may be either SVD or ATDF.\n\nProvide path on command line:\n```\nregz \u003cpath-to-svd\u003e \u003e my-chip.zig\n```\n\nProvide schema via stdin, must specify the schema type:\n```\ncat my-file.svd | regz --schema svd \u003e my-chip.zig\n```\n\n### Does this work for RISC-V?\n\nIt seems that manufacturers are using SVD to represent registers on their\nRISC-V based products despite it being an ARM standard. At best regz will\ngenerate the register definitions without an interrupt table (for now), if you\nrun into problems issues will be warmly welcomed!\n\n### What about MSP430?\n\nTI does have another type of XML-based register schema, it is also\nunimplemented but planned for support.\n\n### Okay but I want [some other architecture/format]\n\nThe main idea is to target what LLVM can target, however Zig's C backend in\nunderway so it's likely more exotic architectures could be reached in the\nfuture. If you know of any others we should look into, please make an issue!\n\n## Roadmap\n\n- SVD: mostly implemented and usable for mosts MCUs, but a few finishing touches in order to suss out any bugs:\n    - [x] nested clusters\n    - [ ] order generated exactly as defined in schema\n    - [ ] finalize derivation of different components\n    - [ ] comprehensive suite of tests\n    - [ ] RISC-V interrupt table generation\n- [x] ATDF: AVR's register schema format\n- [ ] insert name of Texus Insturment's register schema format for MSP430\n\n","funding_links":[],"categories":["Systems Programming"],"sub_categories":["Embedded Development"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZigEmbeddedGroup%2Fregz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FZigEmbeddedGroup%2Fregz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZigEmbeddedGroup%2Fregz/lists"}