{"id":31642286,"url":"https://github.com/raspberrypi/pico-zephyr","last_synced_at":"2025-10-07T03:58:01.901Z","repository":{"id":316416764,"uuid":"954043914","full_name":"raspberrypi/pico-zephyr","owner":"raspberrypi","description":"Setup scripts and starter examples for running the Zephyr RTOS on Raspberry Pi Pico and Pico 2, with build and debug support in VS Code.","archived":false,"fork":false,"pushed_at":"2025-09-24T13:45:31.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-09-24T14:23:07.786Z","etag":null,"topics":["examples","microcontroller","raspberry-pi-pico","raspberrypi","rtos","vscode","zephyr","zephyr-rtos"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raspberrypi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-24T13:31:32.000Z","updated_at":"2025-09-22T10:04:27.000Z","dependencies_parsed_at":"2025-09-24T14:24:24.008Z","dependency_job_id":"52d30771-dc4a-42be-a5f4-66bfc347432a","html_url":"https://github.com/raspberrypi/pico-zephyr","commit_stats":null,"previous_names":["raspberrypi/pico-zephyr"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/raspberrypi/pico-zephyr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi%2Fpico-zephyr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi%2Fpico-zephyr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi%2Fpico-zephyr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi%2Fpico-zephyr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raspberrypi","download_url":"https://codeload.github.com/raspberrypi/pico-zephyr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi%2Fpico-zephyr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717449,"owners_count":26033542,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["examples","microcontroller","raspberry-pi-pico","raspberrypi","rtos","vscode","zephyr","zephyr-rtos"],"created_at":"2025-10-07T03:57:56.090Z","updated_at":"2025-10-07T03:58:01.892Z","avatar_url":"https://github.com/raspberrypi.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pico Zephyr Project\n\nThis repo contains setup instructions and example for working with [Zephyr](https://zephyrproject.org/) on the Raspberry Pi Pico and Pico 2 boards.\n\nThe aim is to make it easy to get set up and going, with examples that point towards more complex applications.\n\n# Instructions\n\n## Installation\n\nFrom a blank Raspberry Pi image, open a terminal, create a folder and go into it:\n\n```bash\nmkdir dev\ncd dev\n```\n\nClone this repository:\n\n```bash\ngit clone https://github.com/raspberrypi/pico-zephyr.git\n```\n\nRun the setup script:\n\n```bash\ncd pico-zephyr\n./scripts/minimal_setup.sh\n```\n\nThis command will take a few minutes to run, as it is downloading and installing Zephyr dependencies.\n\nWhile the command is running, plug your Pico board in via the Debug Probe:\n\n![Debug Probe setup for Pico and Pico 2](https://www.raspberrypi.com/documentation/microcontrollers/images/labelled-wiring.jpg)\n\n## Building and Flashing\n\n### Command Line\n\nWhen the installation has finished, build the example image for your Pico:\n\n```bash\n# For Pico H and Pico WH using RP2040:\nbuild_rp2040.sh\n# For Pico 2 and Pico 2W using RP2350:\nbuild_rp2350.sh\n```\n\nBy default, this will use the UART serial port.\nTo use the USB serial port which also powers the Pico, add `usb_serial_port` when building:\n\n```bash\n# For Pico H and Pico WH using RP2040:\nbuild_rp2040.sh usb_serial_port\n# For Pico 2 and Pico 2W using RP2350:\nbuild_rp2350.sh usb_serial_port\n```\n\nNote that when switching between UART and USB serial, it may be necessary to delete the build directory for this change to take effect.\n\nFlash the Pico:\n```bash\n. .venv/bin/activate\nwest flash\n```\n\n### VSCode\n\nInstall VSCode with:\n\n```bash\n./scripts/vscode_setup.sh\n```\n\nThis will install VSCode and the [Cortex-Debug](https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug) extension.\n\nOpen this folder in VSCode. You can run `code .` from the command line.\n\nTo build, press `Ctrl+Shift+B` and select either `Zephyr Build RP2040` or `Zephyr Build RP2350` for the chip you are targetting.\nSelect `app`.\nSelect between the UART or USB for serial output.\nNote that when switching between UART and USB serial, it may be necessary to delete the build directory for this change to take effect.\nPress `Enter` to confirm the OpenOCD path or change it to the directory where OpenOCD is installed.\n\nTo flash, press `Ctrl+Shift+B` and select `Zephyr Flash`.\n\n### View Output\n\nView the output via serial port with:\n\n```bash\nminicom -D /dev/ttyACM0\n```\n\nYou may need to change `/dev/ttyACM0` to another value depending on the serial port the Debug Probe is recognised on.\nWhen the USB serial port is in use, it will may be found on a `/dev/ttyACM1`.\nFind the port using `ls /dev/tty*` while plugging and unplugging the debug probe or Pico board to see which values change.\n\n## Debugging\n\n### Command Line\n\nDebug with gdb:\n```bash\nwest debug\n...\n(gdb) break main\n(gdb) run\nThread 1 \"rp2350.dap.core0\" hit Breakpoint 1, main () at /home/user/dev/pico-zephyr/app/src/main.c:8\n8               printk(\"Zephyr Example Application for Pico\\n\");\n(gdb) n\n11                      printk(\"Running on %s...\\n\", CONFIG_BOARD);\n(gdb) n\n13                      k_sleep(K_MSEC(1000));\n(gdb) n\n10              while (1) {\n(gdb) n\n11                      printk(\"Running on %s...\\n\", CONFIG_BOARD);\n(gdb) n\n13                      k_sleep(K_MSEC(1000));\n(gdb) n\n```\n\n### VSCode\n\nInstall VSCode with:\n\n```bash\n./scripts/vscode_setup.sh\n```\n\nThis will install VSCode and the [Cortex-Debug](https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug) extension.\n\nOpen this folder in VSCode. You can run `code .` from the command line.\n\nTo debug, press `Ctrl+Shift+D` to open the `Run and Debug` pane.\n\nAt the top, next to the `Start Debugging` button, you can select `RP2040 Debug (Zephyr)` or `RP2350 Debug (Zephyr)`  for the chip you are targetting.\nPress `Enter` to confirm the OpenOCD path or change it to the directory where OpenOCD is installed.\n\nVSCode will then enter the debugging view starting in `main`, where you can step over each instruction and inspect the source code.\nFurther debugging instructions can be found [here](https://code.visualstudio.com/docs/debugtest/debugging#_debug-actions).\n\n# More Examples\n\n## Wifi Example\n\nThe `wifi_example` connects to a Wi-Fi network, pings `8.8.8.8`, and performs HTTP GET and POST requests with JSON.\n\nTo begin, create a file in `wifi_example/src/` called `wifi_info.h` and add the SSID and PSK for the Wi-Fi network:\n\n\u003e [!CAUTION]\n\u003e NEVER COMMIT OR SHARE THIS FILE PUBLICLY - This could be a big security issue and is for demonstration purposes only\n\n```c\n// wifi_example/src/wifi_info.h\n#define WIFI_SSID \"MySSID\"\n#define WIFI_PSK  \"my_password\"\n```\n\nThen build (currently only supports Pico W):\n\n```bash\n./build_rp2040_w.sh wifi_example\n```\n\nOr to build using VSCode, press `Ctrl+Shift+B` and select `Zephyr Build RP2040_W`, then enter `wifi_example` for the application option before continuing with the other steps.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraspberrypi%2Fpico-zephyr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraspberrypi%2Fpico-zephyr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraspberrypi%2Fpico-zephyr/lists"}