samples: Create a zephyr sample

Most of the meat of this is in the Makefile, which is able to build the
bootloader, and two small applications, along with instructions on how
to load these into flash and test that upgrades work.

JIRA: MCUB-62
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/samples/zephyr/hello1/Makefile b/samples/zephyr/hello1/Makefile
new file mode 100644
index 0000000..e70a750
--- /dev/null
+++ b/samples/zephyr/hello1/Makefile
@@ -0,0 +1,4 @@
+BOARD ?= qemu_x86
+CONF_FILE = prj.conf
+
+include ${ZEPHYR_BASE}/Makefile.test
diff --git a/samples/zephyr/hello1/README.rst b/samples/zephyr/hello1/README.rst
new file mode 100644
index 0000000..52a25d7
--- /dev/null
+++ b/samples/zephyr/hello1/README.rst
@@ -0,0 +1,38 @@
+.. _hello_world:
+
+Hello World
+###########
+
+Overview
+********
+A simple Hello World example that can be used with any supported board and
+prints 'Hello World' to the console. This application can be built into modes:
+
+* single thread
+* multi threading
+
+Building and Running
+********************
+
+This project outputs 'Hello World' to the console.  It can be built and executed
+on QEMU as follows:
+
+.. code-block:: console
+
+   $ cd samples/hello_world
+   $ make run
+
+
+To build the single thread version, use the supplied configuration file for
+single thread: :file:`prj_single.conf`:
+
+.. code-block:: console
+
+   $ make CONF_FILE=prj_single.conf run
+
+Sample Output
+=============
+
+.. code-block:: console
+
+    Hello World! x86
diff --git a/samples/zephyr/hello1/frdm_k64f.overlay b/samples/zephyr/hello1/frdm_k64f.overlay
new file mode 100644
index 0000000..8ca56d7
--- /dev/null
+++ b/samples/zephyr/hello1/frdm_k64f.overlay
@@ -0,0 +1,9 @@
+/* DTS overlay file.
+ * vim: ft=dts
+ */
+
+/ {
+	chosen {
+		zephyr,code-partition = &slot0_partition;
+	};
+};
diff --git a/samples/zephyr/hello1/prj.conf b/samples/zephyr/hello1/prj.conf
new file mode 100644
index 0000000..b5d941b
--- /dev/null
+++ b/samples/zephyr/hello1/prj.conf
@@ -0,0 +1,7 @@
+# Enable the console
+CONFIG_CONSOLE_SHELL=y
+CONFIG_KERNEL_SHELL=y
+
+# Use the bootloader.
+CONFIG_BOOT_HEADER=y
+CONFIG_TEXT_SECTION_OFFSET=0x200
diff --git a/samples/zephyr/hello1/sample.yaml b/samples/zephyr/hello1/sample.yaml
new file mode 100644
index 0000000..47396bf
--- /dev/null
+++ b/samples/zephyr/hello1/sample.yaml
@@ -0,0 +1,15 @@
+sample:
+  name: hello world
+  description: Hello World sample, the simplest Zephyr application
+  platforms: all
+tests:
+    - test:
+        build_only: true
+        tags: samples tests
+        min_ram: 16
+    - singlethread:
+        build_only: true
+        extra_args: CONF_FILE=prj_single.conf
+        filter: not CONFIG_BLUETOOTH and not CONFIG_GPIO_SCH
+        tags: samples tests
+        min_ram: 16
diff --git a/samples/zephyr/hello1/src/Makefile b/samples/zephyr/hello1/src/Makefile
new file mode 100644
index 0000000..00066e1
--- /dev/null
+++ b/samples/zephyr/hello1/src/Makefile
@@ -0,0 +1 @@
+obj-y = main.o
diff --git a/samples/zephyr/hello1/src/main.c b/samples/zephyr/hello1/src/main.c
new file mode 100644
index 0000000..3acc91d
--- /dev/null
+++ b/samples/zephyr/hello1/src/main.c
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) 2012-2014 Wind River Systems, Inc.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <zephyr.h>
+#include <misc/printk.h>
+
+void main(void)
+{
+	printk("Hello World number 1! %s\n", CONFIG_ARCH);
+}