Update pico-sdk and bazelify it

This borrows heavily from work that Austin did to initially get this
stuff working.

Merge commit 'a1fdcd85e25a8a2b1e3ca5bc31e45bedf9e58266' into HEAD

Signed-off-by: Ravago Jones <ravagojones@gmail.com>
Change-Id: Id47d383bd5fb46664083b365890fd7bad5786c1f
diff --git a/frc971/imu/BUILD b/frc971/imu/BUILD
index f386da4..3dbae6d 100644
--- a/frc971/imu/BUILD
+++ b/frc971/imu/BUILD
@@ -1,4 +1,4 @@
-load("//third_party/pico-sdk:hex.bzl", "uf2_from_elf")
+load("//third_party/pico-sdk:hex.bzl", "pioasm", "uf2_from_elf")
 
 # TODO(austin): We should be able to either push the linker script into the crosstool, or wrap this in a macro.
 cc_binary(
@@ -23,3 +23,42 @@
 uf2_from_elf(
     name = "blink",
 )
+
+pioasm(
+    name = "quadrature_encoder",
+    src = "quadrature_encoder.pio",
+    out = "quadrature_encoder.pio.h",
+)
+
+# TODO(austin): We should be able to either push the linker script into the crosstool, or wrap this in a macro.
+cc_binary(
+    name = "ADIS16505.elf",
+    srcs = [
+        "ADIS16505.cc",
+        "quadrature_encoder.pio.h",
+        "//third_party/pico-sdk/src/rp2_common/boot_stage2:bs2_default_padded_checksummed.S",
+    ],
+    additional_linker_inputs = [
+        "//third_party/pico-sdk:src/rp2_common/pico_standard_link/memmap_default.ld",
+    ],
+    copts = [
+        "-Wno-unused-parameter",
+        "-Wno-unused-variable",
+        "-Wno-double-promotion",
+        "-Wno-format",
+        "-Wno-unused-function",
+    ],
+    includes = ["."],
+    linkopts = [
+        "-Wl,--script=third_party/pico-sdk/src/rp2_common/pico_standard_link/memmap_default.ld",
+    ],
+    target_compatible_with = [
+        "@platforms//os:none",
+        "//tools/platforms/hardware:cortex_m0plus",
+    ],
+    deps = ["//third_party/pico-sdk"],
+)
+
+uf2_from_elf(
+    name = "ADIS16505",
+)