Squashed 'third_party/pico-sdk/' content from commit 2062372d2

Change-Id: Ic20f199d3ed0ea8d3a6a1bbf513f875ec7500cc6
git-subtree-dir: third_party/pico-sdk
git-subtree-split: 2062372d203b372849d573f252cf7c6dc2800c0a
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/cmake/pico_pre_load_platform.cmake b/cmake/pico_pre_load_platform.cmake
new file mode 100644
index 0000000..51ee39a
--- /dev/null
+++ b/cmake/pico_pre_load_platform.cmake
@@ -0,0 +1,29 @@
+# PICO_CMAKE_CONFIG: PICO_PLATFORM, platform to build for e.g. rp2040/host, default=rp2040 or environment value, group=build
+if (DEFINED ENV{PICO_PLATFORM} AND (NOT PICO_PLATFORM))
+    set(PICO_PLATFORM $ENV{PICO_PLATFORM})
+    message("Using PICO_PLATFORM from environment ('${PICO_PLATFORM}')")
+else()
+    if (NOT PICO_PLATFORM)
+        set(PICO_PLATFORM "rp2040")
+        pico_message("Defaulting PICO_PLATFORM to ${PICO_PLATFORM} since not specified.")
+    else()
+        message("PICO platform is ${PICO_PLATFORM}.")
+    endif()
+endif ()
+
+set(PICO_PLATFORM ${PICO_PLATFORM} CACHE STRING "PICO Build platform (e.g. rp2040, host)")
+
+# PICO_CMAKE_CONFIG: PICO_CMAKE_RELOAD_PLATFORM_FILE, custom CMake file to use to set up the platform environment, default=none, group=build
+set(PICO_CMAKE_PRELOAD_PLATFORM_FILE "" CACHE INTERNAL "")
+set(PICO_CMAKE_PRELOAD_PLATFORM_DIR "${CMAKE_CURRENT_LIST_DIR}/preload/platforms" CACHE INTERNAL "")
+
+if (NOT PICO_CMAKE_PRELOAD_PLATFORM_FILE)
+    set(PICO_CMAKE_PRELOAD_PLATFORM_FILE ${PICO_CMAKE_PRELOAD_PLATFORM_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "")
+endif ()
+
+if (NOT EXISTS "${PICO_CMAKE_PRELOAD_PLATFORM_FILE}")
+    message(FATAL_ERROR "${PICO_CMAKE_PRELOAD_PLATFORM_FILE} does not exist. \
+    Either specify a valid PICO_PLATFORM (or PICO_CMAKE_PRELOAD_PLATFORM_FILE).")
+endif ()
+
+include(${PICO_CMAKE_PRELOAD_PLATFORM_FILE})