enable serial recovery functionality on the zephyr mcuboot

This patch introduced serial bootloader functionality ported
from mynewt targets tree.

For achieving this following changes were applied:
- Modified boot_serial module for using, zephyr-os modules
  (crc driver, mbedtls-base64 library) and the zephyr serial adapter module
  introduced recently.
- Added service of boot serial recovery mode to main.
- Adapted the input parser to using static buffers.

Default serial-boot-pin configuration was added for nrf52_pca10040
and nrf52840_pca10056 boards.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
diff --git a/boot/zephyr/CMakeLists.txt b/boot/zephyr/CMakeLists.txt
index 0b9eabb..e303421 100644
--- a/boot/zephyr/CMakeLists.txt
+++ b/boot/zephyr/CMakeLists.txt
@@ -6,6 +6,9 @@
 
 cmake_minimum_required(VERSION 3.8.2)
 
+
+set(KCONFIG_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../Kconfig)
+
 ########################
 # Configuration choices.
 ########################
@@ -168,3 +171,12 @@
   target_sources(app PRIVATE "${TINYCRYPT_DIR}/source/sha256.c")
   target_sources(app PRIVATE "${TINYCRYPT_DIR}/source/utils.c")
 endif()
+
+if (CONFIG_MCUBOOT_SERIAL)
+zephyr_sources(${BOOT_DIR}/zephyr/serial_adapter.c)
+
+add_subdirectory(${BOOT_DIR}/boot_serial ./boot/boot_serial)
+add_subdirectory(${BOOT_DIR}/zephyr/tinycbor)
+add_subdirectory(${BOOT_DIR}/zephyr/cborattr)
+
+endif()