{"id":16312713,"url":"https://github.com/stepchowfun/pico","last_synced_at":"2025-07-07T07:07:49.809Z","repository":{"id":248342218,"uuid":"828436238","full_name":"stepchowfun/pico","owner":"stepchowfun","description":"Scaffolding for programming and debugging a Raspberry Pi Pico or Pico W.","archived":false,"fork":false,"pushed_at":"2025-03-20T09:13:33.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-07T07:07:13.546Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stepchowfun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2024-07-14T06:25:42.000Z","updated_at":"2025-03-20T09:13:34.000Z","dependencies_parsed_at":"2024-08-05T07:41:19.699Z","dependency_job_id":"3bc5b976-48bd-4f75-9941-d2397179a228","html_url":"https://github.com/stepchowfun/pico","commit_stats":null,"previous_names":["stepchowfun/pico"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stepchowfun/pico","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepchowfun%2Fpico","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepchowfun%2Fpico/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepchowfun%2Fpico/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepchowfun%2Fpico/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stepchowfun","download_url":"https://codeload.github.com/stepchowfun/pico/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepchowfun%2Fpico/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264032253,"owners_count":23546802,"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":[],"created_at":"2024-10-10T21:48:54.652Z","updated_at":"2025-07-07T07:07:49.761Z","avatar_url":"https://github.com/stepchowfun.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry Pi Pico example\n\n[![Build status](https://github.com/stepchowfun/pico/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/stepchowfun/pico/actions?query=branch%3Amain)\n\nThis repository contains the scaffolding for programming and debugging a [Raspberry Pi Pico or Pico W](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html).\n\nIt currently has a simple demo program that reads the raw angle from an AS5048A magnetic rotary position sensor over SPI and emits some output via UART and an LED.\n\n## Instructions\n\n### Preliminaries\n\nInstall the following tools:\n\n- GDB (e.g., with `brew install arm-none-eabi-gdb`)\n- Minicom (e.g., with `brew install minicom`)\n- OpenOCD (e.g., with `brew install openocd`)\n- Toast (e.g., with `brew install toast`)\n\nThen initialize the submodules with:\n\n   ```sh\n   git submodule update --init\n   (cd pico-sdk \u0026\u0026 git submodule update --init)\n   ```\n\n**Note:** It might be tempting to just run `git submodule update --init --recursive`, but that would take a long time and download more submodules than necessary.\n\n### Build the project\n\nYou can build the project by running `toast`. This will produce two output files: `out.elf` and `out.uf2`.\n\n### Program the Raspberry Pi Pico\n\nThere are two ways to flash the code onto the microcontroller. The first way is via USB:\n\n1. Plug the Raspberry Pi Pico into a USB port while holding the `BOOTSEL` button.\n2. Run this command, adjusting the path to the device as necessary:\n\n   ```sh\n   cp image.uf2 /Volumes/RPI-RP2/\n   ```\n\nThe code is now running. To flash new code, unplug the Pico and start again.\n\nThe second way to program it is with a Raspberry Pi Debug Probe that is connected to the Pico's SWD debug port:\n\n```sh\nopenocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c 'adapter speed 5000; program out.elf verify reset exit'\n```\n\nIf you want to restart the code without reprogramming the microcontroller, run:\n\n```sh\nopenocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c 'adapter speed 5000; init; reset; exit'\n```\n\n### Debug the code with a Raspberry Pi Debug Probe\n\nTo debug the code, first build the code in debug mode:\n\n```\nBUILD_TYPE=Debug toast\n```\n\nThen flash the code onto the Raspberry Pi Pico with the instructions above.\n\nNow run the following command to start GDB servers:\n\n```sh\nopenocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c 'adapter speed 5000'\n```\n\nThen start GDB:\n\n```sh\narm-none-eabi-gdb\n```\n\nAttach to one of the two cores with `core0` or `core1`. At this point the program will pause. The following commands are helpful:\n- `continue` (`c`): Resume execution\n- `^C`: Pause execution\n- `next` (`n`): Execute one step, treating subroutines as a single step\n- `step` (`s`): Execute one step, including individual steps in subroutines\n- `print x` (`p x`): Print the value of the variable named `x`\n- `break` (`b`): Set a breakpoint\n- `delete` (`d`): Delete a breakpoint\n- `disable`: Disable a breakpoint\n- `enable`: Enable a breakpoint\n- `list .` (`l .`): Show the code at the current location\n- `where`: Show the current stack trace\n- `finish`: Run the current function to completion\n- `quit` (`q`): Quit\n\n### Run a serial console\n\nYou can use a serial console to connect to the Raspberry Pi Pico or a Raspberry Pi Debug Probe connected to the Pico's UART pins:\n\n1. Run Minicom, adjusting the path to the device as necessary:\n\n   ```\n   minicom --device /dev/tty.usbmodem*\n   ```\n2. Press Meta + Q to quit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepchowfun%2Fpico","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstepchowfun%2Fpico","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepchowfun%2Fpico/lists"}