--- /dev/null
+cmake_minimum_required(VERSION 3.13) # Per https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf p30
+include(pico_sdk_import.cmake)
+
+project(tattlekey C CXX ASM)
+
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_CXX_STANDARD 17)
+pico_sdk_init()
+
+add_executable(tattlekey tattlekey.c)
+
+pico_add_extra_outputs(tattlekey)
+
+target_link_libraries(tattlekey pico_stdlib)
+
+install(TARGETS tattlekey RUNTIME LIBRARY ARCHIVE)
--- /dev/null
+{ pkgs ? import ~/devel/nixpkgs { }, }:
+let
+ cc = pkgs.pkgsCross.arm-embedded.stdenv.cc;
+ tattlekey = { lib, stdenv, cmake, pico-sdk, python3 }:
+ stdenv.mkDerivation {
+ pname = "tattlekey";
+ version = "0.0.1";
+ src = lib.cleanSource ./.;
+ nativeBuildInputs = [ cmake python3 ];
+ cmakeFlags = [
+ "-DCMAKE_C_COMPILER=${cc}/bin/arm-none-eabi-cc"
+ "-DCMAKE_CXX_COMPILER=${cc}/bin/arm-none-eabi-c++"
+ "-DPICO_SDK_PATH=${pico-sdk.override { minimal = false; }}/lib/pico-sdk"
+ "-DPICO_TOOLCHAIN_PATH=${cc}/bin"
+ ];
+ /*
+ installPhase = ''
+ runHook preInstall
+
+ mkdir $out
+ mv build/tattlekey.* $out
+
+ runHook postInstall
+ '';
+ */
+ };
+in pkgs.callPackage tattlekey {}
--- /dev/null
+# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
+
+# This can be dropped into an external project to help locate this SDK
+# It should be include()ed prior to project()
+
+if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
+ set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
+ message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
+endif ()
+
+set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
+
+if (NOT PICO_SDK_PATH)
+ message(FATAL_ERROR "SDK location was not specified. Please set PICO_SDK_PATH.")
+endif ()
+
+get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
+if (NOT EXISTS ${PICO_SDK_PATH})
+ message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
+endif ()
+
+set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
+if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
+ message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
+endif ()
+
+set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
+
+include(${PICO_SDK_INIT_CMAKE_FILE})
--- /dev/null
+/**
+ * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "pico/stdlib.h"
+
+int main() {
+#ifndef PICO_DEFAULT_LED_PIN
+#warning blink example requires a board with a regular LED
+#else
+ const uint LED_PIN = PICO_DEFAULT_LED_PIN;
+ gpio_init(LED_PIN);
+ gpio_set_dir(LED_PIN, GPIO_OUT);
+ while (true) {
+ gpio_put(LED_PIN, 1);
+ sleep_ms(250);
+ gpio_put(LED_PIN, 0);
+ sleep_ms(250);
+ }
+#endif
+}