Skip to content

Example microzig project with zero dependencies outside of zig (there are dependencies in zig.zon but that's the point)

License

Notifications You must be signed in to change notification settings

Kytezign/one-key-microzig-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example microzig project with zero dependencies outside of zig (there are dependencies in zig.zon but that's the point)

Overview

Example project which attempts to make a one click build/test flow for vscode. The main goal is to reduce outside of zig build dependencies where possible. It has several features:

  • vscode based build calls
  • Leverage picotool to load uf2 files to the RP2040
  • Uses serial communication to the RP2040 device to request a reboot to boot-loader
  • Enables serial communication monitoring of the device.
  • Also shows disassembly step as a bonus

Disclaimer

This works for me but may not work for you. While I'd love any feedback, I'm not committed to support or develop this in any way. This has a dependency on the currently latest released version of microzig but very likely the main branch or a more recent release is going to be better - more bug fixes etc.

HW setup

The build & load flow is setup for a pico-probe based UART communication path. So the VID PID search routine is looking for that specific device. Other setups (including direct USB communication to the RP2040 under development) will need different configurations.

VSCode build flow

This project leverages the node-terminal built in vscode launch type (no extra extensions) to call different zig build commands. I'm not clear on what, if any side effects there are from this. Example from launch.json:

        {
            "command": "clear; zig build load",
            "name": "build load",
            "request": "launch",
            "type": "node-terminal"
        },

Picotool setup

picotool is a tool for working with RP2040/RP2350 binaries, and interacting with RP2040/RP2350 devices when they are in BOOTSEL mode.

https://github.com/raspberrypi/picotoolkk

Getting picotool (if needed)

The build flow is setup to pull picotool (for Linux only right now) from the raspberrypi release and install it as pre-built binaries (could not get the build working with just zig) If picotool is already available it will not pull the package. The flow then calls picotool load and picotool reboot to get the new version running.

https://github.com/raspberrypi/pico-sdk-tools/releases

Serial communication

Serial communication is done using the available serial package from the microzig group. A very basic program finds the appropriate serial device, and opens the connection. Currently it can only print out send data but it could be expanded for more interaction. It also optionally can open the serial link and send a reboot command - assuming the device is setup to receive that command.

https://github.com/ZigEmbeddedGroup/serial

Disassembly

Disassembly is a bonus here which relies on an existing system tool (not in the spirit of this example). Maybe in the future this will be improved.

About

Example microzig project with zero dependencies outside of zig (there are dependencies in zig.zon but that's the point)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages