This repository provides a Zig-based build system for the Raspberry Pi Pico SDK, leveraging the CMake integration with Zig. It is designed to be compatible with both ARM and RISC-V architectures.
To build the project, follow these steps:
-
Clone the repository:
git clone https://github.com/playday3008/ZigPicoCMake
-
Navigate to the project directory:
cd ZigPicoCMake
-
Run
zig build
zig build
flags are:
-Dboard <board>
- Specify the board to build for. Default ispico_w
, check valid boards inpico.zig
-Dbuild_dir <build_dir>
- Specify the build directory. Default is./build/<board>
.
Check
zig build --help
for more options.
zig build
- Build the projectzig build uf2
- Build the project and generate a UF2 file (default)zig build clean
- Clean the build directory
Check builds status, so you can know what board builds and what doesn't.
- Building of code which depends on functions that uses inline volatile assembly isn't working because zig can't currently translate it, tracking issue: ziglang/zig#18537
- Same situation with C assertions, they are depend on
__FILE__
macro, which isn't supported by Zig. - Hazard3 isn't completely supported, currently using SiFive E21 as a workaround.
- ZLS seems to can't figure out
@cImport
s (sometimes), so, use your Sixth sense or Pico SDK Documentation to find the right headers with right functions. - Clean reconfiguration is not supported, you need to manually remove
build
directory and re-runzig build
with the desired options.
Contributions are welcome! Feel free to open an issue or a pull request. Feedback is also appreciated. As I'm still learning Zig, I'm open to suggestions on how to improve the codebase.
Tools:
Codebases:
- zig-pico-cmake - Initial inspiration
- Pico SDK - Original SDK
Toolchains: