aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-08-23 17:08:59 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-08-23 17:12:21 +0200
commit3061ecca3d0fdfb87dabbf5f63c9e06c2a30f53a (patch)
treeab49cc16ed0b853452c5c2ed2d3042416d628986 /thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include
downloadiot-sensors-master.tar.gz
iot-sensors-master.tar.bz2
iot-sensors-master.tar.xz
iot-sensors-master.zip
o Initial import.HEADmaster
Diffstat (limited to 'thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include')
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/antfs_ota.h155
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_boot_settings.h134
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_boot_settings_api.h88
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_dfu_constrains.h119
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader.h127
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader_types.h118
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader_util.h79
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/debug_pin.h146
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu.h149
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu_transport.h77
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu_types.h180
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/error_handler.h102
12 files changed, 1474 insertions, 0 deletions
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/antfs_ota.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/antfs_ota.h
new file mode 100644
index 0000000..1f84df7
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/antfs_ota.h
@@ -0,0 +1,155 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2014
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+
+#ifndef ANTFS_OTA_H__
+#define ANTFS_OTA_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * OTA Update Information File
+ */
+#define OTA_INFO_FILE_STRUCTURE_VERSION_BYTES 1
+#define OTA_INFO_HARDWARE_VERSION_BYTES 1
+#define OTA_INFO_REGION_PRODUCT_ID_BYTES 1
+#define OTA_INFO_MAXIMUM_SWAP_SPACE_BYTES 4
+#define OTA_INFO_WIRELESS_STACK_VERSION_ID_BYTES 4
+#define OTA_INFO_WIRELESS_STACK_VERSION_LENGTH_BYTES 1
+#define OTA_INFO_WIRELESS_STACK_VERSION_STRING_BYTES 16
+#define OTA_INFO_BOOTLOADER_VERSION_ID_BYTES 4
+#define OTA_INFO_BOOTLOADER_VERSION_LENGTH_BYTES 1
+#define OTA_INFO_BOOTLOADER_VERSION_STRING_BYTES 16
+#define OTA_INFO_APPLICATION_VERSION_ID_BYTES 4
+#define OTA_INFO_APPLICATION_VERSION_LENGTH_BYTES 1
+#define OTA_INFO_APPLICATION_VERSION_STRING_BYTES 16
+
+#define OTA_INFO_FILE_STRUCTURE_VERSION_OFFSET 0
+#define OTA_INFO_HARDWARE_VERSION_OFFSET OTA_INFO_FILE_STRUCTURE_VERSION_OFFSET + OTA_INFO_FILE_STRUCTURE_VERSION_BYTES
+#define OTA_INFO_REGION_PRODUCT_ID_OFFSET OTA_INFO_HARDWARE_VERSION_OFFSET + OTA_INFO_HARDWARE_VERSION_BYTES
+#define OTA_INFO_MAXIMUM_SWAP_SPACE_OFFSET OTA_INFO_REGION_PRODUCT_ID_OFFSET + OTA_INFO_REGION_PRODUCT_ID_BYTES
+#define OTA_INFO_WIRELESS_STACK_VERSION_ID_OFFSET OTA_INFO_MAXIMUM_SWAP_SPACE_OFFSET + OTA_INFO_MAXIMUM_SWAP_SPACE_BYTES
+#define OTA_INFO_WIRELESS_STACK_VERSION_LENGTH_OFFSET OTA_INFO_WIRELESS_STACK_VERSION_ID_OFFSET + OTA_INFO_WIRELESS_STACK_VERSION_ID_BYTES
+#define OTA_INFO_WIRELESS_STACK_VERSION_STRING_OFFSET OTA_INFO_WIRELESS_STACK_VERSION_LENGTH_OFFSET + OTA_INFO_WIRELESS_STACK_VERSION_LENGTH_BYTES
+#define OTA_INFO_BOOTLOADER_VERSION_ID_OFFSET OTA_INFO_WIRELESS_STACK_VERSION_STRING_OFFSET + OTA_INFO_WIRELESS_STACK_VERSION_STRING_BYTES
+#define OTA_INFO_BOOTLOADER_VERSION_LENGTH_OFFSET OTA_INFO_BOOTLOADER_VERSION_ID_OFFSET + OTA_INFO_BOOTLOADER_VERSION_ID_BYTES
+#define OTA_INFO_BOOTLOADER_VERSION_STRING_OFFSET OTA_INFO_BOOTLOADER_VERSION_LENGTH_OFFSET + OTA_INFO_BOOTLOADER_VERSION_LENGTH_BYTES
+#define OTA_INFO_APPLICATION_VERSION_ID_OFFSET OTA_INFO_BOOTLOADER_VERSION_STRING_OFFSET + OTA_INFO_BOOTLOADER_VERSION_STRING_BYTES
+#define OTA_INFO_APPLICATION_VERSION_LENGTH_OFFSET OTA_INFO_APPLICATION_VERSION_ID_OFFSET + OTA_INFO_APPLICATION_VERSION_ID_BYTES
+#define OTA_INFO_APPLICATION_VERSION_STRING_OFFSET OTA_INFO_APPLICATION_VERSION_LENGTH_OFFSET + OTA_INFO_APPLICATION_VERSION_LENGTH_BYTES
+#define OTA_INFO_FILE_END_OFFSET OTA_INFO_APPLICATION_VERSION_STRING_OFFSET + OTA_INFO_APPLICATION_VERSION_STRING_BYTES
+
+#define OTA_UPDATE_INFO_FILE_DATA_TYPE ((uint8_t)0x0E)
+#define OTA_UPDATE_INFO_FILE_SIZE ((uint32_t)OTA_INFO_FILE_END_OFFSET)
+
+#define OTA_INFO_FILE_STRUCTURE_VERSION ((uint8_t)0x10) //The most significant 4 bits indicate major revision, while the least significant 4 bits indicate a minor revision.
+#define OTA_INFO_HARDWARE_VERSION ((uint8_t)0x00) //TODO TBD
+#define OTA_INFO_REGION_PRODUCT_ID ((uint8_t)0x00) //TODO TBD
+
+#define OTA_INFO_WIRELESS_STACK_VERSION_ID ((uint32_t)0x00000000)
+#define OTA_INFO_BOOTLOADER_VERSION_ID ((uint32_t)0x00000000)
+#define OTA_INFO_APPLICATION_VERSION_ID ((uint32_t)0x00000000)
+
+/*
+ * OTA Update Image File
+ */
+#define OTA_IMAGE_HEADER_SIZE_OFFSET 0
+#define OTA_IMAGE_HEADER_FILE_STRUCT_VER_OFFSET 1
+#define OTA_IMAGE_HEADER_ARCH_ID_OFFSET 2
+#define OTA_IMAGE_HEADER_ID_STRING_OFFSET 4
+#define OTA_IMAGE_HEADER_IMAGE_FORMAT_OFFSET 8
+#define OTA_IMAGE_HEADER_RESERVED_OFFSET 9
+#define OTA_IMAGE_HEADER_IMAGE_STACK_SIZE_OFFSET 18
+#define OTA_IMAGE_HEADER_IMAGE_BOOTLOADER_SIZE_OFFSET 22
+#define OTA_IMAGE_HEADER_IMAGE_APPLICATION_SIZE_OFFSET 26
+#define OTA_IMAGE_HEADER_VERSION_INFO_SIZE_OFFSET 30
+
+#define OTA_IMAGE_HEADER_SIZE_MAX 256
+#define OTA_IMAGE_FILE_STRUCT_VERSION_RANGE_START 0x11
+#define OTA_IMAGE_FILE_STRUCT_VERSION_RANGE_END 0x1F
+#define OTA_IMAGE_ARCH_IDENTIFIER_ST_BL_AP 1
+#define OTA_IMAGE_ID_STRING_SIZE_MAX 4
+#define OTA_IMAGE_RESERVED_SIZE_MAX 9
+#define OTA_IMAGE_IMAGE_FORMAT_BINARY 0
+#define OTA_IMAGE_IMAGE_FORMAT_ENCRYPTED_BINARIES 1
+
+#define OTA_IMAGE_CRC_SIZE_MAX 4
+
+typedef struct
+{
+ uint8_t header_size;
+ uint8_t file_struct_version;
+ uint16_t architecture_identifier;
+ uint8_t identifier_string[OTA_IMAGE_ID_STRING_SIZE_MAX];
+ uint8_t image_format;
+ uint8_t reserved[OTA_IMAGE_RESERVED_SIZE_MAX];
+ uint32_t wireless_stack_size;
+ uint32_t bootloader_size;
+ uint32_t application_size;
+ uint16_t version_info_size;
+} __attribute__((packed)) ota_image_header_t;
+
+void antfs_ota_init (void);
+
+void antfs_ota_update_information_file_get (uint32_t * p_length, uint8_t ** pp_data);
+
+bool antfs_ota_image_header_parsing (uint8_t ** pp_data, uint32_t * p_length);
+ota_image_header_t * antfs_ota_image_header_get (void);
+uint16_t antfs_ota_image_header_crc_get (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANTFS_OTA_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_boot_settings.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_boot_settings.h
new file mode 100644
index 0000000..76ffa37
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_boot_settings.h
@@ -0,0 +1,134 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2014
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+
+#ifndef ANT_BOOT_SETTINGS_H__
+#define ANT_BOOT_SETTINGS_H__
+
+#include <stdint.h>
+#include "ant_dfu_constrains.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define FLASH_LAST_PAGE (NRF5x_FLASH_END / CODE_PAGE_SIZE - 1)
+
+#define ANT_BOOT_SETTINGS_SIZE 128UL
+#define ANT_BOOT_SETTINGS_LOCATION (NRF5x_FLASH_END - ANT_BOOT_SETTINGS_SIZE)
+
+#define ANT_BOOT_SETTINGS_BASE ANT_BOOT_SETTINGS_LOCATION
+
+#define ANT_BOOT_PARAM_FLAGS_BASE (NRF5x_FLASH_END - 4)
+#define ANT_BOOT_PARAM_RETURN_BASE (NRF5x_FLASH_END - 8)
+#define ANT_BOOT_APP_VERSION_BASE (NRF5x_FLASH_END - 0x18)
+#define ANT_BOOT_APP_SIZE_BASE (NRF5x_FLASH_END - 0x1C)
+
+#define ANT_BOOT_PARAM_FLAGS ((uint32_t *) ANT_BOOT_PARAM_FLAGS_BASE)
+#define ANT_BOOT_PARAM_RETURN ((uint32_t *) ANT_BOOT_PARAM_RETURN_BASE)
+#define ANT_BOOT_APP_VERSION ((uint8_t *) ANT_BOOT_APP_VERSION_BASE)
+#define ANT_BOOT_APP_SIZE ((uint32_t *) ANT_BOOT_APP_SIZE_BASE)
+
+#define PARAM_FLAGS_PARAM_VALID_Pos (0UL)
+#define PARAM_FLAGS_PARAM_VALID_Msk (0x1UL << PARAM_FLAGS_PARAM_VALID_Pos)
+#define PARAM_FLAGS_PARAM_VALID_True (0UL)
+#define PARAM_FLAGS_PARAM_VALID_False (1UL)
+
+#define PARAM_FLAGS_ENTER_BOOT_Pos (1UL)
+#define PARAM_FLAGS_ENTER_BOOT_Msk (0x3UL << PARAM_FLAGS_ENTER_BOOT_Pos)
+#define PARAM_FLAGS_ENTER_BOOT_BypassInit (0x3UL)
+#define PARAM_FLAGS_ENTER_BOOT_EnterBoot (0x2UL)
+#define PARAM_FLAGS_ENTER_BOOT_BypassDone (0x0UL)
+
+#define PARAM_FLAGS_PRE_ERASE_Pos (3UL)
+#define PARAM_FLAGS_PRE_ERASE_Msk (0x1UL << PARAM_FLAGS_PRE_ERASE_Pos)
+#define PARAM_FLAGS_PRE_ERASE_Ignore (1UL)
+#define PARAM_FLAGS_PRE_ERASE_Erase (0UL)
+
+#define PARAM_RETURN_BOOT_STATUS_Pos (0UL)
+#define PARAM_RETURN_BOOT_STATUS_Msk (0xFFUL << PARAM_FLAGS_ENTER_BOOT_Pos)
+
+#define APP_SIZE_Clear (0x00000000UL)
+#define APP_SIZE_Empty (0xFFFFFFFFUL)
+
+
+/*
+*
+* A soft-reset(NVIC_SystemReset()) must be executed after the information for the bootloader has been filled in.
+* i.e.
+* {
+* ant_boot_settings_t ant_boot_settings;
+*
+* ant_boot_settings_clear(&ant_boot_settings); // Clears and set FFs to the memory block
+* ant_boot_settings.app_version[0] = version[0]; // Start filling parameters
+* ant_boot_settings.app_version[1] = version[1];
+* ant_boot_settings.app_version[2] = version[2];
+* ant_boot_settings_save(&ant_boot_settings);
+* ant_boot_settings_validate(1); // Sets in the magic number. Must be done last before the reset!!!
+* NVIC_SystemReset(); // Do the soft reset
+* }
+*/
+typedef struct
+{
+ uint8_t reserved[100];
+
+ uint32_t app_size; // Application size
+ uint8_t app_version[16]; // Application version
+ uint32_t param_return;
+ uint32_t param_flags;
+} __attribute__((packed)) ant_boot_settings_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //ANT_BOOT_SETTINGS_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_boot_settings_api.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_boot_settings_api.h
new file mode 100644
index 0000000..428e152
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_boot_settings_api.h
@@ -0,0 +1,88 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2014
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+
+#ifndef ANT_BOOT_SETTINGS_API_H__
+#define ANT_BOOT_SETTINGS_API_H__
+
+#include <stdint.h>
+#include "ant_boot_settings.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+*
+* A soft-reset(NVIC_SystemReset()) must be executed after the information for the bootloader has been filled in.
+* i.e.
+* {
+* ant_boot_settings_t ant_boot_settings;
+*
+* ant_boot_settings_clear(&ant_boot_settings); // Clears and set FFs to the memory block
+* ant_boot_settings.app_version[0] = version[0]; // Start filling parameters
+* ant_boot_settings.app_version[1] = version[1];
+* ant_boot_settings.app_version[2] = version[2];
+* ant_boot_settings_save(&ant_boot_settings);
+* ant_boot_settings_validate(1); // Sets in the magic number. Must be done last before the reset!!!
+* NVIC_SystemReset(); // Do the soft reset
+* }
+*/
+void ant_boot_settings_sys_event_handler(uint32_t sys_evt, void * p_context);
+void ant_boot_settings_get(const ant_boot_settings_t ** pp_boot_settings);
+uint32_t ant_boot_settings_clear(ant_boot_settings_t * boot_settings);
+uint32_t ant_boot_settings_save(ant_boot_settings_t * boot_settings);
+void ant_boot_settings_validate(bool enter_boot_mode);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //ANT_BOOT_SETTINGS_API_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_dfu_constrains.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_dfu_constrains.h
new file mode 100644
index 0000000..4547363
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/boot_common/ant_dfu_constrains.h
@@ -0,0 +1,119 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2015
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+
+#ifndef ANT_DFU_CONSTRAINS_H__
+#define ANT_DFU_CONSTRAINS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@file
+ *
+ * @defgroup ant_dfu_constrains Memory constraints for ANT DFU
+ * @{
+ *
+ * @ingroup nrf_dfu
+ *
+ */
+
+#ifdef NRF51 // nrf51 @ S210
+ /** End of nRF51 flash */
+ #define NRF5x_FLASH_END 0x00040000UL
+
+ /** This field should correspond to the start address of the bootloader, found in the
+ UICR.BOOTLOADERADDR, 0x10001014, register. This value is used for a sanity check,
+ so the bootloader will fail immediately if this value differs from the runtime value.
+ The value is used to determine the maximum DFU region size. */
+ #define BOOTLOADER_REGION_START 0x0003B800
+
+ /** Page location of the bootloader settings address. */
+ #define BOOTLOADER_SETTINGS_ADDRESS 0x0003FC00
+
+ /** Size of a flash codepage. Used for size of the reserved flash space in the bootloader
+ region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is
+ correct. */
+ #define CODE_PAGE_SIZE 1024
+
+#elif defined(NRF52) // nrf52 @ S212 and S332
+ /** End of nRF52 flash */
+ #define NRF5x_FLASH_END 0x00080000UL
+
+ /** This field should correspond to the start address of the bootloader, found in the
+ UICR.BOOTLOADERADDR, 0x10001014, register. This value is used for a sanity check,
+ so the bootloader will fail immediately if this value differs from the runtime value.
+ The value is used to determine the maximum DFU region size. */
+ #define BOOTLOADER_REGION_START 0x00079000
+
+ /** Page location of the bootloader settings address. */
+ #define BOOTLOADER_SETTINGS_ADDRESS (NRF5x_FLASH_END - CODE_PAGE_SIZE)
+
+ /** The sd_mbr_command call may require parameters to be retained in a separate flash page provided by the application.
+ The uicr register UICR.NRFFW[1] must be set to an address corresponding to this page in the application flash space. */
+ #define BOOTLOADER_MBR_RETAINING_PAGE_ADDRESS (BOOTLOADER_SETTINGS_ADDRESS - CODE_PAGE_SIZE)
+
+ /** Size of a flash codepage. Used for size of the reserved flash space in the bootloader
+ region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is
+ correct. */
+ #define CODE_PAGE_SIZE 4096
+
+#else
+ #error Unknown platform for ANT DFU
+#endif
+
+/**@} */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //ANT_DFU_CONSTRAINS_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader.h
new file mode 100644
index 0000000..a960ef6
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader.h
@@ -0,0 +1,127 @@
+/**
+ * Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/**@file
+ *
+ * @defgroup nrf_bootloader Bootloader API.
+ * @{
+ *
+ * @brief Bootloader module interface.
+ */
+
+#ifndef BOOTLOADER_H__
+#define BOOTLOADER_H__
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "bootloader_types.h"
+#include <dfu_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Function for initializing the Bootloader.
+ *
+ * @retval NRF_SUCCESS If bootloader was succesfully initialized.
+ */
+uint32_t bootloader_init(void);
+
+/**@brief Function for validating application region.
+ *
+ * @param[in] app_addr Address to the region where the application is stored.
+ *
+ * @retval true If Application region is valid.
+ * @retval false If Application region is not valid.
+ */
+bool bootloader_app_is_valid(uint32_t app_addr);
+
+/**@brief Function for starting the Device Firmware Update.
+ *
+ * @retval NRF_SUCCESS If new appliction image was successfully transfered.
+ */
+uint32_t bootloader_dfu_start(void);
+
+/**@brief Function for
+ *
+ * @param[in] app_addr Address to the region where the application is stored.
+ */
+void bootloader_app_start(uint32_t app_addr);
+
+/**@brief Function for processing DFU status update.
+ *
+ * @param[in] update_status DFU update status.
+ */
+void bootloader_dfu_update_process(dfu_update_status_t update_status);
+
+/**@brief Function for continuing the Device Firmware Update of a SoftDevice.
+ *
+ * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful.
+ */
+uint32_t bootloader_dfu_sd_update_continue (void);
+
+uint32_t bootloader_dfu_sd_update_validate(void);
+
+uint32_t bootloader_dfu_bl_update_continue(void);
+
+uint32_t bootloader_dfu_ap_update_continue(void);
+/**@brief Function for finalizing the Device Firmware Update of a SoftDevice.
+ *
+ * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful.
+ */
+uint32_t bootloader_dfu_sd_update_finalize(void);
+
+/**@brief Function for writing word into flash.
+ *
+ * @param[in] p_dst Address to write.
+ * @param[in] data Data to write.
+ * @retval NRF_SUCCESS If the write operation was successful.
+ */
+uint32_t blocking_flash_word_write(uint32_t * const p_dst, uint32_t data);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // BOOTLOADER_H__
+
+/**@} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader_types.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader_types.h
new file mode 100644
index 0000000..cb2834f
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader_types.h
@@ -0,0 +1,118 @@
+/**
+ * Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/**@file
+ *
+ * @defgroup nrf_bootloader_types Types and definitions.
+ * @{
+ *
+ * @ingroup nrf_bootloader
+ *
+ * @brief Bootloader module type and definitions.
+ */
+
+#ifndef BOOTLOADER_TYPES_H__
+#define BOOTLOADER_TYPES_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define BOOTLOADER_SETTINGS_INVALID_APPLICATION 0xDEADBEEF
+#define BOOTLOADER_SETTINGS_VALID_APPLICATION 0x00000000
+
+#define BOOTLOADER_SETTINGS_SD_IMAGE_SIZE_ADR_OFFSET (0UL)
+#define BOOTLOADER_SETTINGS_BL_IMAGE_SIZE_ADR_OFFSET (4UL)
+#define BOOTLOADER_SETTINGS_AP_IMAGE_SIZE_ADR_OFFSET (8UL)
+#define BOOTLOADER_SETTINGS_SRC_IMAGE_ADR_ADR__OFFSET (12UL)
+#define BOOTLOADER_SETTINGS_AP_VALIDITY_ADR_OFFSET (16UL)
+#define BOOTLOADER_SETTINGS_RESERVED_1_ADR__OFFSET (20UL)
+#define BOOTLOADER_SETTINGS_RESERVED_3_ADR_OFFSET (24UL)
+#define BOOTLOADER_SETTINGS_VALID_SLOT_ADR_OFFSET (28UL)
+
+#define NEW_IMAGE_BANK_DONE (0UL)
+#define NEW_IMAGE_BANK_0 (1UL)
+#define NEW_IMAGE_BANK_1 (2UL)
+#define NEW_IMAGE_BANK_INVALID (3UL)
+
+#define NEW_IMAGE_SIZE_UNUSED (0x3FFFFFFF)
+#define NEW_IMAGE_SIZE_EMPTY (0x00000000)
+
+#define NEW_IMAGE_INVALID (0xFFFFFFFF)
+#define NEW_IMAGE_USED (0x00000000)
+
+#define SRC_IMAGE_ADDRESS_EMPTY (0xFFFFFFFF)
+#define SRC_IMAGE_ADDRESS_INVALID (0x00000000)
+
+typedef union
+{
+ uint32_t all;
+ struct
+ {
+ uint32_t size : 30; /**< Size of the new image*/
+ uint32_t bank : 2; /**< Which bank it is stored*/
+ }st;
+}new_image_t;
+
+/**@brief Structure holding bootloader settings for application and bank data.
+ * NOTE: If there is a need to update the structure make sure offsets above are still true.
+ */
+typedef struct
+{
+ new_image_t sd_image; /**< New Softdevice image size */
+ new_image_t bl_image; /**< New Bootloader image size */
+ new_image_t ap_image; /**< New Application image size */
+ uint32_t src_image_address; /**< New Images storage starting address */
+ uint32_t valid_app; /**< Valid application is present if value is 0xFFFFFFFF or 0x00000000 */
+ uint32_t reserved_1;
+ uint32_t reserved_2;
+ uint32_t valid_slot; /**< Valid bootloader_settings slot. Must be written last*/
+} bootloader_settings_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // BOOTLOADER_TYPES_H__
+
+/**@} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader_util.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader_util.h
new file mode 100644
index 0000000..b1699bd
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/bootloader_util.h
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+ /**@file
+ *
+ * @defgroup nrf_bootloader_util Bootloader util API.
+ * @{
+ *
+ * @brief Bootloader util module interface.
+ */
+
+#ifndef BOOTLOADER_UTIL_H__
+#define BOOTLOADER_UTIL_H__
+
+#include <stdint.h>
+#include "bootloader_types.h"
+#include <dfu_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Function for starting the application.
+ *
+ * @param[in] start_addr Start address.
+ */
+void bootloader_util_app_start(uint32_t start_addr);
+
+/**@brief Function for getting the bootloader settings.
+ *
+ * @param[out] pp_bootloader_settings Bootloader settings.
+ */
+void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_settings);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // BOOTLOADER_UTIL_H__
+
+/**@} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/debug_pin.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/debug_pin.h
new file mode 100644
index 0000000..2310b1b
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/debug_pin.h
@@ -0,0 +1,146 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2014
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+
+#ifndef DEBUG_PIN_H__
+#define DEBUG_PIN_H__
+
+#include "nrf.h"
+//#include "nrf51_bitfields.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**********************************************************************************/
+/* Comment this out to DISABLE all Debugging pins especially on official releases.*/
+//#define DEBUGGING_PINS_ENABLE
+
+#if defined (DEBUGGING_PINS_ENABLE)
+ #define DEBUG_DFU_BOOTLOADER
+// #define DEBUG_UART_STACKCHECK
+
+#define DEBUG_USE_UART_OUT
+#endif // STACK_DEBUGGING_PINS_ENABLE
+
+/**********************************************************************************/
+
+#define DEBUG_PIN_ON(pin) { NRF_GPIO->OUTSET = (1UL << (pin)); }
+#define DEBUG_PIN_OFF(pin) { NRF_GPIO->OUTCLR = (1UL << (pin)); }
+#define DEBUG_PIN_RISE(pin) { NRF_GPIO->OUTCLR = (1UL << (pin)); NRF_GPIO->OUTSET = (1UL << (pin));}
+#define DEBUG_PIN_FALL(pin) { NRF_GPIO->OUTSET = (1UL << (pin)); NRF_GPIO->OUTCLR = (1UL << (pin));}
+
+/*DEBUG OUT, !!!!WARNING THIS USES UART0!!!! */
+
+#if defined (DEBUG_USE_UART_OUT)
+
+#define DEBUG_UART_INIT(pin) NRF_UART0->PSELRXD = 0xFFFFFFFF;\
+ NRF_UART0->PSELTXD = pin;\
+ NRF_UART0->CONFIG = 0x00;\
+ NRF_UART0->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1M;\
+ NRF_UART0->ENABLE = UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos;\
+ NRF_UART0->TASKS_STARTTX = 1;
+#define DEBUG_UART_OUT(val) NRF_UART0->TXD = val
+
+#else
+
+#define DEBUG_UART_INIT(pin)
+#define DEBUG_UART_OUT(val)
+
+#endif
+
+//////////////////////////////////////////////////////////////////
+// CONFIGURE DEBUG PINS HERE
+//////////////////////////////////////////////////////////////////
+
+/*****************************************
+ * APP_DFU
+ */
+#if defined (DEBUG_DFU_BOOTLOADER)
+
+/*starts at 24 ends at 32*/
+#define DBG_DFU_BOOTLOADER_PATH 24
+#define DBG_DFU_FLASH_IMAGE_STATUS 25
+#define DBG_DFU_CKPT_PINC 25
+#define DBG_DFU_CKPT_PINA 28
+#define DBG_DFU_CKPT_PINB 29
+//#define DBG_DFU_FLASH_PIN 29
+// #define DBG_DFU_FLASH_ERASE 8
+// #define DBG_DFU_FLASH_WRITE 9
+// #define DBG_DFU_FLASH_RESP 10
+// #define DBG_DFU_FLASH_PSTORAGE_CB 11
+// #define DBG_DFU_FLASH_CB_HANDLER 12
+
+#define DBG_DFU_UART_OUT_PIN 30 //antfs_event_process
+#define DBG_UART_DFU_ANTFS_EVENT_PIN 30
+#define DBG_UART_ANTFS_DFU_STATE_PIN 30
+#define DBG_UART_DFU_DATA_OFFSET_PIN 30
+
+
+ #define DBG_PIN_DIR_INIT { NRF_GPIO->DIRSET = 0xFFFF0000;\
+ DEBUG_UART_INIT(DBG_DFU_UART_OUT_PIN);}
+#endif //DEBUG_DFU_BOOTLOADER
+/*
+ * APP_DFU END
+ *****************************************/
+
+#ifndef DBG_PIN_DIR_INIT
+ #define DBG_PIN_DIR_INIT
+#endif
+
+void stack_debug_Manchester_Start(uint8_t ucPin, uint8_t ucCode);
+void stack_debug_Manchester_Stop(uint8_t ucPin);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DEBUG_PIN_H_ */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu.h
new file mode 100644
index 0000000..6dfb06b
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu.h
@@ -0,0 +1,149 @@
+/**
+ * Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/**@file
+ *
+ * @defgroup nrf_dfu Device Firmware Update API.
+ * @{
+ *
+ * @brief Device Firmware Update module interface.
+ */
+
+#ifndef DFU_H__
+#define DFU_H__
+
+#include <dfu_types.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**@brief DFU event callback for asynchronous calls.
+ *
+ * @param[in] result Operation result code. NRF_SUCCESS when a queued operation was successful.
+ * @param[in] p_data Pointer to the data to which the operation is related.
+ */
+typedef void (*dfu_callback_t)(uint32_t result, uint8_t * p_data);
+
+/**@brief Function for initializing the Device Firmware Update module.
+ *
+ * @return NRF_SUCCESS on success, an error_code otherwise.
+ */
+uint32_t dfu_init(void);
+
+/**@brief Function for registering a callback listener for \ref dfu_data_pkt_handle callbacks.
+ */
+void dfu_register_callback(dfu_callback_t callback_handler);
+
+/**@brief Function for setting the DFU image size.
+ *
+ * @details Function sets the DFU image size. This function must be called when an update is started
+ * in order to notify the DFU of the new image size. If multiple images are to be
+ * transferred within the same update context then this function must be called with size
+ * information for each image being transfered.
+ * If an image type is not being transfered, e.g. SoftDevice but no Application , then the
+ * image size for application must be zero.
+ *
+ * @param[in] p_packet Pointer to the DFU packet containing information on DFU update process to be started.
+ *
+ * @return NRF_SUCCESS on success, an error_code otherwise.
+ */
+uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet);
+
+/**@brief Function for handling DFU data packets.
+ *
+ * @param[in] p_packet Pointer to the DFU packet.
+ *
+ * @return NRF_SUCCESS on success, an error_code otherwise.
+ */
+uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet);
+
+/**@brief Function for handling DFU init packets.
+ *
+ * @return NRF_SUCCESS on success, an error_code otherwise.
+ */
+uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet);
+
+/**@brief Function for validating a transferred image after the transfer has completed.
+ *
+ * @return NRF_SUCCESS on success, an error_code otherwise.
+ */
+uint32_t dfu_image_validate(uint16_t crc_seed);
+
+/**@brief Function for activating the transfered image after validation has successfully completed.
+ *
+ * @return NRF_SUCCESS on success, an error_code otherwise.
+ */
+uint32_t dfu_image_activate(void);
+
+/**@brief Function for reseting the current update procedure and return to initial state.
+ *
+ * @details This function call will result in a system reset to ensure correct system behavior.
+ * The reset will might be scheduled to execute at a later point in time to ensure pending
+ * flash operations has completed.
+ *
+ */
+void dfu_reset(void);
+
+
+uint32_t dfu_bl_image_validate(void);
+
+uint32_t dfu_sd_image_validate(void);
+
+
+uint32_t dfu_bl_image_swap(void);
+
+uint32_t dfu_sd_image_swap(void);
+
+uint32_t dfu_ap_image_swap(void);
+
+uint32_t dfu_storage_start_address_get(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // DFU_H__
+
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu_transport.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu_transport.h
new file mode 100644
index 0000000..e9b140e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu_transport.h
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/**@file
+ *
+ * @defgroup nrf_dfu_transport DFU transport API.
+ * @{
+ *
+ * @brief DFU transport module interface.
+ */
+
+#ifndef DFU_TRANSPORT_H__
+#define DFU_TRANSPORT_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Function for starting the update of Device Firmware.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ */
+uint32_t dfu_transport_update_start(void);
+
+/**@brief Function for closing the transport layer.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ */
+uint32_t dfu_transport_close(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // DFU_TRANSPORT_H__
+
+/**@} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu_types.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu_types.h
new file mode 100644
index 0000000..e62bb73
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/dfu_types.h
@@ -0,0 +1,180 @@
+/**
+ * Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/**@file
+ *
+ * @defgroup nrf_dfu_types Types and definitions.
+ * @{
+ *
+ * @ingroup nrf_dfu
+ *
+ * @brief Device Firmware Update module type and definitions.
+ */
+
+#ifndef DFU_TYPES_H__
+#define DFU_TYPES_H__
+
+#include <stdint.h>
+#include "nrf.h"
+#include "app_util.h"
+#include "nrf_sdm.h"
+#include "ant_dfu_constrains.h"
+#include "nrf_mbr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NRF_UICR_BOOT_START_ADDRESS (NRF_UICR_BASE + 0x14) /**< Register where the bootloader start address is stored in the UICR register. */
+#define NRF_UICR_NRFFW_1 (NRF_UICR_BASE + 0x18) /**< Register where the MBR retaining address is stored in the UICR register. */
+
+#define CODE_REGION_1_START SD_SIZE_GET(MBR_SIZE) /**< This field should correspond to the size of Code Region 0, (which is identical to Start of Code Region 1), found in UICR.CLEN0 register. This value is used for compile safety, as the linker will fail if application expands into bootloader. Runtime, the bootloader will use the value found in UICR.CLEN0. */
+
+#define SOFTDEVICE_REGION_START MBR_SIZE /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
+
+#define DFU_REGION_TOTAL_SIZE (BOOTLOADER_REGION_START - CODE_REGION_1_START) /**< Total size of the region between SD and Bootloader. */
+
+#define DFU_APP_DATA_RESERVED 0x0000 /**< Size of Application Data that must be preserved between application updates. This value must be a multiple of page size. Page size is 0x400 (1024d) bytes, thus this value must be 0x0000, 0x0400, 0x0800, 0x0C00, 0x1000, etc. */
+#define DFU_IMAGE_MAX_SIZE_FULL (DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED) /**< Maximum size of a application, excluding save data from the application. */
+
+#define DFU_IMAGE_MAX_SIZE_BANKED (((((DFU_REGION_TOTAL_SIZE)/2) - DFU_APP_DATA_RESERVED) / CODE_PAGE_SIZE) * CODE_PAGE_SIZE) /**< Maximum size of a application in dual bank mode, excluding save data from the application. */
+
+#define DFU_BL_IMAGE_MAX_SIZE (BOOTLOADER_SETTINGS_ADDRESS - BOOTLOADER_REGION_START) /**< Maximum size of a bootloader, excluding save data from the current bootloader. */
+
+#define DFU_BANK_0_REGION_START CODE_REGION_1_START /**< Bank 0 region start. */
+#define DFU_BANK_1_REGION_START (DFU_BANK_0_REGION_START + DFU_IMAGE_MAX_SIZE_BANKED) /**< Bank 1 region start. */
+
+#define PACKET_SIZE 512 /**< Size of each data packet. Also used for initial receiving of packets from transport layer. */
+#define PACKET_HEADER_SIZE sizeof(uint32_t) /**< Size of the data packet header. */
+
+#define EMPTY_FLASH_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */
+
+#define INVALID_PACKET 0x00 /**< Invalid packet identifies. */
+#define INIT_PACKET 0x01 /**< Packet identifies for initialization packet. */
+#define START_PACKET 0x02 /**< Packet identifies for the Data Start Packet. */
+#define DATA_PACKET 0x03 /**< Packet identifies for a Data Packet. */
+#define STOP_DATA_PACKET 0x04 /**< Packet identifies for the Data Stop Packet. */
+
+
+// Safe guard to ensure during compile time that the DFU_APP_DATA_RESERVED is a multiple of page size.
+STATIC_ASSERT((((DFU_APP_DATA_RESERVED) & (CODE_PAGE_SIZE - 1)) == 0x00));
+
+typedef enum
+{
+ DFU_UPDATE_NONE = 0x00, /**< Bit field indicating no update is ongoing. */
+ DFU_UPDATE_SD = 0x01, /**< Bit field indicating update of SoftDevice is ongoing. */
+ DFU_UPDATE_BL = 0x02, /**< Bit field indicating update of bootloader is ongoing. */
+ DFU_UPDATE_APP = 0x04 /**< Bit field indicating update of application is ongoing. */
+} dfu_update_mode_t;
+
+
+/**@brief Structure holding a bootloader packet received on the UART.
+ */
+typedef struct
+{
+ uint32_t total_image_size;
+} dfu_init_packet_t;
+
+typedef struct
+{
+ dfu_update_mode_t dfu_update_mode; /**< Packet type, used to identify the content of the received packet referenced by data packet. */
+ uint32_t sd_image_size; /** Size of the SoftDevice image to be transferred. Zero if no SoftDevice image will be transfered. */
+ uint32_t bl_image_size; /** Size of the Bootloader image to be transferred. Zero if no Bootloader image will be transfered. */
+ uint32_t app_image_size; /** Size of the application image to be transmitted. Zero if no Bootloader image will be transfered. */
+ uint32_t info_bytes_size;
+} dfu_start_packet_t;
+
+typedef struct
+{
+ uint32_t packet_length; /**< Packet length of the data packet. Each data is word size, meaning length of 4 is 4 words, not bytes. */
+ uint32_t * p_data_packet; /**< Data Packet received. Each data is a word size entry. */
+} dfu_data_packet_t;
+
+typedef struct
+{
+ uint32_t packet_type; /**< Packet type, used to identify the content of the received packet referenced by data packet. */
+ union {
+ dfu_init_packet_t init_packet;
+ dfu_data_packet_t data_packet; /**< Used when packet type is INIT_PACKET or DATA_PACKET. Packet contains data received for init or data. */
+ dfu_start_packet_t start_packet; /**< Used when packet type is START_DATA_PACKET. Will contain information on software to be updtaed, i.e. SoftDevice, Bootloader and/or Application along with image sizes. */
+ } params;
+} dfu_update_packet_t;
+
+/**@brief DFU status error codes.
+*/
+typedef enum
+{
+ DFU_UPDATE_NEW_IMAGES,
+ DFU_UPDATE_SD_SWAPPED,
+ DFU_UPDATE_BL_SWAPPED,
+ DFU_UPDATE_AP_SWAPPED,
+ DFU_UPDATE_AP_INVALIDATED,
+
+ DFU_BANK_0_ERASED, /**< Status bank 0 erased.*/
+ DFU_BANK_1_ERASED, /**< Status bank 1 erased.*/
+ DFU_TIMEOUT, /**< Status timeout.*/
+ DFU_RESET /**< Status Reset to indicate current update procedure has been aborted and system should reset. */
+} dfu_update_status_code_t;
+
+
+
+/**@brief Structure holding DFU complete event.
+*/
+typedef struct
+{
+ dfu_update_status_code_t status_code; /**< Device Firmware Update status. */
+ uint32_t sd_image_size; /**< Size of the recieved SoftDevice. */
+ uint32_t bl_image_size; /**< Size of the recieved BootLoader. */
+ uint32_t ap_image_size; /**< Size of the recieved Application. */
+ uint32_t src_image_address;
+ uint8_t bank_used; /**< Bank location */
+} dfu_update_status_t;
+
+/**@brief Update complete handler type. */
+typedef void (*dfu_complete_handler_t)(dfu_update_status_t dfu_update_status);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // DFU_TYPES_H__
+
+/**@} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/error_handler.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/error_handler.h
new file mode 100644
index 0000000..d3e32d3
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/examples/dfu/experimental/ant_bootloader/include/error_handler.h
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2013 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/** @file
+ *
+ * @defgroup app_error Common application error handler
+ * @{
+ * @ingroup app_common
+ *
+ * @brief Common application error handler and macros for utilizing a common error handler.
+ */
+
+#ifndef APP_ERROR_H__
+#define APP_ERROR_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "nrf_error.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Function for error handling, which is called when an error has occurred.
+ *
+ * @param[in] error_code Error code supplied to the handler.
+ * @param[in] line_num Line number where the handler is called.
+ * @param[in] p_file_name Pointer to the file name.
+ */
+void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name);
+
+/**@brief Macro for calling error handler function.
+ *
+ * @param[in] ERR_CODE Error code supplied to the error handler.
+ */
+#define APP_ERROR_HANDLER(ERR_CODE) app_error_handler((ERR_CODE), 0, NULL);
+
+/**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS.
+ *
+ * @param[in] ERR_CODE Error code supplied to the error handler.
+ */
+#define APP_ERROR_CHECK(ERR_CODE) app_error_handler((ERR_CODE), 0, NULL);
+
+/**@brief Macro for calling error handler function if supplied boolean value is false.
+ *
+ * @param[in] BOOLEAN_VALUE Boolean value to be evaluated.
+ */
+#define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE) \
+ do \
+ { \
+ const bool LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \
+ if (!LOCAL_BOOLEAN_VALUE) \
+ { \
+ APP_ERROR_HANDLER(0); \
+ } \
+ } while (0)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // APP_ERROR_H__
+
+/** @} */