diff --git a/src/bsp/lk/dev/gpio/debug.c b/src/bsp/lk/dev/gpio/debug.c
new file mode 100644
index 0000000..9a32ae5
--- /dev/null
+++ b/src/bsp/lk/dev/gpio/debug.c
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2015 Christopher Anderson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <dev/gpio.h>
+#include <lib/console.h>
+#include <string.h>
+#include <stdio.h>
+
+#if WITH_LIB_CONSOLE
+
+struct flag_labels {
+    unsigned id;
+    const char *label;
+};
+
+struct flag_labels gpio_flag_labels[] = {
+    { GPIO_INPUT,       "input" },
+    { GPIO_OUTPUT,      "output" },
+    { GPIO_LEVEL,       "level" },
+    { GPIO_EDGE,        "edge" },
+    { GPIO_RISING,      "rising" },
+    { GPIO_FALLING,     "falling" },
+    { GPIO_HIGH,        "high" },
+    { GPIO_LOW,         "low" },
+    { GPIO_PULLUP,      "pullup" },
+    { GPIO_PULLDOWN,    "pulldown" },
+};
+
+static unsigned int get_flag_value(const char *str)
+{
+    for (unsigned i = 0; i < countof(gpio_flag_labels); i++) {
+        if (!strcmp(str, gpio_flag_labels[i].label)) {
+            return gpio_flag_labels[i].id;
+        }
+    }
+
+    return 0;
+}
+
+/* Ideally this would be generic, but different platforms have varying manners of handling gpio
+ * numbers / banks etc. Nvidia uses A-F, ST uses # and ports, Xilinx uses #s and banks. Etc.
+ */
+static int cmd_gpio(int argc, const cmd_args *argv)
+{
+    if (argc == 4 && !strcmp(argv[1].str,"set")) {
+        unsigned int gpio = argv[2].u;
+        unsigned int value = argv[3].u;
+
+        gpio_set(gpio, value);
+    } else if (argc == 3 && !strcmp(argv[1].str,"get")) {
+        unsigned int gpio = argv[2].u;
+
+        printf("gpio %u: %d\n", gpio, gpio_get(gpio));
+    } else if (argc >= 3 && !strcmp(argv[1].str,"cfg")) {
+        unsigned int gpio = argv[2].u;
+        unsigned int flags = 0;
+
+        for (int i = 3; i < argc; i++) {
+            flags |= get_flag_value(argv[i].str);
+        }
+
+        gpio_config(gpio, flags);
+    } else {
+        printf("gpio set <gpio #> <value>\n");
+        printf("gpio get <gpio #>\n");
+        printf("gpio cfg <gpio #> [flags: ");
+        for (unsigned int i = 0; i < countof(gpio_flag_labels); i++) {
+            printf("%s ", gpio_flag_labels[i].label);
+        }
+        putchar(']');
+        putchar('\n');
+    }
+
+    return 0;
+}
+STATIC_COMMAND_START
+STATIC_COMMAND("gpio", "commands for manipulating system gpios", &cmd_gpio)
+STATIC_COMMAND_END(gpio);
+
+#endif
