third_party/pico-sdk: Pi Pico GN build

Introduces a GN-based build for the Raspberry Pi Pico.

Usage instructions:
 * clone the Pico SDK repo and then point PICO_SRC_DIR to
   the directory that the Pico SDK was cloned to.
 * ninja -C out

Change-Id: I4ff058b1f32c737706a8625c916c52c21275e88f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/88806
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/BUILD.gn b/BUILD.gn
index c6ac773..4f11d5b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -12,6 +12,7 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
+import("//build_overrides/pi_pico.gni")
 import("//build_overrides/pigweed.gni")
 
 import("$dir_pw_arduino_build/arduino.gni")
@@ -50,6 +51,7 @@
     ":check_modules",
     ":docs",
     ":host",
+    ":pi_pico",
     ":python.lint",
     ":python.tests",
     ":static_analysis",
@@ -102,6 +104,12 @@
   deps = [ "$dir_pw_system:system_examples" ]
 }
 
+group("pi_pico") {
+  if (PICO_SRC_DIR != "") {
+    deps = [ ":pw_module_tests(targets/rp2040)" ]
+  }
+}
+
 _internal_toolchains = "$dir_pigweed/targets/host/pigweed_internal"
 
 # This template generates a group that builds pigweed_default with a particular
diff --git a/build_overrides/pi_pico.gni b/build_overrides/pi_pico.gni
new file mode 100644
index 0000000..e6343f6
--- /dev/null
+++ b/build_overrides/pi_pico.gni
@@ -0,0 +1,23 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+declare_args() {
+  # Since the GN build lives in Pigweed for now, PICO_ROOT is
+  # Always relative to Pigweed's root.
+  PICO_ROOT = "${dir_pw_third_party}/pico_sdk"
+}
+
+import("${PICO_ROOT}/pi_pico.gni")
diff --git a/docs/BUILD.gn b/docs/BUILD.gn
index 3fffce5..bd29906 100644
--- a/docs/BUILD.gn
+++ b/docs/BUILD.gn
@@ -63,6 +63,7 @@
     "$dir_pigweed/targets/host_device_simulator:target_docs",
     "$dir_pigweed/targets/lm3s6965evb_qemu:target_docs",
     "$dir_pigweed/targets/mimxrt595_evk:target_docs",
+    "$dir_pigweed/targets/rp2040:target_docs",
     "$dir_pigweed/targets/stm32f429i_disc1:target_docs",
     "$dir_pigweed/targets/stm32f429i_disc1_stm32cube:target_docs",
   ]
diff --git a/targets/rp2040/BUILD.bazel b/targets/rp2040/BUILD.bazel
new file mode 100644
index 0000000..76bd682
--- /dev/null
+++ b/targets/rp2040/BUILD.bazel
@@ -0,0 +1,36 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+load(
+    "//pw_build:pigweed.bzl",
+    "pw_cc_library",
+)
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+# This is just a stub to silence warnings saying that pico_logging_test_main.cc
+# is missing from the bazel build. There's no plans yet to do a Bazel build for
+# the Pi Pico.
+pw_cc_library(
+    name = "pico_logging_test_main",
+    srcs = [
+        "pico_logging_test_main.cc",
+    ],
+    deps = [
+        "//pw_unit_test",
+        "//pw_unit_test:logging_event_handler",
+    ],
+)
diff --git a/targets/rp2040/BUILD.gn b/targets/rp2040/BUILD.gn
new file mode 100644
index 0000000..9f0bbdb
--- /dev/null
+++ b/targets/rp2040/BUILD.gn
@@ -0,0 +1,79 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+import("$dir_pw_docgen/docs.gni")
+import("$dir_pw_toolchain/arm_gcc/toolchains.gni")
+import("$dir_pw_toolchain/generate_toolchain.gni")
+
+if (current_toolchain != default_toolchain) {
+  pw_source_set("pico_logging_test_main") {
+    # Required because the pico SDK can't properly propagate -Wno-undef and
+    # -Wno-unused-function because of Pigweed's very unusual default_configs
+    # behavior.
+    remove_configs = [ "$dir_pw_build:strict_warnings" ]
+    deps = [
+      "$PICO_ROOT/src/common/pico_base",
+      "$PICO_ROOT/src/common/pico_stdlib",
+      "$dir_pw_unit_test:logging_event_handler",
+      "$dir_pw_unit_test:pw_unit_test",
+    ]
+    sources = [ "pico_logging_test_main.cc" ]
+  }
+}
+
+generate_toolchain("rp2040") {
+  _excluded_members = [
+    "defaults",
+    "name",
+  ]
+  _toolchain_base = pw_toolchain_arm_gcc.cortex_m0plus_size_optimized
+  forward_variables_from(_toolchain_base, "*", _excluded_members)
+  final_binary_extension = ".elf"
+
+  # For now, no Pigweed configurations set up.
+  defaults = {
+    forward_variables_from(_toolchain_base.defaults, "*")
+
+    pw_build_EXECUTABLE_TARGET_TYPE = "pico_executable"
+    pw_build_EXECUTABLE_TARGET_TYPE_FILE =
+        get_path_info("pico_executable.gni", "abspath")
+    pw_unit_test_MAIN = "$dir_pigweed/targets/rp2040:pico_logging_test_main"
+    pw_assert_BACKEND = dir_pw_assert_basic
+    pw_log_BACKEND = dir_pw_log_basic
+    pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio"
+
+    pw_sync_INTERRUPT_SPIN_LOCK_BACKEND =
+        "$dir_pw_sync_baremetal:interrupt_spin_lock"
+    pw_sync_MUTEX_BACKEND = "$dir_pw_sync_baremetal:mutex"
+
+    # Silence GN variable overwrite warning.
+    pw_build_LINK_DEPS = []
+
+    pw_build_LINK_DEPS = [
+      "$dir_pw_assert:impl",
+      "$dir_pw_log:impl",
+    ]
+
+    current_cpu = "arm"
+    current_os = ""
+  }
+}
+
+pw_doc_group("target_docs") {
+  sources = [ "target_docs.rst" ]
+}
diff --git a/targets/rp2040/pico_executable.gni b/targets/rp2040/pico_executable.gni
new file mode 100644
index 0000000..f8afcf1
--- /dev/null
+++ b/targets/rp2040/pico_executable.gni
@@ -0,0 +1,25 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+# Executable wrapper that allows the 2nd stage bootloader to strip link deps.
+template("pico_executable") {
+  target("executable", target_name) {
+    forward_variables_from(invoker, "*")
+    if (defined(no_link_deps) && no_link_deps) {
+      public_deps -= [ "$dir_pw_build:link_deps" ]
+    }
+  }
+}
diff --git a/targets/rp2040/pico_logging_test_main.cc b/targets/rp2040/pico_logging_test_main.cc
new file mode 100644
index 0000000..1c5c92c
--- /dev/null
+++ b/targets/rp2040/pico_logging_test_main.cc
@@ -0,0 +1,24 @@
+// Copyright 2022 The Pigweed Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//     https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+#include "pico/stdlib.h"
+#include "pw_unit_test/framework.h"
+#include "pw_unit_test/logging_event_handler.h"
+
+int main() {
+  setup_default_uart();
+  pw::unit_test::LoggingEventHandler handler;
+  pw::unit_test::RegisterEventHandler(&handler);
+  return RUN_ALL_TESTS();
+}
diff --git a/targets/rp2040/target_docs.rst b/targets/rp2040/target_docs.rst
new file mode 100644
index 0000000..0546f72
--- /dev/null
+++ b/targets/rp2040/target_docs.rst
@@ -0,0 +1,63 @@
+.. _target-raspberry-pi-pico:
+
+-----------------
+Raspberry Pi Pico
+-----------------
+.. warning::
+  This target is in an early state and is under active development. Usability
+  is not very polished, and many features/configuration options that work in
+  upstream Pi Pico CMake build have not yet been ported to the GN build.
+
+-----
+Setup
+-----
+To use this target, Pigweed must be set up to build against the Raspberry Pi
+Pico SDK. This can be downloaded via ``pw package``, and then the build must be
+manually configured to point to the location of the downloaded SDK.
+
+.. code:: sh
+
+  pw package install pico_sdk
+
+  gn args out
+    # Add these lines, replacing ${PW_ROOT} with the path to the location that
+    # Pigweed is checked out at.
+    PICO_SRC_DIR = "${PW_ROOT}/.environment/packages/pico_sdk"
+
+-----
+Usage
+-----
+The Pi Pico is currently configured to output logs and test results over UART
+via GPIO 1 and 2 (TX and RX, respectively) at a baud rate of 115200. Because
+of this, you'll need a USB TTL adapter to communicate with the Pi Pico.
+
+Once the pico SDK is configured, the Pi Pico will build as part of the default
+GN build:
+
+.. code:: sh
+
+  ninja -C out
+
+Pigweed's build will produce ELF files for each unit test built for the Pi Pico.
+While ELF files can be flashed to a Pi Pico via SWD, it's slightly easier to
+use the Pi Pico's bootloader to flash the firmware as a UF2 file.
+
+Pigweed currently does not yet build/provide the elf2uf2 utility used to convert
+ELF files to UF2 files. This tool can be built from within the Pi Pico SDK with
+the following command:
+
+.. code:: sh
+
+  mkdir build && cd build && cmake -G Ninja ../ && ninja
+  # Copy the tool so it's visible in your PATH.
+  cp elf2uf2/elf2uf2 $HOME/bin/elf2uf2
+
+Flashing
+========
+Flashing the Pi Pico is as easy as 1-2-3:
+
+#. Create a UF2 file from an ELF file using ``elf2uf2``.
+#. While holding the button on the Pi Pico, connect the Pico to your computer
+   via the micro USB port.
+#. Copy the UF2 to the RPI-RP2 volume that enumerated when you connected the
+   Pico.
diff --git a/third_party/pico_sdk/gn/BUILD.gn b/third_party/pico_sdk/gn/BUILD.gn
new file mode 100644
index 0000000..f411b80
--- /dev/null
+++ b/third_party/pico_sdk/gn/BUILD.gn
@@ -0,0 +1,27 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+# These warnings need to be disabled when using strict warnings.
+#
+# TODO(amontanez): Just applying these flags to Pi Pico source sets does not
+# work because of Pigweed's default_configs notion and how it orders flags.
+# Removing Pigweed's strict  warnings config is the only working solution for
+# now.
+config("disable_warnings") {
+  cflags = [
+    "-Wno-undef",
+    "-Wno-unused-function",
+  ]
+  asmflags = cflags
+}
diff --git a/third_party/pico_sdk/gn/generate_config_header.gni b/third_party/pico_sdk/gn/generate_config_header.gni
new file mode 100644
index 0000000..0cbc4e0
--- /dev/null
+++ b/third_party/pico_sdk/gn/generate_config_header.gni
@@ -0,0 +1,66 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# Generates a pico/config_autogen.h file as part of a source set that provides
+# the required include directory as a public config.
+#
+# Example contents:
+#
+#   // AUTO GENERATED BY A GN generate_config_header TARGET
+#   #include "boards/pico.h"
+#   #include "cmsis/rename_exceptions.h"
+#
+# Arguments:
+#   config_header_files (required): Includes that should be written to the
+#     generated header file.
+template("generate_config_header") {
+  assert(defined(invoker.config_header_files), "No headers provided")
+
+  _generated_header_dir = "${target_gen_dir}/${target_name}_include"
+  _generated_header_path = "${_generated_header_dir}/pico/config_autogen.h"
+
+  # Provide the include path so the header is exposed when targets depend on
+  # the generate_config_header target.
+  config("${target_name}.public_include_dirs") {
+    include_dirs = [ "${_generated_header_dir}" ]
+  }
+
+  # Actually generate config_autogen.h.
+  generated_file("${target_name}.generated_header") {
+    outputs = [ "${_generated_header_path}" ]
+    _lines = [ "// AUTO GENERATED BY A GN generate_config_header TARGET" ]
+    foreach(_header, invoker.config_header_files) {
+      _lines += [ "#include \"${_header}\"" ]
+    }
+
+    # Join with newline.
+    _NEWLINE_CHAR = "$0x0A"
+    contents = string_join(_NEWLINE_CHAR, _lines)
+  }
+
+  # This source set bundles up the generated header such that depending on
+  # this template will allow targets to include "pico/config_autogen.h".
+  pw_source_set("${target_name}") {
+    remove_configs = [ "$dir_pw_build:strict_warnings" ]
+    public_configs = [ ":${target_name}.public_include_dirs" ]
+    deps = [ ":${target_name}.generated_header" ]
+    public = [ "${_generated_header_path}" ]
+    forward_variables_from(invoker, "*", [ "config_header_files" ])
+  }
+}
diff --git a/third_party/pico_sdk/pi_pico.gni b/third_party/pico_sdk/pi_pico.gni
new file mode 100644
index 0000000..dde153f
--- /dev/null
+++ b/third_party/pico_sdk/pi_pico.gni
@@ -0,0 +1,34 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+declare_args() {
+  # PIGWEED ONLY: Since Pigweed doesn't host 3p code, this points to the actual
+  # location of the Pi Pico source. If the GN build is ever upstreamed, this
+  # variable would not be needed.
+  PICO_SRC_DIR = ""
+}
+
+# Actual Pi Pico build configuration options.
+declare_args() {
+  PICO_BARE_METAL = false
+  PICO_BOARD = "\"rp2040\""
+  PICO_BOARD_HEADER_DIR = get_path_info("src/boards", "abspath")
+
+  # TODO(amontanez): This needs to be thought through fully.
+  PICO_GENERATED_CONFIG = get_path_info("src/rp2040:rp2040_config", "abspath")
+
+  # TODO(amontanez): This needs to be thought through fully, but can wait until
+  # a Pi Pico successor that requires it.
+  PICO_PLATFORM_DIR = get_path_info("src/rp2040", "abspath")
+}
diff --git a/third_party/pico_sdk/src/BUILD.gn b/third_party/pico_sdk/src/BUILD.gn
new file mode 100644
index 0000000..62b3952
--- /dev/null
+++ b/third_party/pico_sdk/src/BUILD.gn
@@ -0,0 +1,23 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+# TODO(amontanez): If a successor to the RP2040 comes out, this might need to
+# be a little smarter about what code is pulled in.
+group("pico_sdk") {
+  public_deps = [
+    "common",
+    "rp2040",
+    "rp2_common",
+  ]
+}
diff --git a/third_party/pico_sdk/src/boards/BUILD.gn b/third_party/pico_sdk/src/boards/BUILD.gn
new file mode 100644
index 0000000..d92764e
--- /dev/null
+++ b/third_party/pico_sdk/src/boards/BUILD.gn
@@ -0,0 +1,58 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/boards"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("boards") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public = [
+    "${_CWD}/include/boards/adafruit_feather_rp2040.h",
+    "${_CWD}/include/boards/adafruit_itsybitsy_rp2040.h",
+    "${_CWD}/include/boards/adafruit_qtpy_rp2040.h",
+    "${_CWD}/include/boards/adafruit_trinkey_qt2040.h",
+    "${_CWD}/include/boards/arduino_nano_rp2040_connect.h",
+    "${_CWD}/include/boards/melopero_shake_rp2040.h",
+    "${_CWD}/include/boards/none.h",
+    "${_CWD}/include/boards/pico.h",
+    "${_CWD}/include/boards/pimoroni_interstate75.h",
+    "${_CWD}/include/boards/pimoroni_keybow2040.h",
+    "${_CWD}/include/boards/pimoroni_pga2040.h",
+    "${_CWD}/include/boards/pimoroni_picolipo_16mb.h",
+    "${_CWD}/include/boards/pimoroni_picolipo_4mb.h",
+    "${_CWD}/include/boards/pimoroni_picosystem.h",
+    "${_CWD}/include/boards/pimoroni_plasma2040.h",
+    "${_CWD}/include/boards/pimoroni_tiny2040.h",
+    "${_CWD}/include/boards/pybstick26_rp2040.h",
+    "${_CWD}/include/boards/sparkfun_micromod.h",
+    "${_CWD}/include/boards/sparkfun_promicro.h",
+    "${_CWD}/include/boards/sparkfun_thingplus.h",
+    "${_CWD}/include/boards/vgaboard.h",
+    "${_CWD}/include/boards/waveshare_rp2040_lcd_0.96.h",
+    "${_CWD}/include/boards/waveshare_rp2040_plus_16mb.h",
+    "${_CWD}/include/boards/waveshare_rp2040_plus_4mb.h",
+    "${_CWD}/include/boards/waveshare_rp2040_zero.h",
+  ]
+}
diff --git a/third_party/pico_sdk/src/common/BUILD.gn b/third_party/pico_sdk/src/common/BUILD.gn
new file mode 100644
index 0000000..3dda4de
--- /dev/null
+++ b/third_party/pico_sdk/src/common/BUILD.gn
@@ -0,0 +1,34 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+group("common") {
+  public_deps = [
+    "boot_picoboot",
+    "boot_uf2",
+    "pico_base",
+    "pico_usb_reset_interface",
+  ]
+
+  if (!PICO_BARE_METAL) {
+    public_deps += [
+      "pico_binary_info",
+      "pico_bit_ops",
+      "pico_divider",
+      "pico_stdlib",
+      "pico_sync",
+      "pico_time",
+      "pico_util",
+    ]
+  }
+}
diff --git a/third_party/pico_sdk/src/common/boot_picoboot/BUILD.gn b/third_party/pico_sdk/src/common/boot_picoboot/BUILD.gn
new file mode 100644
index 0000000..2e141d4
--- /dev/null
+++ b/third_party/pico_sdk/src/common/boot_picoboot/BUILD.gn
@@ -0,0 +1,35 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/boot_picoboot"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("boot_picoboot") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+
+  # Optionally requires a dep on "pico/platform.h"
+
+  public = [ "${_CWD}/include/boot/picoboot.h" ]
+}
diff --git a/third_party/pico_sdk/src/common/boot_uf2/BUILD.gn b/third_party/pico_sdk/src/common/boot_uf2/BUILD.gn
new file mode 100644
index 0000000..2e6468b
--- /dev/null
+++ b/third_party/pico_sdk/src/common/boot_uf2/BUILD.gn
@@ -0,0 +1,32 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/boot_uf2"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("boot_uf2") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public = [ "${_CWD}/include/boot/uf2.h" ]
+}
diff --git a/third_party/pico_sdk/src/common/pico_base/BUILD.gn b/third_party/pico_sdk/src/common/pico_base/BUILD.gn
new file mode 100644
index 0000000..73e176d
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_base/BUILD.gn
@@ -0,0 +1,66 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/pico_base"
+
+import("generate_version_header.gni")
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+config("board_define") {
+  defines = [
+    "PICO_BOARD=${PICO_BOARD}",
+    "PICO_ON_DEVICE=1",
+    "PICO_NO_HARDWARE=0",
+    "PICO_BUILD=1",
+  ]
+}
+
+generate_version_header("version") {
+  version_major = PICO_SDK_VERSION_MAJOR
+  version_minor = PICO_SDK_VERSION_MINOR
+  version_revision = PICO_SDK_VERSION_REVISION
+  version_string = PICO_SDK_VERSION_STRING
+}
+
+pw_source_set("pico_base") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [
+    ":board_define",
+    ":public_include_dirs",
+  ]
+  public = [
+    "${_CWD}/include/pico.h",
+    "${_CWD}/include/pico/assert.h",
+    "${_CWD}/include/pico/config.h",
+    "${_CWD}/include/pico/error.h",
+    "${_CWD}/include/pico/types.h",
+  ]
+  public_deps = [
+    ":version",
+    "${PICO_GENERATED_CONFIG}",
+    "${PICO_ROOT}/src/rp2_common/pico_platform:headers",
+  ]
+  allow_circular_includes_from =
+      [ "${PICO_ROOT}/src/rp2_common/pico_platform:headers" ]
+}
diff --git a/third_party/pico_sdk/src/common/pico_base/generate_version_header.gni b/third_party/pico_sdk/src/common/pico_base/generate_version_header.gni
new file mode 100644
index 0000000..189bf7e
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_base/generate_version_header.gni
@@ -0,0 +1,80 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+declare_args() {
+  PICO_SDK_VERSION_MAJOR = 1
+  PICO_SDK_VERSION_MINOR = 3
+  PICO_SDK_VERSION_REVISION = 0
+}
+
+# GN-ism: To reference earlier args, this needs to be in a separate block.
+declare_args() {
+  PICO_SDK_VERSION_STRING = "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}"
+}
+
+template("generate_version_header") {
+  assert(defined(invoker.version_major))
+  assert(defined(invoker.version_minor))
+  assert(defined(invoker.version_revision))
+  assert(defined(invoker.version_string))
+
+  _generated_header_dir = "${target_gen_dir}/${target_name}_include"
+  _generated_header_path = "${_generated_header_dir}/pico/version.h"
+
+  config("${target_name}.public_include_dirs") {
+    include_dirs = [ "${_generated_header_dir}" ]
+  }
+
+  generated_file("${target_name}.generated_header") {
+    outputs = [ "${_generated_header_path}" ]
+    _lines = [
+      "// ---------------------------------------",
+      "// THIS FILE IS AUTOGENERATED; DO NOT EDIT",
+      "// ---------------------------------------",
+      "",
+      "#ifndef _PICO_VERSION_H",
+      "#define _PICO_VERSION_H",
+      "",
+      "#define PICO_SDK_VERSION_MAJOR    ${invoker.version_major}",
+      "#define PICO_SDK_VERSION_MINOR    ${invoker.version_minor}",
+      "#define PICO_SDK_VERSION_REVISION ${invoker.version_revision}",
+      "#define PICO_SDK_VERSION_STRING   \"${invoker.version_string}\"",
+      "",
+      "#endif",
+    ]
+
+    # Join with newline.
+    _NEWLINE_CHAR = "$0x0A"
+    contents = string_join(_NEWLINE_CHAR, _lines)
+  }
+
+  pw_source_set("${target_name}") {
+    remove_configs = [ "$dir_pw_build:strict_warnings" ]
+    public_configs = [ ":${target_name}.public_include_dirs" ]
+    deps = [ ":${target_name}.generated_header" ]
+    public = [ "${_generated_header_path}" ]
+    forward_variables_from(invoker,
+                           "*",
+                           [
+                             "version_major",
+                             "version_minor",
+                             "version_revision",
+                             "version_string",
+                           ])
+  }
+}
diff --git a/third_party/pico_sdk/src/common/pico_binary_info/BUILD.gn b/third_party/pico_sdk/src/common/pico_binary_info/BUILD.gn
new file mode 100644
index 0000000..86fbbb5
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_binary_info/BUILD.gn
@@ -0,0 +1,38 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/pico_binary_info"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_binary_info") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/common/pico_base" ]
+  public = [
+    "${_CWD}/include/pico/binary_info.h",
+    "${_CWD}/include/pico/binary_info/code.h",
+    "${_CWD}/include/pico/binary_info/defs.h",
+    "${_CWD}/include/pico/binary_info/structure.h",
+  ]
+}
diff --git a/third_party/pico_sdk/src/common/pico_bit_ops/BUILD.gn b/third_party/pico_sdk/src/common/pico_bit_ops/BUILD.gn
new file mode 100644
index 0000000..7a55fb1
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_bit_ops/BUILD.gn
@@ -0,0 +1,33 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/pico_bit_ops"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_bit_ops") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/common/pico_base" ]
+  public = [ "${_CWD}/include/pico/bit_ops.h" ]
+}
diff --git a/third_party/pico_sdk/src/common/pico_divider/BUILD.gn b/third_party/pico_sdk/src/common/pico_divider/BUILD.gn
new file mode 100644
index 0000000..dea76d4
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_divider/BUILD.gn
@@ -0,0 +1,36 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/pico_divider"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_divider") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2_common/hardware_divider",
+  ]
+  public = [ "${_CWD}/include/pico/divider.h" ]
+}
diff --git a/third_party/pico_sdk/src/common/pico_stdlib/BUILD.gn b/third_party/pico_sdk/src/common/pico_stdlib/BUILD.gn
new file mode 100644
index 0000000..721254d
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_stdlib/BUILD.gn
@@ -0,0 +1,59 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/pico_stdlib"
+
+import("pico_stdio.gni")
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+  defines = [ "${PICO_STDIO}=1" ]
+}
+
+pw_source_set("headers") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_time",
+    "${PICO_ROOT}/src/rp2_common/hardware_gpio",
+    "${PICO_ROOT}/src/rp2_common/hardware_uart",
+    "${PICO_ROOT}/src/rp2_common/pico_stdio",
+  ]
+
+  if (PICO_STDIO == ENUM_LIB_PICO_STDIO.UART) {
+    public_deps += [ "${PICO_ROOT}/src/rp2_common/pico_stdio_uart" ]
+  } else if (PICO_STDIO == ENUM_LIB_PICO_STDIO.USB) {
+    public_deps += [ "${PICO_ROOT}/src/rp2_common/pico_stdio_usb" ]
+  } else if (PICO_STDIO == ENUM_LIB_PICO_STDIO.SEMIHOSTING) {
+    public_deps += [ "${PICO_ROOT}/src/rp2_common/pico_stdio_semihosting" ]
+  }
+
+  public = [ "include/pico/stdlib.h" ]
+}
+
+pw_source_set("pico_stdlib") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_deps = [ ":headers" ]
+
+  # Ensure the pico stdlib implementation is linked in.
+  deps = [ "${PICO_ROOT}/src/rp2_common/pico_stdlib" ]
+}
diff --git a/third_party/pico_sdk/src/common/pico_stdlib/pico_stdio.gni b/third_party/pico_sdk/src/common/pico_stdlib/pico_stdio.gni
new file mode 100644
index 0000000..8d1f27b
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_stdlib/pico_stdio.gni
@@ -0,0 +1,24 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+ENUM_LIB_PICO_STDIO = {
+  UART = "LIB_PICO_STDIO_UART"
+  USB = "LIB_PICO_STDIO_USB"
+  SEMIHOSTING = "LIB_PICO_STDIO_SEMIHOSTING"
+}
+
+# TODO(amontanez): This looks like a facade. Rethink?
+declare_args() {
+  PICO_STDIO = ENUM_LIB_PICO_STDIO.UART
+}
diff --git a/third_party/pico_sdk/src/common/pico_sync/BUILD.gn b/third_party/pico_sdk/src/common/pico_sync/BUILD.gn
new file mode 100644
index 0000000..4fe1f46
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_sync/BUILD.gn
@@ -0,0 +1,49 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/pico_sync"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_sync") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_time:headers",
+    "${PICO_ROOT}/src/rp2_common/hardware_sync",
+  ]
+  public = [
+    "${_CWD}/include/pico/critical_section.h",
+    "${_CWD}/include/pico/lock_core.h",
+    "${_CWD}/include/pico/mutex.h",
+    "${_CWD}/include/pico/sem.h",
+    "${_CWD}/include/pico/sync.h",
+  ]
+  sources = [
+    "${_CWD}/critical_section.c",
+    "${_CWD}/lock_core.c",
+    "${_CWD}/mutex.c",
+    "${_CWD}/sem.c",
+  ]
+}
diff --git a/third_party/pico_sdk/src/common/pico_time/BUILD.gn b/third_party/pico_sdk/src/common/pico_time/BUILD.gn
new file mode 100644
index 0000000..ca0dff6
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_time/BUILD.gn
@@ -0,0 +1,49 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/pico_time"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("headers") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2_common/hardware_timer",
+  ]
+  public = [
+    "${_CWD}/include/pico/time.h",
+    "${_CWD}/include/pico/timeout_helper.h",
+  ]
+}
+
+pw_source_set("pico_time") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_deps = [ ":headers" ]
+  deps = [ "${PICO_ROOT}/src/common/pico_util" ]
+  sources = [
+    "${_CWD}/time.c",
+    "${_CWD}/timeout_helper.c",
+  ]
+}
diff --git a/third_party/pico_sdk/src/common/pico_usb_reset_interface/BUILD.gn b/third_party/pico_sdk/src/common/pico_usb_reset_interface/BUILD.gn
new file mode 100644
index 0000000..2c3abd8
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_usb_reset_interface/BUILD.gn
@@ -0,0 +1,32 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/pico_usb_reset_interface"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_usb_reset_interface") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public = [ "${_CWD}/include/pico/usb_reset_interface.h" ]
+}
diff --git a/third_party/pico_sdk/src/common/pico_util/BUILD.gn b/third_party/pico_sdk/src/common/pico_util/BUILD.gn
new file mode 100644
index 0000000..eed47bd
--- /dev/null
+++ b/third_party/pico_sdk/src/common/pico_util/BUILD.gn
@@ -0,0 +1,47 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/common/pico_util"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_util") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_sync",
+    "${PICO_ROOT}/src/rp2_common/hardware_sync",
+  ]
+  public = [
+    "${_CWD}/include/pico/util/datetime.h",
+    "${_CWD}/include/pico/util/pheap.h",
+    "${_CWD}/include/pico/util/queue.h",
+  ]
+  sources = [
+    "${_CWD}/datetime.c",
+    "${_CWD}/doc.h",
+    "${_CWD}/pheap.c",
+    "${_CWD}/queue.c",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2040/BUILD.gn b/third_party/pico_sdk/src/rp2040/BUILD.gn
new file mode 100644
index 0000000..c330097
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2040/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+import("${PICO_ROOT}/gn/generate_config_header.gni")
+group("rp2040") {
+  public_deps = [
+    "hardware_regs",
+    "hardware_structs",
+  ]
+}
+
+generate_config_header("rp2040_config") {
+  public_deps = [
+    "${PICO_ROOT}/src/boards",
+    "${PICO_ROOT}/src/rp2_common/cmsis:rename_exceptions",
+  ]
+  config_header_files = [
+    "boards/pico.h",
+    "cmsis/rename_exceptions.h",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2040/hardware_regs/BUILD.gn b/third_party/pico_sdk/src/rp2040/hardware_regs/BUILD.gn
new file mode 100644
index 0000000..739d4bb
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2040/hardware_regs/BUILD.gn
@@ -0,0 +1,77 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2040/hardware_regs"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("platform_defs") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public = [ "${_CWD}/include/hardware/platform_defs.h" ]
+}
+
+pw_source_set("hardware_regs") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    ":platform_defs",
+    "${PICO_ROOT}/src/rp2_common/pico_platform:headers",
+  ]
+  public = [
+    "${_CWD}/include/hardware/regs/adc.h",
+    "${_CWD}/include/hardware/regs/addressmap.h",
+    "${_CWD}/include/hardware/regs/busctrl.h",
+    "${_CWD}/include/hardware/regs/clocks.h",
+    "${_CWD}/include/hardware/regs/dma.h",
+    "${_CWD}/include/hardware/regs/dreq.h",
+    "${_CWD}/include/hardware/regs/i2c.h",
+    "${_CWD}/include/hardware/regs/intctrl.h",
+    "${_CWD}/include/hardware/regs/io_bank0.h",
+    "${_CWD}/include/hardware/regs/io_qspi.h",
+    "${_CWD}/include/hardware/regs/m0plus.h",
+    "${_CWD}/include/hardware/regs/pads_bank0.h",
+    "${_CWD}/include/hardware/regs/pads_qspi.h",
+    "${_CWD}/include/hardware/regs/pio.h",
+    "${_CWD}/include/hardware/regs/pll.h",
+    "${_CWD}/include/hardware/regs/psm.h",
+    "${_CWD}/include/hardware/regs/pwm.h",
+    "${_CWD}/include/hardware/regs/resets.h",
+    "${_CWD}/include/hardware/regs/rosc.h",
+    "${_CWD}/include/hardware/regs/rtc.h",
+    "${_CWD}/include/hardware/regs/sio.h",
+    "${_CWD}/include/hardware/regs/spi.h",
+    "${_CWD}/include/hardware/regs/ssi.h",
+    "${_CWD}/include/hardware/regs/syscfg.h",
+    "${_CWD}/include/hardware/regs/sysinfo.h",
+    "${_CWD}/include/hardware/regs/tbman.h",
+    "${_CWD}/include/hardware/regs/timer.h",
+    "${_CWD}/include/hardware/regs/uart.h",
+    "${_CWD}/include/hardware/regs/usb.h",
+    "${_CWD}/include/hardware/regs/usb_device_dpram.h",
+    "${_CWD}/include/hardware/regs/vreg_and_chip_reset.h",
+    "${_CWD}/include/hardware/regs/watchdog.h",
+    "${_CWD}/include/hardware/regs/xip.h",
+    "${_CWD}/include/hardware/regs/xosc.h",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2040/hardware_structs/BUILD.gn b/third_party/pico_sdk/src/rp2040/hardware_structs/BUILD.gn
new file mode 100644
index 0000000..b472f5e
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2040/hardware_structs/BUILD.gn
@@ -0,0 +1,69 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2040/hardware_structs"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_structs") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2040/hardware_regs:platform_defs",
+    "${PICO_ROOT}/src/rp2_common/hardware_base",
+  ]
+  public = [
+    "${_CWD}/include/hardware/structs/adc.h",
+    "${_CWD}/include/hardware/structs/bus_ctrl.h",
+    "${_CWD}/include/hardware/structs/clocks.h",
+    "${_CWD}/include/hardware/structs/dma.h",
+    "${_CWD}/include/hardware/structs/i2c.h",
+    "${_CWD}/include/hardware/structs/interp.h",
+    "${_CWD}/include/hardware/structs/iobank0.h",
+    "${_CWD}/include/hardware/structs/ioqspi.h",
+    "${_CWD}/include/hardware/structs/mpu.h",
+    "${_CWD}/include/hardware/structs/pads_qspi.h",
+    "${_CWD}/include/hardware/structs/padsbank0.h",
+    "${_CWD}/include/hardware/structs/pio.h",
+    "${_CWD}/include/hardware/structs/pll.h",
+    "${_CWD}/include/hardware/structs/psm.h",
+    "${_CWD}/include/hardware/structs/pwm.h",
+    "${_CWD}/include/hardware/structs/resets.h",
+    "${_CWD}/include/hardware/structs/rosc.h",
+    "${_CWD}/include/hardware/structs/rtc.h",
+    "${_CWD}/include/hardware/structs/scb.h",
+    "${_CWD}/include/hardware/structs/sio.h",
+    "${_CWD}/include/hardware/structs/spi.h",
+    "${_CWD}/include/hardware/structs/ssi.h",
+    "${_CWD}/include/hardware/structs/syscfg.h",
+    "${_CWD}/include/hardware/structs/systick.h",
+    "${_CWD}/include/hardware/structs/timer.h",
+    "${_CWD}/include/hardware/structs/uart.h",
+    "${_CWD}/include/hardware/structs/usb.h",
+    "${_CWD}/include/hardware/structs/vreg_and_chip_reset.h",
+    "${_CWD}/include/hardware/structs/watchdog.h",
+    "${_CWD}/include/hardware/structs/xip_ctrl.h",
+    "${_CWD}/include/hardware/structs/xosc.h",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/BUILD.gn b/third_party/pico_sdk/src/rp2_common/BUILD.gn
new file mode 100644
index 0000000..494af4a
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/BUILD.gn
@@ -0,0 +1,73 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+group("rp2_common") {
+  public_deps = [
+    "hardware_adc",
+    "hardware_base",
+    "hardware_claim",
+    "hardware_clocks",
+    "hardware_divider",
+    "hardware_dma",
+    "hardware_exception",
+    "hardware_flash",
+    "hardware_gpio",
+    "hardware_i2c",
+    "hardware_interp",
+    "hardware_irq",
+    "hardware_pio",
+    "hardware_pll",
+    "hardware_pwm",
+    "hardware_resets",
+    "hardware_rtc",
+    "hardware_spi",
+    "hardware_sync",
+    "hardware_timer",
+    "hardware_uart",
+    "hardware_vreg",
+    "hardware_watchdog",
+    "hardware_xosc",
+    "pico_bootrom",
+    "pico_platform",
+  ]
+
+  if (!PICO_BARE_METAL) {
+    public_deps += [
+      "boot_stage2",
+      "cmsis",
+      "pico_bit_ops",
+      "pico_bootsel_via_double_reset",
+      "pico_divider",
+      "pico_double",
+      "pico_fix",
+      "pico_float",
+      "pico_int64_ops",
+      "pico_malloc",
+      "pico_mem_ops",
+      "pico_multicore",
+      "pico_printf",
+      "pico_runtime",
+      "pico_standard_link",
+      "pico_stdio",
+      "pico_stdio_semihosting",
+      "pico_stdio_uart",
+      "pico_stdio_usb",
+      "pico_stdlib",
+      "pico_unique_id",
+      "tinyusb",
+    ]
+    # Not a real library:
+    #   pico_cxx_options
+  }
+}
diff --git a/third_party/pico_sdk/src/rp2_common/boot_stage2/BUILD.gn b/third_party/pico_sdk/src/rp2_common/boot_stage2/BUILD.gn
new file mode 100644
index 0000000..d23802a
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/boot_stage2/BUILD.gn
@@ -0,0 +1,114 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/exec.gni")
+import("$dir_pw_build/python_action.gni")
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/boot_stage2"
+
+config("public_include_dirs") {
+  include_dirs = [
+    "${_CWD}/include",
+    "${_CWD}/asminclude",
+  ]
+}
+
+pw_executable("boot_stage2_elf") {
+  _linker_script_path = rebase_path("${_CWD}/boot_stage2.ld", root_build_dir)
+
+  # Compile as position-independent.
+  cflags = [ "-fPIC" ]
+  asmflags = cflags
+
+  ldflags = cflags
+  ldflags += [
+    "-T${_linker_script_path}",
+    "-nostartfiles",
+
+    # Unfortunately, this is not properly applied to compiler flags thanks to
+    # `default_configs`.
+    "-Wl,--no-gc-sections",
+  ]
+
+  public_configs = [ ":public_include_dirs" ]
+
+  # The upstream boot_stage2.ld doesn't specify the binary entry point or
+  # mark the required sections as KEEP(), so they're optimized out with
+  # Pigweed's aggressive default optimizations.
+  remove_configs = [
+    "$dir_pw_build:reduced_size",
+    "$dir_pw_build:strict_warnings",
+  ]
+  no_link_deps = true
+
+  public = [ "${_CWD}/include/boot_stage2/config.h" ]
+
+  deps = [ "${PICO_ROOT}/src/common/pico_base" ]
+
+  # The correct assembly file is pulled in by compile_time_choice.S.
+  inputs = [
+    "${_CWD}/boot_stage2.ld",
+    "${_CWD}/boot2_at25sf128a.S",
+    "${_CWD}/boot2_generic_03h.S",
+    "${_CWD}/boot2_is25lp080.S",
+    "${_CWD}/boot2_usb_blinky.S",
+    "${_CWD}/boot2_w25q080.S",
+    "${_CWD}/boot2_w25x10cl.S",
+  ]
+  sources = [ "${_CWD}/compile_time_choice.S" ]
+}
+
+pw_exec("boot_stage2_bin") {
+  _out_bin = "${target_out_dir}/boot_stage2.bin"
+  program = "arm-none-eabi-objcopy"
+  args = [
+    "-Obinary",
+    "<TARGET_FILE(:boot_stage2_elf)>",
+    rebase_path(_out_bin, root_build_dir),
+  ]
+  outputs = [ _out_bin ]
+  deps = [ ":boot_stage2_elf" ]
+}
+
+pw_python_action("boot_stage2_padded") {
+  _src_bin = get_target_outputs(":boot_stage2_bin")
+  _out_asm = "${target_out_dir}/boot_stage2.S"
+  script = "${_CWD}/pad_checksum"
+  args = [
+    "-s",
+    "0xffffffff",
+    rebase_path(_src_bin[0], root_build_dir),
+    rebase_path(_out_asm, root_build_dir),
+  ]
+  outputs = [ _out_asm ]
+  deps = [ ":boot_stage2_bin" ]
+}
+
+pw_source_set("boot_stage2_asm") {
+  deps = [ ":boot_stage2_padded" ]
+  sources = get_target_outputs(":boot_stage2_padded")
+}
+
+group("boot_stage2") {
+  public_deps = [
+    ":boot_stage2_asm",
+    ":boot_stage2_elf",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/cmsis/BUILD.gn b/third_party/pico_sdk/src/rp2_common/cmsis/BUILD.gn
new file mode 100644
index 0000000..94c8f41
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/cmsis/BUILD.gn
@@ -0,0 +1,59 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/cmsis"
+
+config("public_include_dirs") {
+  include_dirs = [
+    "${_CWD}/include",
+    "${_CWD}/stub/CMSIS/Core/Include",
+    "${_CWD}/stub/CMSIS/Device/RaspberryPi/RP2040/Include",
+  ]
+}
+
+pw_source_set("rename_exceptions") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public = [ "include/cmsis/rename_exceptions.h" ]
+}
+
+# TODO(amontanez): The CMSIS stub should probably be more configurable to match
+# CMake.
+pw_source_set("cmsis") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public = [
+    "${_CWD}/stub/CMSIS/Core/Include/cmsis_armcc.h",
+    "${_CWD}/stub/CMSIS/Core/Include/cmsis_armclang.h",
+    "${_CWD}/stub/CMSIS/Core/Include/cmsis_armclang_ltm.h",
+    "${_CWD}/stub/CMSIS/Core/Include/cmsis_compiler.h",
+    "${_CWD}/stub/CMSIS/Core/Include/cmsis_gcc.h",
+    "${_CWD}/stub/CMSIS/Core/Include/cmsis_iccarm.h",
+    "${_CWD}/stub/CMSIS/Core/Include/cmsis_version.h",
+    "${_CWD}/stub/CMSIS/Core/Include/core_cm0plus.h",
+    "${_CWD}/stub/CMSIS/Core/Include/mpu_armv7.h",
+    "${_CWD}/stub/CMSIS/Device/RaspberryPi/RP2040/Include/RP2040.h",
+    "${_CWD}/stub/CMSIS/Device/RaspberryPi/RP2040/Include/system_RP2040.h",
+  ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/hardware_clocks" ]
+  sources =
+      [ "${_CWD}/stub/CMSIS/Device/RaspberryPi/RP2040/Source/system_RP2040.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_adc/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_adc/BUILD.gn
new file mode 100644
index 0000000..7a93646
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_adc/BUILD.gn
@@ -0,0 +1,39 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_adc"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_adc") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+    "${PICO_ROOT}/src/rp2_common/hardware_gpio",
+  ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/hardware_resets" ]
+  public = [ "${_CWD}/include/hardware/adc.h" ]
+  sources = [ "${_CWD}/adc.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_base/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_base/BUILD.gn
new file mode 100644
index 0000000..00909d4
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_base/BUILD.gn
@@ -0,0 +1,36 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_base"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_base") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+  ]
+  public = [ "${_CWD}/include/hardware/address_mapped.h" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_claim/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_claim/BUILD.gn
new file mode 100644
index 0000000..9ced82c
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_claim/BUILD.gn
@@ -0,0 +1,41 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_claim"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_claim") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2_common/hardware_sync",
+  ]
+
+  # hardware_claim and hardware_sync circularly depend on each other.
+  allow_circular_includes_from = [ "${PICO_ROOT}/src/rp2_common/hardware_sync" ]
+
+  public = [ "${_CWD}/include/hardware/claim.h" ]
+  sources = [ "${_CWD}/claim.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_clocks/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_clocks/BUILD.gn
new file mode 100644
index 0000000..dd4eb47
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_clocks/BUILD.gn
@@ -0,0 +1,54 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_clocks"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_clocks") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public = [ "${_CWD}/include/hardware/clocks.h" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2040/hardware_regs:platform_defs",
+    "${PICO_ROOT}/src/rp2_common/hardware_gpio",
+    "${PICO_ROOT}/src/rp2_common/hardware_irq",
+    "${PICO_ROOT}/src/rp2_common/hardware_pll",
+    "${PICO_ROOT}/src/rp2_common/hardware_watchdog",
+    "${PICO_ROOT}/src/rp2_common/hardware_xosc",
+  ]
+
+  # hardware_pll and hardware_clocks circularly depend on each other.
+  # hardware_xosc and hardware_clocks circularly depend on each other.
+  allow_circular_includes_from = [
+    "${PICO_ROOT}/src/rp2_common/hardware_pll",
+    "${PICO_ROOT}/src/rp2_common/hardware_xosc",
+  ]
+
+  sources = [ "${_CWD}/clocks.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_divider/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_divider/BUILD.gn
new file mode 100644
index 0000000..25e1a5f
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_divider/BUILD.gn
@@ -0,0 +1,44 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_divider"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_divider") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2_common/pico_platform",
+  ]
+  public = [
+    "${_CWD}/include/hardware/divider.h",
+    "${_CWD}/include/hardware/divider_helper.S",
+  ]
+  sources = [ "${_CWD}/divider.S" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_dma/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_dma/BUILD.gn
new file mode 100644
index 0000000..33ca25c
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_dma/BUILD.gn
@@ -0,0 +1,39 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_dma"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_dma") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/hardware_claim" ]
+  public = [ "${_CWD}/include/hardware/dma.h" ]
+  sources = [ "${_CWD}/dma.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_exception/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_exception/BUILD.gn
new file mode 100644
index 0000000..cb8e2de
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_exception/BUILD.gn
@@ -0,0 +1,43 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_exception"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_exception") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2_common/hardware_base",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_sync",
+    "${PICO_ROOT}/src/rp2040/hardware_regs:platform_defs",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  public = [ "${_CWD}/include/hardware/exception.h" ]
+  sources = [ "${_CWD}/exception.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_flash/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_flash/BUILD.gn
new file mode 100644
index 0000000..6e3e190
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_flash/BUILD.gn
@@ -0,0 +1,39 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_flash"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_flash") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/common/pico_base" ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_sync",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+    "${PICO_ROOT}/src/rp2_common/pico_bootrom",
+  ]
+  public = [ "${_CWD}/include/hardware/flash.h" ]
+  sources = [ "${_CWD}/flash.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_gpio/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_gpio/BUILD.gn
new file mode 100644
index 0000000..193f323
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_gpio/BUILD.gn
@@ -0,0 +1,45 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_gpio"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_gpio") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [
+    # TODO(amontanez): This is off by default, properly control with
+    # configuration.
+    # "${PICO_ROOT}/src/common/pico_binary_info",
+
+    "${PICO_ROOT}/src/rp2_common/hardware_irq",
+    "${PICO_ROOT}/src/rp2_common/hardware_sync",
+  ]
+  public = [ "${_CWD}/include/hardware/gpio.h" ]
+  sources = [ "${_CWD}/gpio.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_i2c/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_i2c/BUILD.gn
new file mode 100644
index 0000000..1c3f717
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_i2c/BUILD.gn
@@ -0,0 +1,43 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_i2c"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_i2c") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_time",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_time",
+    "${PICO_ROOT}/src/rp2_common/hardware_clocks",
+    "${PICO_ROOT}/src/rp2_common/hardware_resets",
+  ]
+  public = [ "${_CWD}/include/hardware/i2c.h" ]
+  sources = [ "${_CWD}/i2c.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_interp/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_interp/BUILD.gn
new file mode 100644
index 0000000..6a2dec8
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_interp/BUILD.gn
@@ -0,0 +1,39 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_interp"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_interp") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/hardware_claim" ]
+  public = [ "${_CWD}/include/hardware/interp.h" ]
+  sources = [ "${_CWD}/interp.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_irq/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_irq/BUILD.gn
new file mode 100644
index 0000000..a21900e
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_irq/BUILD.gn
@@ -0,0 +1,53 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_irq"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_irq") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2_common/hardware_base",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_sync",
+    "${PICO_ROOT}/src/rp2040/hardware_regs:platform_defs",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+
+  # There's a dependency cycle with:
+  #   hardware_irq->pico_sync->pico_time->hardware_timer->hardware_irq
+  deps += [ "${PICO_ROOT}/src/rp2_common/hardware_timer" ]
+  allow_circular_includes_from =
+      [ "${PICO_ROOT}/src/rp2_common/hardware_timer" ]
+
+  public = [ "${_CWD}/include/hardware/irq.h" ]
+  sources = [
+    "${_CWD}/irq.c",
+    "${_CWD}/irq_handler_chain.S",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_pio/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_pio/BUILD.gn
new file mode 100644
index 0000000..f1fc257
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_pio/BUILD.gn
@@ -0,0 +1,44 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_pio"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_pio") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+    "${PICO_ROOT}/src/rp2_common/hardware_base",
+    "${PICO_ROOT}/src/rp2_common/hardware_gpio",
+  ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/hardware_claim" ]
+  public = [
+    "${_CWD}/include/hardware/pio.h",
+    "${_CWD}/include/hardware/pio_instructions.h",
+  ]
+  sources = [ "${_CWD}/pio.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_pll/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_pll/BUILD.gn
new file mode 100644
index 0000000..837611d
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_pll/BUILD.gn
@@ -0,0 +1,43 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_pll"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_pll") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/hardware_resets" ]
+
+  # hardware_pll and hardware_clocks circularly depend on each other.
+  configs =
+      [ "${PICO_ROOT}/src/rp2_common/hardware_clocks:public_include_dirs" ]
+
+  public = [ "${_CWD}/include/hardware/pll.h" ]
+  sources = [ "${_CWD}/pll.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_pwm/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_pwm/BUILD.gn
new file mode 100644
index 0000000..968ef3e
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_pwm/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_pwm"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_pwm") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  public = [ "${_CWD}/include/hardware/pwm.h" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_resets/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_resets/BUILD.gn
new file mode 100644
index 0000000..92beff0
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_resets/BUILD.gn
@@ -0,0 +1,36 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_resets"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_resets") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  public = [ "${_CWD}/include/hardware/resets.h" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_rtc/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_rtc/BUILD.gn
new file mode 100644
index 0000000..b59a0f2
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_rtc/BUILD.gn
@@ -0,0 +1,42 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_rtc"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_rtc") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/rp2_common/hardware_clocks",
+    "${PICO_ROOT}/src/rp2_common/hardware_irq",
+    "${PICO_ROOT}/src/rp2_common/hardware_resets",
+  ]
+  public = [ "${_CWD}/include/hardware/rtc.h" ]
+  sources = [ "${_CWD}/rtc.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_spi/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_spi/BUILD.gn
new file mode 100644
index 0000000..42f5597
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_spi/BUILD.gn
@@ -0,0 +1,43 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_spi"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_spi") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_time",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/rp2_common/hardware_clocks",
+    "${PICO_ROOT}/src/rp2_common/hardware_resets",
+  ]
+  public = [ "${_CWD}/include/hardware/spi.h" ]
+  sources = [ "${_CWD}/spi.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_sync/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_sync/BUILD.gn
new file mode 100644
index 0000000..442aab3
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_sync/BUILD.gn
@@ -0,0 +1,42 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_sync"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_sync") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2_common/hardware_base",
+  ]
+
+  # hardware_claim and hardware_sync circularly depend on each other.
+  configs = [ "${PICO_ROOT}/src/rp2_common/hardware_claim:public_include_dirs" ]
+
+  public = [ "${_CWD}/include/hardware/sync.h" ]
+  sources = [ "${_CWD}/sync.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_timer/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_timer/BUILD.gn
new file mode 100644
index 0000000..6abf5ac
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_timer/BUILD.gn
@@ -0,0 +1,45 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_timer"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_timer") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/rp2_common/hardware_claim",
+    "${PICO_ROOT}/src/rp2_common/hardware_sync",
+  ]
+
+  # There's a dependency cycle with:
+  #   hardware_irq->pico_sync->pico_time->hardware_timer->hardware_irq
+  configs = [ "${PICO_ROOT}/src/rp2_common/hardware_irq:public_include_dirs" ]
+  public = [ "${_CWD}/include/hardware/timer.h" ]
+  sources = [ "${_CWD}/timer.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_uart/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_uart/BUILD.gn
new file mode 100644
index 0000000..0c71aae
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_uart/BUILD.gn
@@ -0,0 +1,45 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_uart"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_uart") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/rp2040/hardware_regs:platform_defs",
+    "${PICO_ROOT}/src/rp2_common/hardware_base",
+    "${PICO_ROOT}/src/rp2_common/hardware_clocks",
+    "${PICO_ROOT}/src/rp2_common/hardware_resets",
+    "${PICO_ROOT}/src/rp2_common/hardware_timer",
+  ]
+  public = [ "${_CWD}/include/hardware/uart.h" ]
+  sources = [ "${_CWD}/uart.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_vreg/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_vreg/BUILD.gn
new file mode 100644
index 0000000..1815fc0
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_vreg/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_vreg"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_vreg") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  public = [ "${_CWD}/include/hardware/vreg.h" ]
+  sources = [ "${_CWD}/vreg.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_watchdog/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_watchdog/BUILD.gn
new file mode 100644
index 0000000..644f722
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_watchdog/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_watchdog"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_watchdog") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  public = [ "${_CWD}/include/hardware/watchdog.h" ]
+  sources = [ "${_CWD}/watchdog.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/hardware_xosc/BUILD.gn b/third_party/pico_sdk/src/rp2_common/hardware_xosc/BUILD.gn
new file mode 100644
index 0000000..a2d77d8
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/hardware_xosc/BUILD.gn
@@ -0,0 +1,43 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/hardware_xosc"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("hardware_xosc") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [ "${PICO_ROOT}/src/rp2040/hardware_regs:platform_defs" ]
+
+  # hardware_pll and hardware_clocks circularly depend on each other.
+  configs =
+      [ "${PICO_ROOT}/src/rp2_common/hardware_clocks:public_include_dirs" ]
+
+  public = [ "${_CWD}/include/hardware/xosc.h" ]
+  sources = [ "${_CWD}/xosc.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_bit_ops/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_bit_ops/BUILD.gn
new file mode 100644
index 0000000..f799a72
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_bit_ops/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_bit_ops"
+
+pw_source_set("pico_bit_ops") {
+  deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2_common/pico_bootrom",
+    "${PICO_ROOT}/src/rp2_common/pico_platform",
+  ]
+  sources = [ "${_CWD}/bit_ops_eabi.S" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_bootrom/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_bootrom/BUILD.gn
new file mode 100644
index 0000000..d1d28a2
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_bootrom/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_bootrom"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_bootrom") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/common/pico_base" ]
+  public = [
+    "${_CWD}/include/pico/bootrom.h",
+    "${_CWD}/include/pico/bootrom/sf_table.h",
+  ]
+  sources = [ "${_CWD}/bootrom.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_bootsel_via_double_reset/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_bootsel_via_double_reset/BUILD.gn
new file mode 100644
index 0000000..5f61527
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_bootsel_via_double_reset/BUILD.gn
@@ -0,0 +1,32 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_bootsel_via_double_reset"
+
+pw_source_set("pico_bootsel_via_double_reset") {
+  deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_binary_info",
+    "${PICO_ROOT}/src/rp2_common/pico_bootrom",
+    "${PICO_ROOT}/src/rp2_common/pico_time",
+  ]
+  sources = [ "${_CWD}/pico_bootsel_via_double_reset.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_divider/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_divider/BUILD.gn
new file mode 100644
index 0000000..e231a82
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_divider/BUILD.gn
@@ -0,0 +1,30 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_divider"
+
+pw_source_set("pico_divider") {
+  deps = [
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2_common/hardware_divider",
+  ]
+  sources = [ "${_CWD}/divider.S" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_double/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_double/BUILD.gn
new file mode 100644
index 0000000..ef7feb7
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_double/BUILD.gn
@@ -0,0 +1,47 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_double"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_double") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2_common/pico_bootrom",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/rp2_common/hardware_divider",
+    "${PICO_ROOT}/src/rp2_common/pico_platform",
+  ]
+  public = [ "${_CWD}/include/pico/double.h" ]
+  sources = [
+    "${_CWD}/double_aeabi.S",
+    "${_CWD}/double_init_rom.c",
+    "${_CWD}/double_math.c",
+    "${_CWD}/double_none.S",
+    "${_CWD}/double_v1_rom_shim.S",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_fix/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_fix/BUILD.gn
new file mode 100644
index 0000000..f9397b1
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_fix/BUILD.gn
@@ -0,0 +1,17 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+group("pico_fix") {
+  public_deps = [ "rp2040_usb_device_enumeration" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/BUILD.gn
new file mode 100644
index 0000000..99d8cd4
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/BUILD.gn
@@ -0,0 +1,39 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_fix/rp2040_usb_device_enumeration"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("rp2040_usb_device_enumeration") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+    "${PICO_ROOT}/src/rp2_common/hardware_gpio",
+    "${PICO_ROOT}/src/rp2_common/pico_time",
+  ]
+  public = [ "${_CWD}/include/pico/fix/rp2040_usb_device_enumeration.h" ]
+  sources = [ "${_CWD}/rp2040_usb_device_enumberation.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_float/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_float/BUILD.gn
new file mode 100644
index 0000000..04c0fdf
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_float/BUILD.gn
@@ -0,0 +1,47 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_float"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_float") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2_common/pico_bootrom",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/rp2_common/hardware_divider",
+    "${PICO_ROOT}/src/rp2_common/pico_platform",
+  ]
+  public = [ "${_CWD}/include/pico/float.h" ]
+  sources = [
+    "${_CWD}/float_aeabi.S",
+    "${_CWD}/float_init_rom.c",
+    "${_CWD}/float_math.c",
+    "${_CWD}/float_none.S",
+    "${_CWD}/float_v1_rom_shim.S",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_int64_ops/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_int64_ops/BUILD.gn
new file mode 100644
index 0000000..6458280
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_int64_ops/BUILD.gn
@@ -0,0 +1,35 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_int64_ops"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_int64_ops") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/common/pico_base" ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/pico_platform" ]
+  public = [ "${_CWD}/include/pico/int64_ops.h" ]
+  sources = [ "${_CWD}/pico_int64_ops_aeabi.S" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_malloc/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_malloc/BUILD.gn
new file mode 100644
index 0000000..ad1afbe
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_malloc/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_malloc"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_malloc") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_sync",
+  ]
+  public = [ "${_CWD}/include/pico/malloc.h" ]
+  sources = [ "${_CWD}/pico_malloc.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_mem_ops/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_mem_ops/BUILD.gn
new file mode 100644
index 0000000..df40c7e
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_mem_ops/BUILD.gn
@@ -0,0 +1,41 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_mem_ops"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_mem_ops") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/common/pico_base" ]
+  deps = [
+    "${PICO_ROOT}/src/rp2_common/pico_bootrom",
+    "${PICO_ROOT}/src/rp2_common/pico_platform",
+  ]
+  public = [ "${_CWD}/include/pico/mem_ops.h" ]
+  sources = [
+    "${_CWD}/mem_ops.c",
+    "${_CWD}/mem_ops_aeabi.S",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_multicore/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_multicore/BUILD.gn
new file mode 100644
index 0000000..d154954
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_multicore/BUILD.gn
@@ -0,0 +1,45 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_multicore"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_multicore") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_sync",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2_common/hardware_claim",
+    "${PICO_ROOT}/src/rp2_common/hardware_irq",
+    "${PICO_ROOT}/src/rp2_common/hardware_sync",
+    "${PICO_ROOT}/src/rp2_common/pico_runtime",
+  ]
+  public = [ "${_CWD}/include/pico/multicore.h" ]
+  sources = [ "${_CWD}/pico_multicore.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_platform/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_platform/BUILD.gn
new file mode 100644
index 0000000..593196d
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_platform/BUILD.gn
@@ -0,0 +1,44 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_platform"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("headers") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/rp2040/hardware_regs:platform_defs" ]
+  configs = [ "${PICO_ROOT}/src/rp2_common/pico_platform:public_include_dirs" ]
+  public = [
+    "${_CWD}/include/pico/asm_helper.S",
+    "${_CWD}/include/pico/platform.h",
+  ]
+}
+
+pw_source_set("pico_platform") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_deps = [ ":headers" ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/hardware_base" ]
+  sources = [ "${_CWD}/platform.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_printf/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_printf/BUILD.gn
new file mode 100644
index 0000000..00453c4
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_printf/BUILD.gn
@@ -0,0 +1,43 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_printf"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_printf_none") {
+  deps = [
+    "${PICO_ROOT}/src/rp2_common/pico_bootrom",
+    "${PICO_ROOT}/src/rp2_common/pico_platform",
+  ]
+  sources = [ "${_CWD}/printf_none.S" ]
+}
+
+pw_source_set("pico_printf") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/common/pico_base" ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/pico_platform" ]
+  public = [ "${_CWD}/include/pico/printf.h" ]
+  sources = [ "${_CWD}/printf.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_runtime/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_runtime/BUILD.gn
new file mode 100644
index 0000000..f0c42c6
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_runtime/BUILD.gn
@@ -0,0 +1,46 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_runtime"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_runtime") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+
+  deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_sync",
+    "${PICO_ROOT}/src/common/pico_time",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2040/hardware_structs",
+    "${PICO_ROOT}/src/rp2_common/hardware_clocks",
+    "${PICO_ROOT}/src/rp2_common/hardware_irq",
+    "${PICO_ROOT}/src/rp2_common/hardware_resets",
+    "${PICO_ROOT}/src/rp2_common/pico_bootrom",
+    "${PICO_ROOT}/src/rp2_common/pico_printf",
+  ]
+  public = [ "${_CWD}/include/pico/runtime.h" ]
+  sources = [ "${_CWD}/runtime.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_standard_link/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_standard_link/BUILD.gn
new file mode 100644
index 0000000..457f93d
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_standard_link/BUILD.gn
@@ -0,0 +1,46 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_standard_link"
+
+# TODO(amontanez): Not all linker script configurations are supported yet.
+
+config("linker_script") {
+  _linker_script_path = rebase_path("${_CWD}/memmap_default.ld", root_build_dir)
+  ldflags = [ "-T${_linker_script_path}" ]
+}
+
+pw_source_set("pico_standard_link") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  all_dependent_configs = [ ":linker_script" ]
+  inputs = [ "${_CWD}/memmap_default.ld" ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/common/pico_binary_info",
+    "${PICO_ROOT}/src/rp2040/hardware_regs",
+    "${PICO_ROOT}/src/rp2_common/boot_stage2",
+  ]
+  sources = [
+    "${_CWD}/binary_info.c",
+    "${_CWD}/crt0.S",
+    "${_CWD}/new_delete.cpp",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_stdio/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_stdio/BUILD.gn
new file mode 100644
index 0000000..38e2c69
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_stdio/BUILD.gn
@@ -0,0 +1,73 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_stdio"
+
+import("${PICO_ROOT}/src/common/pico_stdlib/pico_stdio.gni")
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+config("printf_wrappers") {
+  ldflags = [
+    "-Wl,--wrap=printf",
+    "-Wl,--wrap=vprintf",
+    "-Wl,--wrap=puts",
+    "-Wl,--wrap=putchar",
+    "-Wl,--wrap=getchar",
+  ]
+}
+
+# TODO(amontanez): This is definitely a facade. For now, just have header and
+# header+impl build targets to simulate.
+pw_source_set("headers") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_base",
+    "${PICO_ROOT}/src/rp2_common/pico_platform",
+  ]
+
+  public = [
+    "${_CWD}/include/pico/stdio.h",
+    "${_CWD}/include/pico/stdio/driver.h",
+  ]
+}
+
+pw_source_set("pico_stdio") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  all_dependent_configs = [ ":printf_wrappers" ]
+  public_deps = [ ":headers" ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_sync",
+    "${PICO_ROOT}/src/common/pico_time",
+    "${PICO_ROOT}/src/rp2_common/pico_printf",
+  ]
+  if (PICO_STDIO == ENUM_LIB_PICO_STDIO.UART) {
+    deps += [ "${PICO_ROOT}/src/rp2_common/pico_stdio_uart" ]
+  } else if (PICO_STDIO == ENUM_LIB_PICO_STDIO.USB) {
+    deps += [ "${PICO_ROOT}/src/rp2_common/pico_stdio_usb" ]
+  } else if (PICO_STDIO == ENUM_LIB_PICO_STDIO.SEMIHOSTING) {
+    deps += [ "${PICO_ROOT}/src/rp2_common/pico_stdio_semihosting" ]
+  }
+  sources = [ "${_CWD}/stdio.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_stdio_semihosting/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_stdio_semihosting/BUILD.gn
new file mode 100644
index 0000000..5590ad2
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_stdio_semihosting/BUILD.gn
@@ -0,0 +1,35 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_stdio_semihosting"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_stdio_semihosting") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/rp2_common/pico_stdio:headers" ]
+  deps = [ "${PICO_ROOT}/src/common/pico_binary_info" ]
+  public = [ "${_CWD}/include/pico/stdio_semihosting.h" ]
+  sources = [ "${_CWD}/pico_stdio/semihosting.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_stdio_uart/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_stdio_uart/BUILD.gn
new file mode 100644
index 0000000..788a0de
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_stdio_uart/BUILD.gn
@@ -0,0 +1,41 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_stdio_uart"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_stdio_uart") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/rp2_common/hardware_uart",
+    "${PICO_ROOT}/src/rp2_common/pico_stdio:headers",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_binary_info",
+    "${PICO_ROOT}/src/rp2_common/hardware_gpio",
+  ]
+  public = [ "${_CWD}/include/pico/stdio_uart.h" ]
+  sources = [ "${_CWD}/stdio_uart.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_stdio_usb/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_stdio_usb/BUILD.gn
new file mode 100644
index 0000000..30a3434
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_stdio_usb/BUILD.gn
@@ -0,0 +1,52 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_stdio_usb"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_stdio_usb") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [
+    "${PICO_ROOT}/src/common/pico_usb_reset_interface",
+    "${PICO_ROOT}/src/rp2_common/pico_stdio:headers",
+  ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_sync",
+    "${PICO_ROOT}/src/common/pico_time",
+    "${PICO_ROOT}/src/rp2_common/hardware_irq",
+  ]
+
+  # TODO(amontanez): Still needs a dependency on tinyusb.
+  public = [
+    "${_CWD}/include/pico/stdio_usb.h",
+    "${_CWD}/include/pico/stdio_usb/reset_interface.h",
+    "${_CWD}/include/tusb_config.h",
+  ]
+  sources = [
+    "${_CWD}/reset_interface.c",
+    "${_CWD}/stdio_usb.c",
+    "${_CWD}/stdio_usb_descriptors.c",
+  ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_stdlib/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_stdlib/BUILD.gn
new file mode 100644
index 0000000..448d1d7
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_stdlib/BUILD.gn
@@ -0,0 +1,51 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_stdlib"
+
+import("${PICO_ROOT}/src/common/pico_stdlib/pico_stdio.gni")
+
+pw_source_set("pico_stdlib") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  deps = [
+    "${PICO_ROOT}/src/common/pico_stdlib:headers",
+    "${PICO_ROOT}/src/rp2_common/hardware_clocks",
+    "${PICO_ROOT}/src/rp2_common/hardware_pll",
+  ]
+
+  # These libraries must be linked in for this to work, even though this does
+  # not #include anything from these:
+  deps += [
+    "${PICO_ROOT}/src/common/pico_time",
+    "${PICO_ROOT}/src/rp2_common/pico_platform",
+    "${PICO_ROOT}/src/rp2_common/pico_runtime",
+    "${PICO_ROOT}/src/rp2_common/pico_standard_link",
+    "${PICO_ROOT}/src/rp2_common/pico_stdio",
+  ]
+
+  if (PICO_STDIO == ENUM_LIB_PICO_STDIO.UART) {
+    deps += [ "${PICO_ROOT}/src/rp2_common/pico_stdio_uart" ]
+  } else {
+    deps += [ "${PICO_ROOT}/src/common/pico_binary_info" ]
+  }
+
+  sources = [ "${_CWD}/stdlib.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/pico_unique_id/BUILD.gn b/third_party/pico_sdk/src/rp2_common/pico_unique_id/BUILD.gn
new file mode 100644
index 0000000..a3f7b57
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/pico_unique_id/BUILD.gn
@@ -0,0 +1,35 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pi_pico.gni")
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+# TODO(amontanez): This can go away if the GN build can be upstreamed to the
+# Pi Pico repo.
+_CWD = "${PICO_SRC_DIR}/src/rp2_common/pico_unique_id"
+
+config("public_include_dirs") {
+  include_dirs = [ "${_CWD}/include" ]
+}
+
+pw_source_set("pico_unique_id") {
+  remove_configs = [ "$dir_pw_build:strict_warnings" ]
+  public_configs = [ ":public_include_dirs" ]
+  public_deps = [ "${PICO_ROOT}/src/common/pico_base" ]
+  deps = [ "${PICO_ROOT}/src/rp2_common/hardware_flash" ]
+  public = [ "${_CWD}/include/pico/unique_id.h" ]
+  sources = [ "${_CWD}/unique_id.c" ]
+}
diff --git a/third_party/pico_sdk/src/rp2_common/tinyusb/BUILD.gn b/third_party/pico_sdk/src/rp2_common/tinyusb/BUILD.gn
new file mode 100644
index 0000000..32680d5
--- /dev/null
+++ b/third_party/pico_sdk/src/rp2_common/tinyusb/BUILD.gn
@@ -0,0 +1,15 @@
+# Copyright 2022 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+# TODO(amontanez): Build shim for TinyUSB