Skip to content

Zig on Raspberry Pi Pico (2 (W)) using Pico SDK with CMake

License

Notifications You must be signed in to change notification settings

playday3008/ZigPicoCMake

Repository files navigation

ZigPicoCMake

Build Status

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.

Build

To build the project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/playday3008/ZigPicoCMake
  2. Navigate to the project directory:

    cd ZigPicoCMake
  3. Run zig build

    zig build

    flags are:

    • -Dboard <board> - Specify the board to build for. Default is pico_w, check valid boards in pico.zig
    • -Dbuild_dir <build_dir> - Specify the build directory. Default is ./build/<board>.

    Check zig build --help for more options.

Supported commands

  • zig build - Build the project
  • zig build uf2 - Build the project and generate a UF2 file (default)
  • zig build clean - Clean the build directory

Quirks

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 @cImports (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-run zig build with the desired options.

Contributing

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.

Acknowledgements

Tools:

Codebases:

Toolchains:

About

Zig on Raspberry Pi Pico (2 (W)) using Pico SDK with CMake

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published