Skip to content

Conversation

@evgenykor
Copy link
Contributor

  • Scaffold Zig project under zig/ with build.zig producing static lib (libalpakka_zig.a).
  • Implement C-ABI function zig_vector_normalize and two tiny Zig tests.
  • Add header src/headers/zig_abi.h; delegate vector_normalize() in src/vector.c to Zig.
  • Extend CMake to build/link Zig lib (custom target ziglib) into RP2040 firmware.
  • Update Makefile clean to remove Zig artifacts (zig/zig-out, zig/.zig-cache).
  • Update .gitignore for Zig build outputs.

Build:

  • Firmware: DEVICE=alpakka_v1 make succeeds.
  • Tests: zig test zig/src/lib.zig pass.

- Scaffold Zig project under zig/ with build.zig producing static lib (libalpakka_zig.a).
- Implement C-ABI function zig_vector_normalize and two tiny Zig tests.
- Add header src/headers/zig_abi.h; delegate vector_normalize() in src/vector.c to Zig.
- Extend CMake to build/link Zig lib (custom target ziglib) into RP2040 firmware.
- Update Makefile clean to remove Zig artifacts (zig/zig-out, zig/.zig-cache).
- Update .gitignore for Zig build outputs.

Build:
- Firmware: DEVICE=alpakka_v1 make succeeds.
- Tests: zig test zig/src/lib.zig pass.
@marcos-diaz
Copy link
Contributor

marcos-diaz commented Aug 15, 2025

Ha! great minds think alike!

I had a very similar prototype branch in which I used the same approach (letting pico-sdk/cmake/gcc doing the final linking but incrementally putting everything we do in a zig library).

https://github.com/inputlabs/alpakka_firmware/compare/zig-proto?expand=1

I replaced some of the I2C core functions just to verify it wasn't crashing.

Cmake was a little bit more clean because having compilation parameters and architecture on build.zig

Also doing bidirectional calls by defining some temporal interfaces.

But basically is the same.

@evgenykor
Copy link
Contributor Author

Cool! So what are your thinking? Do you think it is worth to make such transition? (i.e. to Zig)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants