[openthread] Update OpenThread

Update to Feb 14, 2024 version
Commit: 49c59ec519cc8b49dd58978d1bc80b7ae7ba88d0

Change-Id: Ibb33f1d34db8de4da4b3011172fff98570956c55
diff --git a/BUILD.gn b/BUILD.gn
index 1d2ff99..1fe9d6e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -28,7 +28,19 @@
 import("etc/gn/openthread.gni")
 
 config("openthread_config") {
-  defines = []
+  cflags = [
+    "-Wno-ambiguous-reversed-operator",
+    "-Wno-deprecated-copy",
+    "-Wno-implicit-fallthrough",
+    "-Wno-extra-semi",
+    "-Wno-unused-but-set-variable",
+  ]
+  defines = [
+    # Avoid sensitivity to __DATE__ and __TIME__ to keep the build
+    # deterministic, reproducible, and cache-friendly.
+    # Using openthread's git commit id would be acceptable as well.
+    "OPENTHREAD_BUILD_DATETIME=\"deterministic\"",
+  ]
   if (openthread_config_file != "") {
     defines += [ "OPENTHREAD_CONFIG_FILE=${openthread_config_file}" ]
   }
@@ -41,6 +53,25 @@
   ]
 }
 
+# TODO(fxbug.dev/42158209): Need to explore splitting with templates
+config("openthread_config_legacy_extensions") {
+  cflags = [
+    "-Wno-ambiguous-reversed-operator",
+    "-Wno-deprecated-copy",
+    "-Wno-implicit-fallthrough",
+    "-Wno-extra-semi",
+  ]
+  defines = []
+  defines += [ "OPENTHREAD_CONFIG_FILE=\"openthread-config-fuchsia-legacy-extensions.h\"" ]
+
+  include_dirs = openthread_project_include_dirs
+
+  include_dirs += [
+    "${root_gen_dir}/include",
+    "include",
+  ]
+}
+
 config("openthread_ftd_config") {
   defines = [
     "OPENTHREAD_FTD=1",
@@ -70,16 +101,32 @@
   deps = [ "src/core:libopenthread-ftd" ]
 }
 
+group("libopenthread-ftd-legacy-extensions") {
+  public_deps = [ "include/openthread:openthread_legacy_extensions" ]
+  deps = [ "src/core:libopenthread-ftd-legacy-extensions" ]
+}
+
+
 group("libopenthread-mtd") {
   public_deps = [ "include/openthread" ]
   deps = [ "src/core:libopenthread-mtd" ]
 }
 
+group("libopenthread-mtd-legacy-extensions") {
+  public_deps = [ "include/openthread:openthread_legacy_extensions" ]
+  deps = [ "src/core:libopenthread-mtd-legacy-extensions" ]
+}
+
 group("libopenthread-radio") {
   public_deps = [ "include/openthread" ]
   deps = [ "src/core:libopenthread-radio" ]
 }
 
+group("libopenthread-radio-legacy-extensions") {
+  public_deps = [ "include/openthread:openthread_legacy_extensions" ]
+  deps = [ "src/core:libopenthread-radio-legacy-extensions" ]
+}
+
 group("libopenthread-cli-ftd") {
   public_deps = [ "include/openthread" ]
   deps = [ "src/cli:libopenthread-cli-ftd" ]
@@ -90,22 +137,51 @@
   deps = [ "src/cli:libopenthread-cli-mtd" ]
 }
 
+group("libopenthread-cli-ftd-legacy-extensions") {
+  public_deps = [ "include/openthread:openthread_legacy_extensions" ]
+  deps = [ "src/cli:libopenthread-cli-ftd-legacy-extensions" ]
+}
+
+group("libopenthread-cli-mtd-legacy-extensions") {
+  public_deps = [ "include/openthread:openthread_legacy_extensions" ]
+  deps = [ "src/cli:libopenthread-cli-mtd-legacy-extensions" ]
+}
+
 group("libopenthread-spinel-ncp") {
   public_deps = [ "src/lib/spinel:spinel-api" ]
   deps = [ "src/lib/spinel:libopenthread-spinel-ncp" ]
 }
 
+group("libopenthread-spinel-ncp-legacy-extensions") {
+  public_deps = [ "src/lib/spinel:spinel-api" ]
+  deps = [ "src/lib/spinel:libopenthread-spinel-ncp-legacy-extensions" ]
+}
+
 group("libopenthread-spinel-rcp") {
   public_deps = [ "src/lib/spinel:spinel-api" ]
   deps = [ "src/lib/spinel:libopenthread-spinel-rcp" ]
 }
 
+group("libopenthread-spinel-rcp-legacy-extensions") {
+  public_deps = [ "src/lib/spinel:spinel-api" ]
+  deps = [ "src/lib/spinel:libopenthread-spinel-rcp-legacy-extensions" ]
+}
+
 if (current_os == "fuchsia") {
   group("lib-ot-core") {
     public_deps = [
-      ":libopenthread-ftd",
+      ":libopenthread-cli-ftd",
       "src/core:libopenthread-ftd",
+      "src/cli:libopenthread-cli-ftd",
       "src/ncp:libopenthread-ncp-ftd",
     ]
   }
+
+  group("lib-ot-core-legacy-extensions") {
+    public_deps = [
+      ":libopenthread-ftd-legacy-extensions",
+      "src/core:libopenthread-ftd-legacy-extensions",
+      "src/ncp:libopenthread-ncp-ftd-legacy-extensions",
+    ]
+  }
 }
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..4cad6b3
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,4 @@
+vaas@google.com
+jiamingw@google.com
+paragdixit@google.com
+rquattle@google.com
diff --git a/etc/gn/openthread.gni b/etc/gn/openthread.gni
index 277ee83..312225a 100644
--- a/etc/gn/openthread.gni
+++ b/etc/gn/openthread.gni
@@ -26,6 +26,9 @@
 #
 
 _openthread_config_file = ""
+if (current_os == "fuchsia") {
+  _openthread_config_file = "<openthread-config-fuchsia.h>"
+}
 
 declare_args() {
   # OpenThread config header.
@@ -67,7 +70,7 @@
 if (openthread_enable_core_config_args) {
   declare_args() {
     # Thread version: 1.1, 1.2
-    openthread_config_thread_version = ""
+    openthread_config_thread_version = "1.3"
 
     # Log output: none, debug_uart, app, platform
     openthread_config_log_output = ""
@@ -145,7 +148,7 @@
     openthread_config_mlr_enable = false
 
     # Enable external heap support
-    openthread_config_heap_external_enable = false
+    openthread_config_heap_external_enable = true
 
     # Enable ipv6 fragmentation support
     openthread_config_ip6_fragmentation_enable = false
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
deleted file mode 100644
index 928e58f..0000000
--- a/examples/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-add_subdirectory(platforms)
-
-if(OT_BUILD_EXECUTABLES)
-    add_subdirectory(apps)
-endif()
diff --git a/examples/apps/CMakeLists.txt b/examples/apps/CMakeLists.txt
deleted file mode 100644
index 03da6f0..0000000
--- a/examples/apps/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-if(OT_APP_CLI)
-    add_subdirectory(cli)
-endif()
-
-add_subdirectory(ncp)
diff --git a/examples/apps/cli/CMakeLists.txt b/examples/apps/cli/CMakeLists.txt
deleted file mode 100644
index d812512..0000000
--- a/examples/apps/cli/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-set(COMMON_INCLUDES
-    ${OT_PUBLIC_INCLUDES}
-    ${PROJECT_SOURCE_DIR}/examples/platforms
-    ${PROJECT_SOURCE_DIR}/src/core
-)
-
-if(OT_FTD)
-    include(ftd.cmake)
-endif()
-
-if(OT_MTD)
-    include(mtd.cmake)
-endif()
-
-if(OT_RCP)
-    include(radio.cmake)
-endif()
diff --git a/examples/apps/cli/README.md b/examples/apps/cli/README.md
deleted file mode 100644
index 6876722..0000000
--- a/examples/apps/cli/README.md
+++ /dev/null
@@ -1,124 +0,0 @@
-# OpenThread CLI Example
-
-This example application exposes OpenThread configuration and management APIs via a simple command-line interface. The steps below take you through the minimal steps required to ping one emulated Thread device from another emulated Thread device.
-
-## 1. Build
-
-```bash
-$ cd <path-to-openthread>
-$ ./script/cmake-build simulation
-```
-
-## 2. Start node 1
-
-Spawn the process:
-
-```bash
-$ cd <path-to-openthread>/build/simulation/examples/apps/cli
-$ ./ot-cli-ftd 1
-```
-
-Generate, view, and commit a new Active Operational Dataset:
-
-```bash
-> dataset init new
-Done
-> dataset
-Active Timestamp: 1
-Channel: 13
-Channel Mask: 0x07fff800
-Ext PAN ID: d63e8e3e495ebbc3
-Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
-Network Key: dfd34f0f05cad978ec4e32b0413038ff
-Network Name: OpenThread-8f28
-PAN ID: 0x8f28
-PSKc: c23a76e98f1a6483639b1ac1271e2e27
-Security Policy: 0, onrc
-Done
-> dataset commit active
-Done
-```
-
-Bring up the IPv6 interface:
-
-```bash
-> ifconfig up
-Done
-```
-
-Start Thread protocol operation:
-
-```bash
-> thread start
-Done
-```
-
-Wait a few seconds and verify that the device has become a Thread Leader:
-
-```bash
-> state
-leader
-Done
-```
-
-View IPv6 addresses assigned to Node 1's Thread interface:
-
-```bash
-> ipaddr
-fd3d:b50b:f96d:722d:0:ff:fe00:fc00
-fd3d:b50b:f96d:722d:0:ff:fe00:c00
-fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
-fe80:0:0:0:6c41:9001:f3d6:4148
-Done
-```
-
-## 2. Start node 2
-
-Spawn the process:
-
-```bash
-$ cd <path-to-openthread>/build/simulation/examples/apps/cli
-$ ./ot-cli-ftd 2
-```
-
-Configure Thread Network Key from Node 1's Active Operational Dataset:
-
-```bash
-> dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
-Done
-> dataset commit active
-Done
-```
-
-Bring up the IPv6 interface:
-
-```bash
-> ifconfig up
-Done
-```
-
-Start Thread protocol operation:
-
-```bash
-> thread start
-Done
-```
-
-Wait a few seconds and verify that the device has become a Thread Child or Router:
-
-```bash
-> state
-child
-Done
-```
-
-## 3. Ping Node 1 from Node 2
-
-```bash
-> ping fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
-16 bytes from fd3d:b50b:f96d:722d:558:f56b:d688:799: icmp_seq=1 hlim=64 time=24ms
-```
-
-## 4. Explore More
-
-See the [OpenThread CLI Reference README.md](../../../src/cli/README.md) to explore more.
diff --git a/examples/apps/cli/cli_uart.cpp b/examples/apps/cli/cli_uart.cpp
deleted file mode 100644
index 81f05f8..0000000
--- a/examples/apps/cli/cli_uart.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-#include "openthread-core-config.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <openthread-system.h>
-#include <openthread/cli.h>
-#include <openthread/logging.h>
-
-#include "cli/cli_config.h"
-#include "common/code_utils.hpp"
-#include "common/debug.hpp"
-#include "utils/uart.h"
-
-#if OPENTHREAD_POSIX
-#include <signal.h>
-#include <sys/types.h>
-#endif
-
-/**
- * @def OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
- *
- * The size of CLI UART RX buffer in bytes.
- *
- */
-#ifndef OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
-#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
-#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 640
-#else
-#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 512
-#endif
-#endif
-
-/**
- * @def OPENTHREAD_CONFIG_CLI_TX_BUFFER_SIZE
- *
- * The size of CLI message buffer in bytes.
- *
- */
-#ifndef OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE
-#define OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE 1024
-#endif
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-#if OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE > OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE
-#error "diag output buffer should be smaller than CLI UART tx buffer"
-#endif
-#if OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE > OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
-#error "diag command line should be smaller than CLI UART rx buffer"
-#endif
-#endif
-
-#if OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH > OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
-#error "command line should be should be smaller than CLI rx buffer"
-#endif
-
-enum
-{
-    kRxBufferSize = OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE,
-    kTxBufferSize = OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE,
-};
-
-char     sRxBuffer[kRxBufferSize];
-uint16_t sRxLength;
-
-char     sTxBuffer[kTxBufferSize];
-uint16_t sTxHead;
-uint16_t sTxLength;
-
-uint16_t sSendLength;
-
-#ifdef OT_CLI_UART_LOCK_HDR_FILE
-
-#include OT_CLI_UART_LOCK_HDR_FILE
-
-#else
-
-/**
- * Macro to acquire an exclusive lock of uart cli output
- * Default implementation does nothing
- *
- */
-#ifndef OT_CLI_UART_OUTPUT_LOCK
-#define OT_CLI_UART_OUTPUT_LOCK() \
-    do                            \
-    {                             \
-    } while (0)
-#endif
-
-/**
- * Macro to release the exclusive lock of uart cli output
- * Default implementation does nothing
- *
- */
-#ifndef OT_CLI_UART_OUTPUT_UNLOCK
-#define OT_CLI_UART_OUTPUT_UNLOCK() \
-    do                              \
-    {                               \
-    } while (0)
-#endif
-
-#endif // OT_CLI_UART_LOCK_HDR_FILE
-
-static int     Output(const char *aBuf, uint16_t aBufLength);
-static otError ProcessCommand(void);
-
-static void ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
-{
-    static const char sEraseString[] = {'\b', ' ', '\b'};
-    static const char CRNL[]         = {'\r', '\n'};
-    static uint8_t    sLastChar      = '\0';
-    const uint8_t    *end;
-
-    end = aBuf + aBufLength;
-
-    for (; aBuf < end; aBuf++)
-    {
-        switch (*aBuf)
-        {
-        case '\n':
-            if (sLastChar == '\r')
-            {
-                break;
-            }
-
-            OT_FALL_THROUGH;
-
-        case '\r':
-            Output(CRNL, sizeof(CRNL));
-            sRxBuffer[sRxLength] = '\0';
-            IgnoreError(ProcessCommand());
-            break;
-
-#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
-        case 0x03: // ASCII for Ctrl-C
-            kill(0, SIGINT);
-            break;
-
-        case 0x04: // ASCII for Ctrl-D
-            exit(EXIT_SUCCESS);
-            break;
-#endif
-
-        case '\b':
-        case 127:
-            if (sRxLength > 0)
-            {
-                Output(sEraseString, sizeof(sEraseString));
-                sRxBuffer[--sRxLength] = '\0';
-            }
-
-            break;
-
-        default:
-            if (sRxLength < kRxBufferSize - 1)
-            {
-                Output(reinterpret_cast<const char *>(aBuf), 1);
-                sRxBuffer[sRxLength++] = static_cast<char>(*aBuf);
-            }
-
-            break;
-        }
-
-        sLastChar = *aBuf;
-    }
-}
-
-static otError ProcessCommand(void)
-{
-    otError error = OT_ERROR_NONE;
-
-    while (sRxLength > 0 && (sRxBuffer[sRxLength - 1] == '\n' || sRxBuffer[sRxLength - 1] == '\r'))
-    {
-        sRxBuffer[--sRxLength] = '\0';
-    }
-
-    otCliInputLine(sRxBuffer);
-    sRxLength = 0;
-
-    return error;
-}
-
-static void Send(void)
-{
-    VerifyOrExit(sSendLength == 0);
-
-    if (sTxLength > kTxBufferSize - sTxHead)
-    {
-        sSendLength = kTxBufferSize - sTxHead;
-    }
-    else
-    {
-        sSendLength = sTxLength;
-    }
-
-    if (sSendLength > 0)
-    {
-#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
-        /* duplicate the output to the debug uart */
-        otSysDebugUart_write_bytes(reinterpret_cast<uint8_t *>(sTxBuffer + sTxHead), sSendLength);
-#endif
-        IgnoreError(otPlatUartSend(reinterpret_cast<uint8_t *>(sTxBuffer + sTxHead), sSendLength));
-    }
-
-exit:
-    return;
-}
-
-static void SendDoneTask(void)
-{
-    sTxHead = (sTxHead + sSendLength) % kTxBufferSize;
-    sTxLength -= sSendLength;
-    sSendLength = 0;
-
-    Send();
-}
-
-static int Output(const char *aBuf, uint16_t aBufLength)
-{
-    OT_CLI_UART_OUTPUT_LOCK();
-    uint16_t sent = 0;
-
-    while (aBufLength > 0)
-    {
-        uint16_t remaining = kTxBufferSize - sTxLength;
-        uint16_t tail;
-        uint16_t sendLength = aBufLength;
-
-        if (sendLength > remaining)
-        {
-            sendLength = remaining;
-        }
-
-        for (uint16_t i = 0; i < sendLength; i++)
-        {
-            tail            = (sTxHead + sTxLength) % kTxBufferSize;
-            sTxBuffer[tail] = *aBuf++;
-            aBufLength--;
-            sTxLength++;
-        }
-
-        Send();
-
-        sent += sendLength;
-
-        if (aBufLength > 0)
-        {
-            // More to send, so flush what's waiting now
-            otError err = otPlatUartFlush();
-
-            if (err == OT_ERROR_NONE)
-            {
-                // Flush successful, reset the pointers
-                SendDoneTask();
-            }
-            else
-            {
-                // Flush did not succeed, so abort here.
-                break;
-            }
-        }
-    }
-
-    OT_CLI_UART_OUTPUT_UNLOCK();
-
-    return sent;
-}
-
-static int CliUartOutput(void *aContext, const char *aFormat, va_list aArguments)
-{
-    OT_UNUSED_VARIABLE(aContext);
-
-    int rval;
-
-    if (sTxLength == 0)
-    {
-        rval = vsnprintf(sTxBuffer, kTxBufferSize, aFormat, aArguments);
-        VerifyOrExit(rval >= 0 && rval < kTxBufferSize, otLogWarnPlat("Failed to format CLI output `%s`", aFormat));
-        sTxHead     = 0;
-        sTxLength   = static_cast<uint16_t>(rval);
-        sSendLength = 0;
-    }
-    else
-    {
-        va_list  retryArguments;
-        uint16_t tail      = (sTxHead + sTxLength) % kTxBufferSize;
-        uint16_t remaining = (sTxHead > tail ? (sTxHead - tail) : (kTxBufferSize - tail));
-
-        va_copy(retryArguments, aArguments);
-
-        rval = vsnprintf(&sTxBuffer[tail], remaining, aFormat, aArguments);
-
-        if (rval < 0)
-        {
-            otLogWarnPlat("Failed to format CLI output `%s`", aFormat);
-        }
-        else if (rval < remaining)
-        {
-            sTxLength += rval;
-        }
-        else if (rval < kTxBufferSize)
-        {
-            while (sTxLength != 0)
-            {
-                otError error;
-
-                Send();
-
-                error = otPlatUartFlush();
-
-                if (error == OT_ERROR_NONE)
-                {
-                    // Flush successful, reset the pointers
-                    SendDoneTask();
-                }
-                else
-                {
-                    // Flush did not succeed, so abandon buffered output.
-                    otLogWarnPlat("Failed to output CLI: %s", otThreadErrorToString(error));
-                    break;
-                }
-            }
-            rval = vsnprintf(sTxBuffer, kTxBufferSize, aFormat, retryArguments);
-            OT_ASSERT(rval > 0);
-            sTxLength   = static_cast<uint16_t>(rval);
-            sTxHead     = 0;
-            sSendLength = 0;
-        }
-        else
-        {
-            otLogWarnPlat("CLI output `%s` truncated", aFormat);
-        }
-
-        va_end(retryArguments);
-    }
-
-    Send();
-
-exit:
-    return rval;
-}
-
-void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) { ReceiveTask(aBuf, aBufLength); }
-
-void otPlatUartSendDone(void) { SendDoneTask(); }
-
-extern "C" void otAppCliInit(otInstance *aInstance)
-{
-    sRxLength   = 0;
-    sTxHead     = 0;
-    sTxLength   = 0;
-    sSendLength = 0;
-
-    IgnoreError(otPlatUartEnable());
-
-    otCliInit(aInstance, CliUartOutput, aInstance);
-}
diff --git a/examples/apps/cli/ftd.cmake b/examples/apps/cli/ftd.cmake
deleted file mode 100644
index 9ed9be1..0000000
--- a/examples/apps/cli/ftd.cmake
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-add_executable(ot-cli-ftd
-    cli_uart.cpp
-    main.c
-)
-
-target_include_directories(ot-cli-ftd PRIVATE ${COMMON_INCLUDES})
-
-if(NOT DEFINED OT_PLATFORM_LIB_FTD)
-    set(OT_PLATFORM_LIB_FTD ${OT_PLATFORM_LIB})
-endif()
-
-target_link_libraries(ot-cli-ftd PRIVATE
-    openthread-cli-ftd
-    ${OT_PLATFORM_LIB_FTD}
-    openthread-ftd
-    ${OT_PLATFORM_LIB_FTD}
-    openthread-cli-ftd
-    ${OT_MBEDTLS}
-    ot-config-ftd
-    ot-config
-)
-
-if(OT_LINKER_MAP)
-    if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
-        target_link_libraries(ot-cli-ftd PRIVATE -Wl,-map,ot-cli-ftd.map)
-    else()
-        target_link_libraries(ot-cli-ftd PRIVATE -Wl,-Map=ot-cli-ftd.map)
-    endif()
-endif()
-
-install(TARGETS ot-cli-ftd
-    DESTINATION bin)
diff --git a/examples/apps/cli/main.c b/examples/apps/cli/main.c
deleted file mode 100644
index 62f7e3f..0000000
--- a/examples/apps/cli/main.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include <assert.h>
-#ifdef __linux__
-#include <signal.h>
-#include <sys/prctl.h>
-#endif
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <openthread/cli.h>
-#include <openthread/diag.h>
-#include <openthread/tasklet.h>
-#include <openthread/platform/logging.h>
-
-#include "openthread-system.h"
-#include "cli/cli_config.h"
-#include "common/code_utils.hpp"
-
-#include "lib/platform/reset_util.h"
-
-/**
- * Initializes the CLI app.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-extern void otAppCliInit(otInstance *aInstance);
-
-#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
-OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); }
-
-OT_TOOL_WEAK void otPlatFree(void *aPtr) { free(aPtr); }
-#endif
-
-void otTaskletsSignalPending(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); }
-
-#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
-static otError ProcessExit(void *aContext, uint8_t aArgsLength, char *aArgs[])
-{
-    OT_UNUSED_VARIABLE(aContext);
-    OT_UNUSED_VARIABLE(aArgsLength);
-    OT_UNUSED_VARIABLE(aArgs);
-
-    exit(EXIT_SUCCESS);
-}
-
-#if OPENTHREAD_EXAMPLES_SIMULATION
-extern otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[]);
-#endif
-
-static const otCliCommand kCommands[] = {
-    {"exit", ProcessExit},
-#if OPENTHREAD_EXAMPLES_SIMULATION
-    /*
-     * The CLI command `nodeidfilter` only works for simulation in real time.
-     *
-     * It can be used either as an allow list or a deny list. Once the filter is cleared, the first `nodeidfilter allow`
-     * or `nodeidfilter deny` will determine whether it is set up as an allow or deny list. Subsequent calls should
-     * use the same sub-command to add new node IDs, e.g., if we first call `nodeidfilter allow` (which sets the filter
-     * up  as an allow list), a subsequent `nodeidfilter deny` will result in `InvalidState` error.
-     *
-     * The usage of the command `nodeidfilter`:
-     *     - `nodeidfilter deny <nodeid>` :  It denies the connection to a specified node (use as deny-list).
-     *     - `nodeidfilter allow <nodeid> :  It allows the connection to a specified node (use as allow-list).
-     *     - `nodeidfilter clear`         :  It restores the filter state to default.
-     *     - `nodeidfilter`               :  Outputs filter mode (allow-list or deny-list) and filtered node IDs.
-     */
-    {"nodeidfilter", ProcessNodeIdFilter},
-#endif
-};
-#endif // OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
-
-int main(int argc, char *argv[])
-{
-    otInstance *instance;
-
-#ifdef __linux__
-    // Ensure we terminate this process if the
-    // parent process dies.
-    prctl(PR_SET_PDEATHSIG, SIGHUP);
-#endif
-
-    OT_SETUP_RESET_JUMP(argv);
-
-#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
-    size_t   otInstanceBufferLength = 0;
-    uint8_t *otInstanceBuffer       = NULL;
-#endif
-
-pseudo_reset:
-
-    otSysInit(argc, argv);
-
-#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
-    // Call to query the buffer size
-    (void)otInstanceInit(NULL, &otInstanceBufferLength);
-
-    // Call to allocate the buffer
-    otInstanceBuffer = (uint8_t *)malloc(otInstanceBufferLength);
-    assert(otInstanceBuffer);
-
-    // Initialize OpenThread with the buffer
-    instance = otInstanceInit(otInstanceBuffer, &otInstanceBufferLength);
-#else
-    instance = otInstanceInitSingle();
-#endif
-    assert(instance);
-
-    otAppCliInit(instance);
-
-#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
-    IgnoreError(otCliSetUserCommands(kCommands, OT_ARRAY_LENGTH(kCommands), instance));
-#endif
-
-    while (!otSysPseudoResetWasRequested())
-    {
-        otTaskletsProcess(instance);
-        otSysProcessDrivers(instance);
-    }
-
-    otInstanceFinalize(instance);
-#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
-    free(otInstanceBuffer);
-#endif
-
-    goto pseudo_reset;
-
-    return 0;
-}
-
-#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
-void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    va_list ap;
-
-    va_start(ap, aFormat);
-    otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
-    va_end(ap);
-}
-#endif
diff --git a/examples/apps/cli/mtd.cmake b/examples/apps/cli/mtd.cmake
deleted file mode 100644
index 786f741..0000000
--- a/examples/apps/cli/mtd.cmake
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-add_executable(ot-cli-mtd
-    cli_uart.cpp
-    main.c
-)
-
-target_include_directories(ot-cli-mtd PRIVATE ${COMMON_INCLUDES})
-
-if(NOT DEFINED OT_PLATFORM_LIB_MTD)
-    set(OT_PLATFORM_LIB_MTD ${OT_PLATFORM_LIB})
-endif()
-
-target_link_libraries(ot-cli-mtd PRIVATE
-    openthread-cli-mtd
-    ${OT_PLATFORM_LIB_MTD}
-    openthread-mtd
-    ${OT_PLATFORM_LIB_MTD}
-    openthread-cli-mtd
-    ${OT_MBEDTLS}
-    ot-config-mtd
-    ot-config
-)
-
-if(OT_LINKER_MAP)
-    if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
-        target_link_libraries(ot-cli-mtd PRIVATE -Wl,-map,ot-cli-mtd.map)
-    else()
-        target_link_libraries(ot-cli-mtd PRIVATE -Wl,-Map=ot-cli-mtd.map)
-    endif()
-endif()
-
-install(TARGETS ot-cli-mtd
-    DESTINATION bin)
diff --git a/examples/apps/cli/radio.cmake b/examples/apps/cli/radio.cmake
deleted file mode 100644
index b2fe5d9..0000000
--- a/examples/apps/cli/radio.cmake
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-#  Copyright (c) 2021, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-add_executable(ot-cli-radio
-    cli_uart.cpp
-    main.c
-)
-
-target_include_directories(ot-cli-radio PRIVATE ${COMMON_INCLUDES})
-
-if(NOT DEFINED OT_PLATFORM_LIB_RCP)
-    set(OT_PLATFORM_LIB_RCP ${OT_PLATFORM_LIB})
-endif()
-
-if(NOT DEFINED OT_MBEDTLS_RCP)
-    set(OT_MBEDTLS_RCP ${OT_MBEDTLS})
-endif()
-
-target_link_libraries(ot-cli-radio PRIVATE
-    openthread-cli-radio
-    ${OT_PLATFORM_LIB_RCP}
-    openthread-radio-cli
-    ${OT_PLATFORM_LIB_RCP}
-    openthread-cli-radio
-    ${OT_MBEDTLS_RCP}
-    ot-config-radio
-    ot-config
-)
-
-if(OT_LINKER_MAP)
-    if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
-        target_link_libraries(ot-cli-radio PRIVATE -Wl,-map,ot-cli-radio.map)
-    else()
-        target_link_libraries(ot-cli-radio PRIVATE -Wl,-Map=ot-cli-radio.map)
-    endif()
-endif()
-
-install(TARGETS ot-cli-radio
-    DESTINATION bin
-)
diff --git a/examples/apps/ncp/CMakeLists.txt b/examples/apps/ncp/CMakeLists.txt
deleted file mode 100644
index 5fce737..0000000
--- a/examples/apps/ncp/CMakeLists.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-set(COMMON_INCLUDES
-    ${OT_PUBLIC_INCLUDES}
-    ${PROJECT_SOURCE_DIR}/examples/platforms
-    ${PROJECT_SOURCE_DIR}/src/core
-)
-
-if(OT_APP_NCP)
-    if(OT_FTD)
-        include(ftd.cmake)
-    endif()
-    if(OT_MTD)
-        include(mtd.cmake)
-    endif()
-endif()
-
-if(OT_APP_RCP)
-    if(OT_RCP)
-        include(rcp.cmake)
-    else()
-        message(FATAL_ERROR "OT_RCP is not enabled")
-    endif()
-endif()
diff --git a/examples/apps/ncp/ftd.cmake b/examples/apps/ncp/ftd.cmake
deleted file mode 100644
index a7ffa51..0000000
--- a/examples/apps/ncp/ftd.cmake
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-add_executable(ot-ncp-ftd
-    main.c
-    ncp.c
-)
-
-target_include_directories(ot-ncp-ftd PRIVATE ${COMMON_INCLUDES})
-
-if(NOT DEFINED OT_PLATFORM_LIB_FTD)
-    set(OT_PLATFORM_LIB_FTD ${OT_PLATFORM_LIB})
-endif()
-
-target_link_libraries(ot-ncp-ftd PRIVATE
-    openthread-ncp-ftd
-    ${OT_PLATFORM_LIB_FTD}
-    openthread-ftd
-    ${OT_PLATFORM_LIB_FTD}
-    openthread-ncp-ftd
-    ${OT_MBEDTLS}
-    ot-config-ftd
-    ot-config
-)
-
-if(OT_LINKER_MAP)
-    if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
-        target_link_libraries(ot-ncp-ftd PRIVATE -Wl,-map,ot-ncp-ftd.map)
-    else()
-        target_link_libraries(ot-ncp-ftd PRIVATE -Wl,-Map=ot-ncp-ftd.map)
-    endif()
-endif()
-
-install(TARGETS ot-ncp-ftd DESTINATION bin)
diff --git a/examples/apps/ncp/main.c b/examples/apps/ncp/main.c
deleted file mode 100644
index 5f59261..0000000
--- a/examples/apps/ncp/main.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include <assert.h>
-#ifdef __linux__
-#include <signal.h>
-#include <sys/prctl.h>
-#endif
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <openthread/diag.h>
-#include <openthread/ncp.h>
-#include <openthread/tasklet.h>
-
-#include "openthread-system.h"
-
-#include "lib/platform/reset_util.h"
-
-#if OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
-#if OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE == 0
-#error "Support for multiple OpenThread static instance is disabled."
-#endif
-#define ENDPOINT_CT OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_NUM
-#else
-#define ENDPOINT_CT 1
-#endif /* OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE */
-
-/**
- * Initializes the NCP app.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-extern void otAppNcpInit(otInstance *aInstance);
-extern void otAppNcpInitMulti(otInstance **aInstances, uint8_t count);
-
-#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
-OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); }
-
-OT_TOOL_WEAK void otPlatFree(void *aPtr) { free(aPtr); }
-#endif
-
-void otTaskletsSignalPending(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); }
-
-int main(int argc, char *argv[])
-{
-    otInstance *instance;
-
-    OT_SETUP_RESET_JUMP(argv);
-
-#ifdef __linux__
-    // Ensure we terminate this process if the
-    // parent process dies.
-    prctl(PR_SET_PDEATHSIG, SIGHUP);
-#endif
-
-#if OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
-    otInstance *instances[ENDPOINT_CT] = {NULL};
-#elif OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
-    size_t   otInstanceBufferLength = 0;
-    uint8_t *otInstanceBuffer       = NULL;
-#endif
-
-pseudo_reset:
-
-    otSysInit(argc, argv);
-
-#if OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
-    for (int i = 0; i < ENDPOINT_CT; i++)
-    {
-        instances[i] = otInstanceInitMultiple(i);
-
-        assert(instances[i]);
-    }
-    instance = instances[0];
-#elif OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
-
-    // Call to query the buffer size
-    (void)otInstanceInit(NULL, &otInstanceBufferLength);
-
-    // Call to allocate the buffer
-    otInstanceBuffer = (uint8_t *)malloc(otInstanceBufferLength);
-    assert(otInstanceBuffer);
-
-    // Initialize OpenThread with the buffer
-    instance = otInstanceInit(otInstanceBuffer, &otInstanceBufferLength);
-#else
-    instance = otInstanceInitSingle();
-#endif
-    assert(instance);
-
-#if OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
-    otAppNcpInitMulti(instances, ENDPOINT_CT);
-#else
-    otAppNcpInit(instance);
-#endif
-
-    while (!otSysPseudoResetWasRequested())
-    {
-        otTaskletsProcess(instance);
-        otSysProcessDrivers(instance);
-    }
-
-    otInstanceFinalize(instance);
-#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE && !OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
-    free(otInstanceBuffer);
-#endif
-
-    goto pseudo_reset;
-
-    return 0;
-}
diff --git a/examples/apps/ncp/mtd.cmake b/examples/apps/ncp/mtd.cmake
deleted file mode 100644
index 2fecbac..0000000
--- a/examples/apps/ncp/mtd.cmake
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-add_executable(ot-ncp-mtd
-    main.c
-    ncp.c
-)
-
-target_include_directories(ot-ncp-mtd PRIVATE ${COMMON_INCLUDES})
-
-if(NOT DEFINED OT_PLATFORM_LIB_MTD)
-    set(OT_PLATFORM_LIB_MTD ${OT_PLATFORM_LIB})
-endif()
-
-target_link_libraries(ot-ncp-mtd PRIVATE
-    openthread-ncp-mtd
-    ${OT_PLATFORM_LIB_MTD}
-    openthread-mtd
-    ${OT_PLATFORM_LIB_MTD}
-    openthread-ncp-mtd
-    ${OT_MBEDTLS}
-    ot-config-mtd
-    ot-config
-)
-
-if(OT_LINKER_MAP)
-    if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
-        target_link_libraries(ot-ncp-mtd PRIVATE -Wl,-map,ot-ncp-mtd.map)
-    else()
-        target_link_libraries(ot-ncp-mtd PRIVATE -Wl,-Map=ot-ncp-mtd.map)
-    endif()
-endif()
-
-install(TARGETS ot-ncp-mtd DESTINATION bin)
diff --git a/examples/apps/ncp/ncp.c b/examples/apps/ncp/ncp.c
deleted file mode 100644
index 38c95b4..0000000
--- a/examples/apps/ncp/ncp.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  Copyright (c) 2021, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "openthread-core-config.h"
-
-#include <openthread/ncp.h>
-
-#include "common/code_utils.hpp"
-
-#include "ncp/ncp_config.h"
-
-#if !OPENTHREAD_CONFIG_NCP_SPI_ENABLE
-#include "utils/uart.h"
-
-void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength) { otNcpHdlcReceive(aBuf, aBufLength); }
-
-void otPlatUartSendDone(void) { otNcpHdlcSendDone(); }
-#endif
-
-#if !OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
-#if !OPENTHREAD_CONFIG_NCP_SPI_ENABLE
-static int NcpSend(const uint8_t *aBuf, uint16_t aBufLength)
-{
-    IgnoreError(otPlatUartSend(aBuf, aBufLength));
-    return aBufLength;
-}
-#endif
-
-void otAppNcpInit(otInstance *aInstance)
-{
-#if OPENTHREAD_CONFIG_NCP_SPI_ENABLE
-    otNcpSpiInit(aInstance);
-#else
-    IgnoreError(otPlatUartEnable());
-
-    otNcpHdlcInit(aInstance, NcpSend);
-#endif
-}
-
-#if OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
-void otAppNcpInitMulti(otInstance **aInstances, uint8_t aCount)
-{
-#if OPENTHREAD_CONFIG_NCP_SPI_ENABLE
-#error Multipan support not implemented for SPI
-#else
-    IgnoreError(otPlatUartEnable());
-
-    otNcpHdlcInitMulti(aInstances, aCount, NcpSend);
-#endif
-}
-#endif
-#endif // !OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
diff --git a/examples/apps/ncp/rcp.cmake b/examples/apps/ncp/rcp.cmake
deleted file mode 100644
index 0f8be33..0000000
--- a/examples/apps/ncp/rcp.cmake
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-add_executable(ot-rcp
-    main.c
-    ncp.c
-)
-
-target_include_directories(ot-rcp PRIVATE ${COMMON_INCLUDES})
-
-if(NOT DEFINED OT_PLATFORM_LIB_RCP)
-    set(OT_PLATFORM_LIB_RCP ${OT_PLATFORM_LIB})
-endif()
-
-target_link_libraries(ot-rcp PRIVATE
-    openthread-rcp
-    ${OT_PLATFORM_LIB_RCP}
-    openthread-radio
-    ${OT_PLATFORM_LIB_RCP}
-    openthread-rcp
-    ot-config-radio
-    ot-config
-)
-
-if(OT_LINKER_MAP)
-    if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
-        target_link_libraries(ot-rcp PRIVATE -Wl,-map,ot-rcp.map)
-    else()
-        target_link_libraries(ot-rcp PRIVATE -Wl,-Map=ot-rcp.map)
-    endif()
-endif()
-
-install(TARGETS ot-rcp DESTINATION bin)
diff --git a/examples/platforms/CMakeLists.txt b/examples/platforms/CMakeLists.txt
deleted file mode 100644
index c384bb1..0000000
--- a/examples/platforms/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-add_subdirectory(utils)
diff --git a/examples/platforms/openthread-system.h b/examples/platforms/openthread-system.h
deleted file mode 100644
index 90503ec..0000000
--- a/examples/platforms/openthread-system.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- * @brief
- *   This file defines the platform-specific functions needed by OpenThread's example applications.
- */
-
-#ifndef OPENTHREAD_SYSTEM_H_
-#define OPENTHREAD_SYSTEM_H_
-
-#include <openthread/instance.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Performs all platform-specific initialization of OpenThread's drivers.
- *
- * @note This function is not called by the OpenThread library. Instead, the system/RTOS should call this function
- *       when initialization of OpenThread's drivers is most appropriate.
- *
- * @param[in]  argc  Number of arguments in @p argv.
- * @param[in]  argv  Argument vector.
- *
- */
-void otSysInit(int argc, char *argv[]);
-
-/**
- * Performs all platform-specific deinitialization for OpenThread's drivers.
- *
- * @note This function is not called by the OpenThread library. Instead, the system/RTOS should call this function
- *       when deinitialization of OpenThread's drivers is most appropriate.
- *
- */
-void otSysDeinit(void);
-
-/**
- * Returns true if a pseudo-reset was requested.
- *
- * In such a case, the main loop should shut down and re-initialize the OpenThread instance.
- *
- * @note This function is not called by the OpenThread library. Instead, the system/RTOS should call this function
- *       in the main loop to determine when to shut down and re-initialize the OpenThread instance.
- *
- */
-bool otSysPseudoResetWasRequested(void);
-
-/**
- * Performs all platform-specific processing for OpenThread's example applications.
- *
- * @note This function is not called by the OpenThread library. Instead, the system/RTOS should call this function
- *       in the main loop when processing OpenThread's drivers is most appropriate.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void otSysProcessDrivers(otInstance *aInstance);
-
-/**
- * Is called whenever platform drivers needs processing.
- *
- * @note This function is not handled by the OpenThread library. Instead, the system/RTOS should handle this function
- *       and schedule a call to `otSysProcessDrivers()`.
- *
- */
-extern void otSysEventSignalPending(void);
-
-#ifdef __cplusplus
-} // end of extern "C"
-#endif
-
-#endif // OPENTHREAD_SYSTEM_H_
diff --git a/examples/platforms/simulation/CMakeLists.txt b/examples/platforms/simulation/CMakeLists.txt
deleted file mode 100644
index 41a1dbf..0000000
--- a/examples/platforms/simulation/CMakeLists.txt
+++ /dev/null
@@ -1,112 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-set(OT_PLATFORM_LIB "openthread-simulation" PARENT_SCOPE)
-
-add_library(ot-simulation-config INTERFACE)
-
-option(OT_SIMULATION_VIRTUAL_TIME "enable virtual time")
-if(OT_SIMULATION_VIRTUAL_TIME)
-    target_compile_definitions(ot-simulation-config INTERFACE "OPENTHREAD_SIMULATION_VIRTUAL_TIME=1")
-endif()
-
-option(OT_SIMULATION_VIRTUAL_TIME_UART "enable virtual time for UART")
-if(OT_SIMULATION_VIRTUAL_TIME_UART)
-    target_compile_definitions(ot-simulation-config INTERFACE "OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART=1")
-endif()
-
-option(OT_SIMULATION_MAX_NETWORK_SIZE "set maximum network size (default: 33)")
-if(OT_SIMULATION_MAX_NETWORK_SIZE)
-    target_compile_definitions(ot-simulation-config INTERFACE "OPENTHREAD_SIMULATION_MAX_NETWORK_SIZE=${OT_SIMULATION_MAX_NETWORK_SIZE}")
-endif()
-
-if(NOT OT_PLATFORM_CONFIG)
-    set(OT_PLATFORM_CONFIG "openthread-core-simulation-config.h" PARENT_SCOPE)
-endif()
-
-list(APPEND OT_PLATFORM_DEFINES
-    "_BSD_SOURCE=1"
-    "_DEFAULT_SOURCE=1"
-    "OPENTHREAD_EXAMPLES_SIMULATION=1"
-    "OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1"
-)
-set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
-
-add_library(openthread-simulation
-    alarm.c
-    ble.c
-    crypto.c
-    diag.c
-    dns.c
-    dnssd.c
-    dso_transport.c
-    entropy.c
-    flash.c
-    infra_if.c
-    logging.c
-    misc.c
-    multipan.c
-    radio.c
-    spi-stubs.c
-    system.c
-    trel.c
-    uart.c
-    virtual_time/alarm-sim.c
-    virtual_time/platform-sim.c
-    $<TARGET_OBJECTS:openthread-platform-utils>
-)
-
-find_library(LIBRT rt)
-if(LIBRT)
-    target_link_libraries(openthread-simulation PRIVATE ${LIBRT})
-endif()
-
-target_link_libraries(openthread-simulation PRIVATE
-    openthread-platform
-    ot-simulation-config
-    ot-config
-)
-
-target_compile_options(openthread-simulation PRIVATE
-    ${OT_CFLAGS}
-)
-
-target_include_directories(openthread-simulation PRIVATE
-    ${OT_PUBLIC_INCLUDES}
-    ${PROJECT_SOURCE_DIR}/examples/platforms
-    ${PROJECT_SOURCE_DIR}/src
-    ${PROJECT_SOURCE_DIR}/src/core
-)
-
-if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
-    set(CPACK_PACKAGE_NAME "openthread-simulation")
-    set(CPACK_GENERATOR "DEB")
-    set(CPACK_DEBIAN_PACKAGE_MAINTAINER "OpenThread Authors (https://github.com/openthread/openthread)")
-    set(CPACK_PACKAGE_CONTACT "OpenThread Authors (https://github.com/openthread/openthread)")
-    include(CPack)
-endif()
diff --git a/examples/platforms/simulation/README.md b/examples/platforms/simulation/README.md
deleted file mode 100644
index ad60402..0000000
--- a/examples/platforms/simulation/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-# OpenThread Simulation on POSIX
-
-This directory contains example platform drivers for simulation on POSIX.
-
-## Build Examples
-
-```bash
-$ cd <path-to-openthread>
-$ mkdir build && cd build
-$ cmake -GNinja -DOT_PLATFORM=simulation ..
-$ ninja
-```
-
-After a successful build, the `elf` files are found in:
-
-- `<path-to-openthread>/build/examples/apps/cli`
-- `<path-to-openthread>/build/examples/apps/ncp`
-
-## Interact
-
-1. Spawn the process:
-
-```bash
-$ cd <path-to-openthread>/build/simulation/examples/apps/cli
-$ ./ot-cli-ftd 1
-```
-
-2. Type `help` for list of commands.
-
-```bash
-> help
-help
-channel
-childtimeout
-contextreusedelay
-extaddr
-extpanid
-ipaddr
-keysequence
-leaderweight
-mode
-netdata register
-networkidtimeout
-networkkey
-networkname
-panid
-ping
-prefix
-releaserouterid
-rloc16
-route
-routerupgradethreshold
-scan
-start
-state
-stop
-```
diff --git a/examples/platforms/simulation/alarm.c b/examples/platforms/simulation/alarm.c
deleted file mode 100644
index d826d11..0000000
--- a/examples/platforms/simulation/alarm.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "utils/code_utils.h"
-
-#ifdef __linux__
-#include <signal.h>
-#include <time.h>
-
-#ifndef OPENTHREAD_CONFIG_MICRO_TIMER_SIGNAL
-#define OPENTHREAD_CONFIG_MICRO_TIMER_SIGNAL SIGRTMIN
-#endif
-
-timer_t sMicroTimer;
-#endif // __linux__
-
-#include <openthread/logging.h>
-#include <openthread/platform/alarm-micro.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-
-#include "lib/platform/exit_code.h"
-
-#define MS_PER_S 1000
-#define NS_PER_US 1000
-#define US_PER_MS 1000
-#define US_PER_S 1000000
-
-#define DEFAULT_TIMEOUT_IN_SEC 10 // seconds
-
-#ifdef CLOCK_MONOTONIC_RAW
-#define OT_SIMULATION_CLOCK_ID CLOCK_MONOTONIC_RAW
-#else
-#define OT_SIMULATION_CLOCK_ID CLOCK_MONOTONIC
-#endif
-
-static bool     sIsMsRunning = false;
-static uint32_t sMsAlarm     = 0;
-
-static bool     sIsUsRunning = false;
-static uint32_t sUsAlarm     = 0;
-
-static uint32_t sSpeedUpFactor = 1;
-
-#ifdef __linux__
-static void microTimerHandler(int aSignal, siginfo_t *aSignalInfo, void *aUserContext)
-{
-    assert(aSignal == OPENTHREAD_CONFIG_MICRO_TIMER_SIGNAL);
-    assert(aSignalInfo->si_value.sival_ptr == &sMicroTimer);
-    (void)aSignal;
-    (void)aSignalInfo;
-    (void)aUserContext;
-}
-#endif
-
-static bool isExpired(uint32_t aTime, uint32_t aNow)
-{
-    // Determine whether or not `aTime` is before or same as `aNow`.
-
-    uint32_t diff = aNow - aTime;
-
-    return (diff & (1U << 31)) == 0;
-}
-
-static uint32_t calculateDuration(uint32_t aTime, uint32_t aNow)
-{
-    // Return the time duration from `aNow` to `aTime` if `aTimer` is
-    // after `aNow`, otherwise return zero.
-
-    return isExpired(aTime, aNow) ? 0 : aTime - aNow;
-}
-
-void platformAlarmInit(uint32_t aSpeedUpFactor)
-{
-    sSpeedUpFactor = aSpeedUpFactor;
-
-#ifdef __linux__
-    {
-        struct sigaction sa;
-
-        sa.sa_flags     = SA_SIGINFO;
-        sa.sa_sigaction = microTimerHandler;
-        sigemptyset(&sa.sa_mask);
-
-        if (sigaction(OPENTHREAD_CONFIG_MICRO_TIMER_SIGNAL, &sa, NULL) == -1)
-        {
-            perror("sigaction");
-            exit(EXIT_FAILURE);
-        }
-
-        struct sigevent sev;
-
-        sev.sigev_notify          = SIGEV_SIGNAL;
-        sev.sigev_signo           = OPENTHREAD_CONFIG_MICRO_TIMER_SIGNAL;
-        sev.sigev_value.sival_ptr = &sMicroTimer;
-
-        if (-1 == timer_create(CLOCK_MONOTONIC, &sev, &sMicroTimer))
-        {
-            perror("timer_create");
-            exit(EXIT_FAILURE);
-        }
-    }
-#endif
-}
-
-#if defined(CLOCK_MONOTONIC_RAW) || defined(CLOCK_MONOTONIC)
-uint64_t platformGetNow(void)
-{
-    struct timespec now;
-    int             err;
-
-    err = clock_gettime(OT_SIMULATION_CLOCK_ID, &now);
-
-    VerifyOrDie(err == 0, OT_EXIT_ERROR_ERRNO);
-
-    return (uint64_t)now.tv_sec * sSpeedUpFactor * US_PER_S + (uint64_t)now.tv_nsec * sSpeedUpFactor / NS_PER_US;
-}
-#else
-uint64_t platformGetNow(void)
-{
-    struct timeval tv;
-    int            err;
-
-    err = gettimeofday(&tv, NULL);
-
-    assert(err == 0);
-
-    return (uint64_t)tv.tv_sec * sSpeedUpFactor * US_PER_S + (uint64_t)tv.tv_usec * sSpeedUpFactor;
-}
-#endif // defined(CLOCK_MONOTONIC_RAW) || defined(CLOCK_MONOTONIC)
-
-uint32_t otPlatAlarmMilliGetNow(void) { return (uint32_t)(platformGetNow() / US_PER_MS); }
-
-void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sMsAlarm     = aT0 + aDt;
-    sIsMsRunning = true;
-}
-
-void otPlatAlarmMilliStop(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sIsMsRunning = false;
-}
-
-uint32_t otPlatAlarmMicroGetNow(void) { return (uint32_t)platformGetNow(); }
-
-void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sUsAlarm     = aT0 + aDt;
-    sIsUsRunning = true;
-
-#ifdef __linux__
-    {
-        struct itimerspec its;
-        uint32_t          diff = sUsAlarm - otPlatAlarmMicroGetNow();
-
-        its.it_value.tv_sec  = diff / US_PER_S;
-        its.it_value.tv_nsec = (diff % US_PER_S) * NS_PER_US;
-
-        its.it_interval.tv_sec  = 0;
-        its.it_interval.tv_nsec = 0;
-
-        if (-1 == timer_settime(sMicroTimer, 0, &its, NULL))
-        {
-            perror("otPlatAlarmMicroStartAt timer_settime()");
-            exit(EXIT_FAILURE);
-        }
-    }
-#endif // __linux__
-}
-
-void otPlatAlarmMicroStop(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sIsUsRunning = false;
-
-#ifdef __linux__
-    {
-        struct itimerspec its = {{0, 0}, {0, 0}};
-
-        if (-1 == timer_settime(sMicroTimer, 0, &its, NULL))
-        {
-            perror("otPlatAlarmMicroStop timer_settime()");
-            exit(EXIT_FAILURE);
-        }
-    }
-#endif // __linux__
-}
-
-void platformAlarmUpdateTimeout(struct timeval *aTimeout)
-{
-    uint64_t remaining = DEFAULT_TIMEOUT_IN_SEC * US_PER_S; // in usec.
-
-    assert(aTimeout != NULL);
-
-    if (sIsMsRunning)
-    {
-        uint32_t msRemaining = calculateDuration(sMsAlarm, otPlatAlarmMilliGetNow());
-
-        remaining = ((uint64_t)msRemaining) * US_PER_MS;
-    }
-
-    if (sIsUsRunning)
-    {
-        uint32_t usRemaining = calculateDuration(sUsAlarm, otPlatAlarmMicroGetNow());
-
-        if (usRemaining < remaining)
-        {
-            remaining = usRemaining;
-        }
-    }
-
-    if (remaining == 0)
-    {
-        aTimeout->tv_sec  = 0;
-        aTimeout->tv_usec = 0;
-    }
-    else
-    {
-        remaining /= sSpeedUpFactor;
-
-        if (remaining == 0)
-        {
-            remaining = 1;
-        }
-
-        aTimeout->tv_sec  = (time_t)(remaining / US_PER_S);
-        aTimeout->tv_usec = remaining % US_PER_S;
-    }
-}
-
-void platformAlarmProcess(otInstance *aInstance)
-{
-    if (sIsMsRunning && isExpired(sMsAlarm, otPlatAlarmMilliGetNow()))
-    {
-        sIsMsRunning = false;
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagAlarmFired(aInstance);
-        }
-        else
-#endif
-        {
-            otPlatAlarmMilliFired(aInstance);
-        }
-    }
-
-#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
-    if (sIsUsRunning && isExpired(sUsAlarm, otPlatAlarmMicroGetNow()))
-    {
-        sIsUsRunning = false;
-
-        otPlatAlarmMicroFired(aInstance);
-    }
-#endif
-}
-
-uint64_t otPlatTimeGet(void) { return platformGetNow(); }
-
-uint16_t otPlatTimeGetXtalAccuracy(void) { return 0; }
-
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
diff --git a/examples/platforms/simulation/crypto.c b/examples/platforms/simulation/crypto.c
deleted file mode 100644
index 20c151b..0000000
--- a/examples/platforms/simulation/crypto.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *  Copyright (c) 2021, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <openthread/config.h>
-#include <openthread/platform/crypto.h>
-
-#if OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
-
-// crypto key storage stubs
-
-otError otPlatCryptoImportKey(otCryptoKeyRef      *aKeyRef,
-                              otCryptoKeyType      aKeyType,
-                              otCryptoKeyAlgorithm aKeyAlgorithm,
-                              int                  aKeyUsage,
-                              otCryptoKeyStorage   aKeyPersistence,
-                              const uint8_t       *aKey,
-                              size_t               aKeyLen)
-{
-    OT_UNUSED_VARIABLE(aKeyRef);
-    OT_UNUSED_VARIABLE(aKeyType);
-    OT_UNUSED_VARIABLE(aKeyAlgorithm);
-    OT_UNUSED_VARIABLE(aKeyUsage);
-    OT_UNUSED_VARIABLE(aKeyPersistence);
-    OT_UNUSED_VARIABLE(aKey);
-    OT_UNUSED_VARIABLE(aKeyLen);
-
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen)
-{
-    OT_UNUSED_VARIABLE(aKeyRef);
-    OT_UNUSED_VARIABLE(aBuffer);
-    OT_UNUSED_VARIABLE(aBufferLen);
-    OT_UNUSED_VARIABLE(aKeyLen);
-
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-otError otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef)
-{
-    OT_UNUSED_VARIABLE(aKeyRef);
-
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-bool otPlatCryptoHasKey(otCryptoKeyRef aKeyRef)
-{
-    OT_UNUSED_VARIABLE(aKeyRef);
-
-    return false;
-}
-
-otError otPlatCryptoEcdsaGenerateAndImportKey(otCryptoKeyRef aKeyRef)
-{
-    OT_UNUSED_VARIABLE(aKeyRef);
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatCryptoEcdsaExportPublicKey(otCryptoKeyRef aKeyRef, otPlatCryptoEcdsaPublicKey *aPublicKey)
-{
-    OT_UNUSED_VARIABLE(aKeyRef);
-    OT_UNUSED_VARIABLE(aPublicKey);
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatCryptoEcdsaSignUsingKeyRef(otCryptoKeyRef                aKeyRef,
-                                         const otPlatCryptoSha256Hash *aHash,
-                                         otPlatCryptoEcdsaSignature   *aSignature)
-{
-    OT_UNUSED_VARIABLE(aKeyRef);
-    OT_UNUSED_VARIABLE(aHash);
-    OT_UNUSED_VARIABLE(aSignature);
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatCryptoEcdsaVerifyUsingKeyRef(otCryptoKeyRef                    aKeyRef,
-                                           const otPlatCryptoSha256Hash     *aHash,
-                                           const otPlatCryptoEcdsaSignature *aSignature)
-{
-    OT_UNUSED_VARIABLE(aKeyRef);
-    OT_UNUSED_VARIABLE(aHash);
-    OT_UNUSED_VARIABLE(aSignature);
-
-    return OT_ERROR_NONE;
-}
-
-#endif // OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
diff --git a/examples/platforms/simulation/diag.c b/examples/platforms/simulation/diag.c
deleted file mode 100644
index dcd9f1d..0000000
--- a/examples/platforms/simulation/diag.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include <openthread/config.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include <openthread/platform/radio.h>
-
-#include "utils/code_utils.h"
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-/**
- * Diagnostics mode variables.
- *
- */
-static bool sDiagMode = false;
-
-enum
-{
-    SIM_GPIO = 0,
-};
-
-static otGpioMode sGpioMode  = OT_GPIO_MODE_INPUT;
-static bool       sGpioValue = false;
-static uint8_t    sRawPowerSetting[OPENTHREAD_CONFIG_POWER_CALIBRATION_RAW_POWER_SETTING_SIZE];
-static uint16_t   sRawPowerSettingLength = 0;
-
-void otPlatDiagModeSet(bool aMode) { sDiagMode = aMode; }
-
-bool otPlatDiagModeGet(void) { return sDiagMode; }
-
-void otPlatDiagChannelSet(uint8_t aChannel) { OT_UNUSED_VARIABLE(aChannel); }
-
-void otPlatDiagTxPowerSet(int8_t aTxPower) { OT_UNUSED_VARIABLE(aTxPower); }
-
-void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aFrame);
-    OT_UNUSED_VARIABLE(aError);
-}
-
-void otPlatDiagAlarmCallback(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); }
-
-otError otPlatDiagGpioSet(uint32_t aGpio, bool aValue)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aGpio == SIM_GPIO, error = OT_ERROR_INVALID_ARGS);
-    sGpioValue = aValue;
-
-exit:
-    return error;
-}
-
-otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION((aGpio == SIM_GPIO) && (aValue != NULL), error = OT_ERROR_INVALID_ARGS);
-    *aValue = sGpioValue;
-
-exit:
-    return error;
-}
-
-otError otPlatDiagGpioSetMode(uint32_t aGpio, otGpioMode aMode)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aGpio == SIM_GPIO, error = OT_ERROR_INVALID_ARGS);
-    sGpioMode = aMode;
-
-exit:
-    return error;
-}
-
-otError otPlatDiagGpioGetMode(uint32_t aGpio, otGpioMode *aMode)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION((aGpio == SIM_GPIO) && (aMode != NULL), error = OT_ERROR_INVALID_ARGS);
-    *aMode = sGpioMode;
-
-exit:
-    return error;
-}
-
-otError otPlatDiagRadioSetRawPowerSetting(otInstance    *aInstance,
-                                          const uint8_t *aRawPowerSetting,
-                                          uint16_t       aRawPowerSettingLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION((aRawPowerSetting != NULL) && (aRawPowerSettingLength <= sizeof(sRawPowerSetting)),
-                    error = OT_ERROR_INVALID_ARGS);
-    memcpy(sRawPowerSetting, aRawPowerSetting, aRawPowerSettingLength);
-    sRawPowerSettingLength = aRawPowerSettingLength;
-
-exit:
-    return error;
-}
-
-otError otPlatDiagRadioGetRawPowerSetting(otInstance *aInstance,
-                                          uint8_t    *aRawPowerSetting,
-                                          uint16_t   *aRawPowerSettingLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION((aRawPowerSetting != NULL) && (aRawPowerSettingLength != NULL), error = OT_ERROR_INVALID_ARGS);
-    otEXPECT_ACTION((sRawPowerSettingLength != 0), error = OT_ERROR_NOT_FOUND);
-    otEXPECT_ACTION((sRawPowerSettingLength <= *aRawPowerSettingLength), error = OT_ERROR_INVALID_ARGS);
-
-    memcpy(aRawPowerSetting, sRawPowerSetting, sRawPowerSettingLength);
-    *aRawPowerSettingLength = sRawPowerSettingLength;
-
-exit:
-    return error;
-}
-
-otError otPlatDiagRadioRawPowerSettingEnable(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aEnable);
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatDiagRadioTransmitCarrier(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aEnable);
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatDiagRadioTransmitStream(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aEnable);
-
-    return OT_ERROR_NONE;
-}
-#endif // OPENTHREAD_CONFIG_DIAG_ENABLE
diff --git a/examples/platforms/simulation/entropy.c b/examples/platforms/simulation/entropy.c
deleted file mode 100644
index b567b0b..0000000
--- a/examples/platforms/simulation/entropy.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- *   This file implements an entropy source based on /dev/urandom or pseudo-random generator.
- *
- */
-
-#include "platform-simulation.h"
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <openthread/platform/entropy.h>
-
-#include "utils/code_utils.h"
-
-#ifndef __SANITIZE_ADDRESS__
-#define __SANITIZE_ADDRESS__ 0
-#endif
-
-#if __SANITIZE_ADDRESS__ != 0
-
-static uint32_t sState = 1;
-
-#endif // __SANITIZE_ADDRESS__
-
-void platformRandomInit(void)
-{
-#if __SANITIZE_ADDRESS__ != 0
-
-    // Multiplying gNodeId assures that no two nodes gets the same seed within an hour.
-    sState = (uint32_t)time(NULL) + (3600 * gNodeId);
-
-#endif // __SANITIZE_ADDRESS__
-}
-
-#if __SANITIZE_ADDRESS__ != 0
-
-static uint32_t randomUint32Get(void)
-{
-    uint32_t mlcg, p, q;
-    uint64_t tmpstate;
-
-    tmpstate = (uint64_t)33614 * (uint64_t)sState;
-    q        = tmpstate & 0xffffffff;
-    q        = q >> 1;
-    p        = tmpstate >> 32;
-    mlcg     = p + q;
-
-    if (mlcg & 0x80000000)
-    {
-        mlcg &= 0x7fffffff;
-        mlcg++;
-    }
-
-    sState = mlcg;
-
-    return mlcg;
-}
-
-#endif // __SANITIZE_ADDRESS__
-
-otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
-{
-    otError error = OT_ERROR_NONE;
-
-#if __SANITIZE_ADDRESS__ == 0
-
-    FILE  *file = NULL;
-    size_t readLength;
-
-    otEXPECT_ACTION(aOutput && aOutputLength, error = OT_ERROR_INVALID_ARGS);
-
-    file = fopen("/dev/urandom", "rb");
-    otEXPECT_ACTION(file != NULL, error = OT_ERROR_FAILED);
-
-    readLength = fread(aOutput, 1, aOutputLength, file);
-    otEXPECT_ACTION(readLength == aOutputLength, error = OT_ERROR_FAILED);
-
-exit:
-
-    if (file != NULL)
-    {
-        fclose(file);
-    }
-
-#else // __SANITIZE_ADDRESS__
-
-    /*
-     * THE IMPLEMENTATION BELOW IS NOT COMPLIANT WITH THE THREAD SPECIFICATION.
-     *
-     * Address Sanitizer triggers test failures when reading random
-     * values from /dev/urandom.  The pseudo-random number generator
-     * implementation below is only used to enable continuous
-     * integration checks with Address Sanitizer enabled.
-     */
-    otEXPECT_ACTION(aOutput && aOutputLength, error = OT_ERROR_INVALID_ARGS);
-
-    for (uint16_t length = 0; length < aOutputLength; length++)
-    {
-        aOutput[length] = (uint8_t)randomUint32Get();
-    }
-
-exit:
-
-#endif // __SANITIZE_ADDRESS__
-
-    return error;
-}
diff --git a/examples/platforms/simulation/flash.c b/examples/platforms/simulation/flash.c
deleted file mode 100644
index 59461e0..0000000
--- a/examples/platforms/simulation/flash.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#include <assert.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <openthread/config.h>
-#include <openthread/logging.h>
-#include <openthread/platform/flash.h>
-
-#include "lib/platform/exit_code.h"
-
-static int sFlashFd = -1;
-
-enum
-{
-    SWAP_SIZE = 2048,
-    SWAP_NUM  = 2,
-};
-
-void otPlatFlashInit(otInstance *aInstance)
-{
-    const char *path = OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH;
-    char        fileName[sizeof(OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH) + 32];
-    struct stat st;
-    bool        create = false;
-    const char *offset = getenv("PORT_OFFSET");
-
-    memset(&st, 0, sizeof(st));
-
-    if (stat(path, &st) == -1)
-    {
-        mkdir(path, 0777);
-    }
-
-    if (offset == NULL)
-    {
-        offset = "0";
-    }
-
-    snprintf(fileName, sizeof(fileName), "%s/%s_%d.flash", path, offset, gNodeId);
-
-    if (access(fileName, 0))
-    {
-        create = true;
-    }
-
-    sFlashFd = open(fileName, O_RDWR | O_CREAT | O_CLOEXEC, 0600);
-    VerifyOrDie(sFlashFd >= 0, OT_EXIT_ERROR_ERRNO);
-
-    lseek(sFlashFd, 0, SEEK_SET);
-
-    if (create)
-    {
-        for (uint8_t index = 0; index < (uint8_t)SWAP_NUM; index++)
-        {
-            otPlatFlashErase(aInstance, index);
-        }
-    }
-}
-
-uint32_t otPlatFlashGetSwapSize(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return SWAP_SIZE;
-}
-
-void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint8_t  buffer[SWAP_SIZE];
-    uint32_t address;
-    ssize_t  rval;
-
-    assert((sFlashFd >= 0) && (aSwapIndex < SWAP_NUM));
-
-    address = aSwapIndex ? SWAP_SIZE : 0;
-    memset(buffer, 0xff, sizeof(buffer));
-
-    rval = pwrite(sFlashFd, buffer, sizeof(buffer), (off_t)address);
-    VerifyOrDie(rval == SWAP_SIZE, OT_EXIT_ERROR_ERRNO);
-}
-
-void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint32_t address;
-    ssize_t  rval;
-
-    assert((sFlashFd >= 0) && (aSwapIndex < SWAP_NUM) && (aSize <= SWAP_SIZE) && (aOffset <= (SWAP_SIZE - aSize)));
-
-    address = aSwapIndex ? SWAP_SIZE : 0;
-
-    rval = pread(sFlashFd, aData, aSize, (off_t)(address + aOffset));
-    VerifyOrDie((uint32_t)rval == aSize, OT_EXIT_ERROR_ERRNO);
-}
-
-void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint32_t address;
-    uint8_t  byte;
-    ssize_t  rval;
-
-    assert((sFlashFd >= 0) && (aSwapIndex < SWAP_NUM) && (aSize <= SWAP_SIZE) && (aOffset <= (SWAP_SIZE - aSize)));
-
-    address = aSwapIndex ? SWAP_SIZE : 0;
-    address += aOffset;
-
-    for (uint32_t offset = 0; offset < aSize; offset++)
-    {
-        rval = pread(sFlashFd, &byte, sizeof(byte), (off_t)(address + offset));
-        VerifyOrDie(rval == sizeof(byte), OT_EXIT_ERROR_ERRNO);
-
-        // Use bitwise AND to emulate the behavior of flash memory
-        byte &= ((uint8_t *)aData)[offset];
-
-        rval = pwrite(sFlashFd, &byte, sizeof(byte), (off_t)(address + offset));
-        VerifyOrDie(rval == sizeof(byte), OT_EXIT_ERROR_ERRNO);
-    }
-}
diff --git a/examples/platforms/simulation/infra_if.c b/examples/platforms/simulation/infra_if.c
deleted file mode 100644
index 9596406..0000000
--- a/examples/platforms/simulation/infra_if.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *  Copyright (c) 2021, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#include <openthread/platform/infra_if.h>
-
-#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
-bool otPlatInfraIfHasAddress(uint32_t aInfraIfIndex, const otIp6Address *aAddress)
-{
-    OT_UNUSED_VARIABLE(aInfraIfIndex);
-    OT_UNUSED_VARIABLE(aAddress);
-
-    return false;
-}
-
-otError otPlatInfraIfSendIcmp6Nd(uint32_t            aInfraIfIndex,
-                                 const otIp6Address *aDestAddress,
-                                 const uint8_t      *aBuffer,
-                                 uint16_t            aBufferLength)
-{
-    OT_UNUSED_VARIABLE(aInfraIfIndex);
-    OT_UNUSED_VARIABLE(aDestAddress);
-    OT_UNUSED_VARIABLE(aBuffer);
-    OT_UNUSED_VARIABLE(aBufferLength);
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatInfraIfDiscoverNat64Prefix(uint32_t aInfraIfIndex)
-{
-    OT_UNUSED_VARIABLE(aInfraIfIndex);
-
-    return OT_ERROR_NONE;
-}
-#endif
diff --git a/examples/platforms/simulation/logging.c b/examples/platforms/simulation/logging.c
deleted file mode 100644
index cce2ad5..0000000
--- a/examples/platforms/simulation/logging.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <syslog.h>
-
-#include <openthread/platform/logging.h>
-#include <openthread/platform/toolchain.h>
-
-#include "utils/code_utils.h"
-
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-
-static FILE *sLogFile = NULL;
-
-void platformLoggingSetFileName(const char *aName)
-{
-    if (sLogFile != NULL)
-    {
-        fclose(sLogFile);
-    }
-
-    sLogFile = fopen(aName, "wt");
-
-    if (sLogFile == NULL)
-    {
-        fprintf(stderr, "Failed to open log file '%s': %s\r\n", aName, strerror(errno));
-        exit(EXIT_FAILURE);
-    }
-}
-
-void platformLoggingInit(const char *aName)
-{
-    if (sLogFile == NULL)
-    {
-        openlog(aName, LOG_PID, LOG_USER);
-        setlogmask(setlogmask(0) & LOG_UPTO(LOG_NOTICE));
-    }
-    else
-    {
-        fprintf(sLogFile, "OpenThread logs\r\n");
-        fprintf(sLogFile, "- Program:  %s\r\n", aName);
-        fprintf(sLogFile, "- Platform: simulation\r\n");
-        fprintf(sLogFile, "- Node ID:  %lu\r\n", (unsigned long)gNodeId);
-        fprintf(sLogFile, "\r\n");
-    }
-}
-
-void platformLoggingDeinit(void)
-{
-    if (sLogFile != NULL)
-    {
-        fclose(sLogFile);
-        sLogFile = NULL;
-    }
-}
-
-void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    OT_UNUSED_VARIABLE(aLogLevel);
-    OT_UNUSED_VARIABLE(aLogRegion);
-
-    va_list args;
-
-    va_start(args, aFormat);
-
-    if (sLogFile == NULL)
-    {
-        char logString[512];
-        int  offset;
-
-        offset = snprintf(logString, sizeof(logString), "[%lu]", (unsigned long)gNodeId);
-
-        vsnprintf(&logString[offset], sizeof(logString) - (uint16_t)offset, aFormat, args);
-        syslog(LOG_CRIT, "%s", logString);
-    }
-    else
-    {
-        vfprintf(sLogFile, aFormat, args);
-        fprintf(sLogFile, "\r\n");
-    }
-
-    va_end(args);
-}
-
-#else
-
-void platformLoggingInit(const char *aName) { OT_UNUSED_VARIABLE(aName); }
-void platformLoggingDeinit(void) {}
-
-#endif // (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
diff --git a/examples/platforms/simulation/misc.c b/examples/platforms/simulation/misc.c
deleted file mode 100644
index 07739a2..0000000
--- a/examples/platforms/simulation/misc.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#include <setjmp.h>
-#include <unistd.h>
-
-#include <openthread/platform/misc.h>
-
-#include "openthread-system.h"
-
-extern jmp_buf gResetJump;
-
-static otPlatResetReason   sPlatResetReason = OT_PLAT_RESET_REASON_POWER_ON;
-bool                       gPlatformPseudoResetWasRequested;
-static otPlatMcuPowerState gPlatMcuPowerState = OT_PLAT_MCU_POWER_STATE_ON;
-
-void otPlatReset(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-#if OPENTHREAD_PLATFORM_USE_PSEUDO_RESET
-    gPlatformPseudoResetWasRequested = true;
-    sPlatResetReason                 = OT_PLAT_RESET_REASON_SOFTWARE;
-
-#else // OPENTHREAD_PLATFORM_USE_PSEUDO_RESET
-    // Restart the process using execvp.
-    otSysDeinit();
-    platformUartRestore();
-
-    longjmp(gResetJump, 1);
-    assert(false);
-
-#endif // OPENTHREAD_PLATFORM_USE_PSEUDO_RESET
-}
-
-#if OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE
-otError otPlatResetToBootloader(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return OT_ERROR_NOT_CAPABLE;
-}
-#endif
-
-otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return sPlatResetReason;
-}
-
-void otPlatWakeHost(void)
-{
-    // TODO: implement an operation to wake the host from sleep state.
-}
-
-otError otPlatSetMcuPowerState(otInstance *aInstance, otPlatMcuPowerState aState)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    switch (aState)
-    {
-    case OT_PLAT_MCU_POWER_STATE_ON:
-    case OT_PLAT_MCU_POWER_STATE_LOW_POWER:
-        gPlatMcuPowerState = aState;
-        break;
-
-    default:
-        error = OT_ERROR_FAILED;
-        break;
-    }
-
-    return error;
-}
-
-otPlatMcuPowerState otPlatGetMcuPowerState(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return gPlatMcuPowerState;
-}
diff --git a/examples/platforms/simulation/openthread-core-simulation-config.h b/examples/platforms/simulation/openthread-core-simulation-config.h
deleted file mode 100644
index 517b5b5..0000000
--- a/examples/platforms/simulation/openthread-core-simulation-config.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- *  Copyright (c) 2017, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- *   This file includes simulation compile-time configuration constants
- *   for OpenThread.
- */
-
-#ifndef OPENTHREAD_CORE_SIMULATION_CONFIG_H_
-#define OPENTHREAD_CORE_SIMULATION_CONFIG_H_
-
-#ifndef OPENTHREAD_RADIO
-#define OPENTHREAD_RADIO 0
-#endif
-
-#ifndef OPENTHREAD_CONFIG_PLATFORM_INFO
-#define OPENTHREAD_CONFIG_PLATFORM_INFO "SIMULATION"
-#endif
-
-#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT
-#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
-#endif
-
-#ifndef OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE
-#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
-#endif
-
-#if OPENTHREAD_RADIO
-
-#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
-#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE 1
-#endif
-
-#endif // OPENTHREAD_RADIO
-
-#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
-#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
-#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
-#endif
-
-#ifndef CLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER
-#define CLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
-#define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
-#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_LOG_PLATFORM
-#define OPENTHREAD_CONFIG_LOG_PLATFORM 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH
-#define OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH 640
-#endif
-
-#ifndef OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
-#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 640
-#endif
-
-#ifndef OPENTHREAD_CONFIG_MLE_MAX_CHILDREN
-#define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 128
-#endif
-
-#ifndef OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH
-#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_UPTIME_ENABLE
-#define OPENTHREAD_CONFIG_UPTIME_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_LOG_PREPEND_UPTIME
-#define OPENTHREAD_CONFIG_LOG_PREPEND_UPTIME 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES
-#define OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES 20
-#endif
-
-#ifndef OPENTHREAD_CONFIG_DETERMINISTIC_ECDSA_ENABLE
-#define OPENTHREAD_CONFIG_DETERMINISTIC_ECDSA_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE
-#define OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
-#define OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE 1
-#endif
-
-#ifndef OPENTHREAD_CONFIG_RADIO_STATS_ENABLE
-#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 1
-#endif
-
-#endif // OPENTHREAD_CORE_SIMULATION_CONFIG_H_
diff --git a/examples/platforms/simulation/platform-config.h b/examples/platforms/simulation/platform-config.h
deleted file mode 100644
index 6591268..0000000
--- a/examples/platforms/simulation/platform-config.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- *   This file includes the platform-specific configuration.
- *
- */
-
-/**
- * @def OPENTHREAD_SIMULATION_UART_BAUDRATE
- *
- * This setting configures the baud rate of the UART.
- *
- */
-#ifndef OPENTHREAD_SIMULATION_UART_BAUDRATE
-#define OPENTHREAD_SIMULATION_UART_BAUDRATE B115200
-#endif
-
-/**
- * @def OPENTHREAD_SIMULATION_VIRTUAL_TIME
- *
- * This setting configures whether to use virtual time (used for simulation) in simulation platform.
- *
- */
-#ifndef OPENTHREAD_SIMULATION_VIRTUAL_TIME
-#define OPENTHREAD_SIMULATION_VIRTUAL_TIME 0
-#endif
-
-/**
- * @def OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
- *
- * This setting configures whether to use virtual time for UART.
- *
- */
-#ifndef OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
-#define OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART 0
-#endif
-
-/**
- * @def OPENTHREAD_PLATFORM_USE_PSEUDO_RESET
- *
- * Define as 1 to enable pseudo-reset.
- *
- */
-#ifndef OPENTHREAD_PLATFORM_USE_PSEUDO_RESET
-#define OPENTHREAD_PLATFORM_USE_PSEUDO_RESET 0
-#endif
-
-/**
- * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE
- *
- * Define as 1 to enable SPI NCP interface.
- *
- */
-#ifndef OPENTHREAD_CONFIG_NCP_SPI_ENABLE
-#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0
-#endif
-
-/**
- * Check OTNS configurations
- *
- */
-#if OPENTHREAD_CONFIG_OTNS_ENABLE
-
-#if !OPENTHREAD_SIMULATION_VIRTUAL_TIME
-#error "OTNS requires virtual time simulations"
-#endif
-
-#endif // OPENTHREAD_CONFIG_OTNS_ENABLE
-
-/**
- * @def OPENTHREAD_SIMULATION_MAX_NETWORK_SIZE
- *
- * This setting configures the maximum network size in simulation.
- *
- */
-#ifndef OPENTHREAD_SIMULATION_MAX_NETWORK_SIZE
-#define OPENTHREAD_SIMULATION_MAX_NETWORK_SIZE 33
-#endif
diff --git a/examples/platforms/simulation/platform-simulation.h b/examples/platforms/simulation/platform-simulation.h
deleted file mode 100644
index 0592b14..0000000
--- a/examples/platforms/simulation/platform-simulation.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- * @brief
- *   This file includes the platform-specific initializers.
- */
-
-#ifndef PLATFORM_SIMULATION_H_
-#define PLATFORM_SIMULATION_H_
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <arpa/inet.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <poll.h>
-#include <signal.h>
-#include <sys/select.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include <openthread/instance.h>
-
-#include "openthread-core-config.h"
-#include "platform-config.h"
-
-enum
-{
-    OT_SIM_EVENT_ALARM_FIRED        = 0,
-    OT_SIM_EVENT_RADIO_RECEIVED     = 1,
-    OT_SIM_EVENT_UART_WRITE         = 2,
-    OT_SIM_EVENT_RADIO_SPINEL_WRITE = 3,
-    OT_SIM_EVENT_OTNS_STATUS_PUSH   = 5,
-    OT_EVENT_DATA_MAX_SIZE          = 1024,
-};
-
-OT_TOOL_PACKED_BEGIN
-struct Event
-{
-    uint64_t mDelay;
-    uint8_t  mEvent;
-    uint16_t mDataLength;
-    uint8_t  mData[OT_EVENT_DATA_MAX_SIZE];
-} OT_TOOL_PACKED_END;
-
-enum
-{
-    MAX_NETWORK_SIZE = OPENTHREAD_SIMULATION_MAX_NETWORK_SIZE,
-};
-
-/**
- * Unique node ID.
- *
- */
-extern uint32_t gNodeId;
-
-/**
- * Initializes the alarm service used by OpenThread.
- *
- */
-void platformAlarmInit(uint32_t aSpeedUpFactor);
-
-/**
- * Retrieves the time remaining until the alarm fires.
- *
- * @param[out]  aTimeout  A pointer to the timeval struct.
- *
- */
-void platformAlarmUpdateTimeout(struct timeval *aTimeout);
-
-/**
- * Performs alarm driver processing.
- *
- * @param[in]  aInstance  The OpenThread instance structure.
- *
- */
-void platformAlarmProcess(otInstance *aInstance);
-
-/**
- * Returns the duration to the next alarm event time (in micro seconds)
- *
- * @returns The duration (in micro seconds) to the next alarm event.
- *
- */
-uint64_t platformAlarmGetNext(void);
-
-/**
- * Returns the current alarm time.
- *
- * @returns The current alarm time.
- *
- */
-uint64_t platformAlarmGetNow(void);
-
-/**
- * Advances the alarm time by @p aDelta.
- *
- * @param[in]  aDelta  The amount of time to advance.
- *
- */
-void platformAlarmAdvanceNow(uint64_t aDelta);
-
-/**
- * Initializes the radio service used by OpenThread.
- *
- */
-void platformRadioInit(void);
-
-/**
- * Shuts down the radio service used by OpenThread.
- *
- */
-void platformRadioDeinit(void);
-
-/**
- * Inputs a received radio frame.
- *
- * @param[in]  aInstance   A pointer to the OpenThread instance.
- * @param[in]  aBuf        A pointer to the received radio frame.
- * @param[in]  aBufLength  The size of the received radio frame.
- *
- */
-void platformRadioReceive(otInstance *aInstance, uint8_t *aBuf, uint16_t aBufLength);
-
-/**
- * Updates the file descriptor sets with file descriptors used by the radio driver.
- *
- * @param[in,out]  aReadFdSet   A pointer to the read file descriptors.
- * @param[in,out]  aWriteFdSet  A pointer to the write file descriptors.
- * @param[in,out]  aTimeout     A pointer to the timeout.
- * @param[in,out]  aMaxFd       A pointer to the max file descriptor.
- *
- */
-void platformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct timeval *aTimeout, int *aMaxFd);
-
-/**
- * Performs radio driver processing.
- *
- * @param[in]  aInstance    The OpenThread instance structure.
- * @param[in]  aReadFdSet   A pointer to the read file descriptors.
- * @param[in]  aWriteFdSet  A pointer to the write file descriptors.
- *
- */
-void platformRadioProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet);
-
-/**
- * Initializes the random number service used by OpenThread.
- *
- */
-void platformRandomInit(void);
-
-/**
- * This functions set the file name to use for logging.
- *
- * @param[in] aName  The file name.
- *
- */
-void platformLoggingSetFileName(const char *aName);
-
-/**
- * Initializes the platform logging service.
- *
- * @param[in] aName    The log module name to set with syslog.
- *
- */
-void platformLoggingInit(const char *aName);
-
-/**
- * Finalizes the platform logging service.
- *
- */
-void platformLoggingDeinit(void);
-
-/**
- * Updates the file descriptor sets with file descriptors used by the UART driver.
- *
- * @param[in,out]  aReadFdSet   A pointer to the read file descriptors.
- * @param[in,out]  aWriteFdSet  A pointer to the write file descriptors.
- * @param[in,out]  aMaxFd       A pointer to the max file descriptor.
- *
- */
-void platformUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, fd_set *aErrorFdSet, int *aMaxFd);
-
-/**
- * Performs radio driver processing.
- *
- */
-void platformUartProcess(void);
-
-/**
- * Restores the Uart.
- *
- */
-void platformUartRestore(void);
-
-/**
- * Sends a simulation event.
- *
- * @param[in]   aEvent  A pointer to the simulation event to send
- *
- */
-void otSimSendEvent(const struct Event *aEvent);
-
-/**
- * Sends Uart data through simulation.
- *
- * @param[in]   aData       A pointer to the UART data.
- * @param[in]   aLength     Length of UART data.
- *
- */
-void otSimSendUartWriteEvent(const uint8_t *aData, uint16_t aLength);
-
-/**
- * Checks if radio transmitting is pending.
- *
- * @returns Whether radio transmitting is pending.
- *
- */
-bool platformRadioIsTransmitPending(void);
-
-/**
- * Parses an environment variable as an unsigned 16-bit integer.
- *
- * If the environment variable does not exist, this function does nothing.
- * If it is not a valid integer, this function will terminate the process with an error message.
- *
- * @param[in]   aEnvName  The name of the environment variable.
- * @param[out]  aValue    A pointer to the unsigned 16-bit integer.
- *
- */
-void parseFromEnvAsUint16(const char *aEnvName, uint16_t *aValue);
-
-#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
-
-/**
- * Initializes the TREL service.
- *
- * @param[in] aSpeedUpFactor   The time speed-up factor.
- *
- */
-void platformTrelInit(uint32_t aSpeedUpFactor);
-
-/**
- * Shuts down the TREL service.
- *
- */
-void platformTrelDeinit(void);
-
-/**
- * Updates the file descriptor sets with file descriptors used by the TREL.
- *
- * @param[in,out]  aReadFdSet   A pointer to the read file descriptors.
- * @param[in,out]  aWriteFdSet  A pointer to the write file descriptors.
- * @param[in,out]  aTimeout     A pointer to the timeout.
- * @param[in,out]  aMaxFd       A pointer to the max file descriptor.
- *
- */
-void platformTrelUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct timeval *aTimeout, int *aMaxFd);
-
-/**
- * Performs TREL processing.
- *
- * @param[in]  aInstance    The OpenThread instance structure.
- * @param[in]  aReadFdSet   A pointer to the read file descriptors.
- * @param[in]  aWriteFdSet  A pointer to the write file descriptors.
- *
- */
-void platformTrelProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet);
-
-#endif // OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
-
-#endif // PLATFORM_SIMULATION_H_
diff --git a/examples/platforms/simulation/radio.c b/examples/platforms/simulation/radio.c
deleted file mode 100644
index 03808b5..0000000
--- a/examples/platforms/simulation/radio.c
+++ /dev/null
@@ -1,1454 +0,0 @@
-/*
- *  Copyright (c) 2016-2019, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#include <errno.h>
-#include <sys/time.h>
-
-#include <openthread/cli.h>
-#include <openthread/dataset.h>
-#include <openthread/link.h>
-#include <openthread/random_noncrypto.h>
-#include <openthread/platform/alarm-micro.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-#include <openthread/platform/radio.h>
-#include <openthread/platform/time.h>
-
-#include "utils/code_utils.h"
-#include "utils/link_metrics.h"
-#include "utils/mac_frame.h"
-#include "utils/soft_source_match_table.h"
-
-// The IPv4 group for receiving packets of radio simulation
-#define OT_RADIO_GROUP "224.0.0.116"
-
-#define MS_PER_S 1000
-#define US_PER_MS 1000
-
-enum
-{
-    IEEE802154_ACK_LENGTH = 5,
-
-    IEEE802154_FRAME_TYPE_ACK = 2 << 0,
-
-    IEEE802154_FRAME_PENDING = 1 << 4,
-};
-
-enum
-{
-    SIM_RECEIVE_SENSITIVITY = -100, // dBm
-
-    SIM_HIGH_RSSI_SAMPLE               = -30, // dBm
-    SIM_LOW_RSSI_SAMPLE                = -98, // dBm
-    SIM_HIGH_RSSI_PROB_INC_PER_CHANNEL = 5,
-};
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
-extern int      sSockFd;
-extern uint16_t sPortBase;
-extern uint16_t sPortOffset;
-#else
-static int      sTxFd       = -1;
-static int      sRxFd       = -1;
-static uint16_t sPortBase   = 9000;
-static uint16_t sPortOffset = 0;
-static uint16_t sPort       = 0;
-#endif
-
-static int8_t   sEnergyScanResult  = OT_RADIO_RSSI_INVALID;
-static bool     sEnergyScanning    = false;
-static uint32_t sEnergyScanEndTime = 0;
-
-enum
-{
-    SIM_RADIO_CHANNEL_MIN = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN,
-    SIM_RADIO_CHANNEL_MAX = OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX,
-};
-
-OT_TOOL_PACKED_BEGIN
-struct RadioMessage
-{
-    uint8_t mChannel;
-    uint8_t mPsdu[OT_RADIO_FRAME_MAX_SIZE];
-} OT_TOOL_PACKED_END;
-
-static void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFrame);
-static void radioSendMessage(otInstance *aInstance);
-static void radioSendAck(void);
-static void radioProcessFrame(otInstance *aInstance);
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-static uint8_t generateAckIeData(uint8_t *aLinkMetricsIeData, uint8_t aLinkMetricsIeDataLen);
-#endif
-
-static otRadioState        sState = OT_RADIO_STATE_DISABLED;
-static struct RadioMessage sReceiveMessage;
-static struct RadioMessage sTransmitMessage;
-static struct RadioMessage sAckMessage;
-static otRadioFrame        sReceiveFrame;
-static otRadioFrame        sTransmitFrame;
-static otRadioFrame        sAckFrame;
-
-#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
-static otRadioIeInfo sTransmitIeInfo;
-#endif
-
-static otExtAddress   sExtAddress;
-static otShortAddress sShortAddress;
-static otPanId        sPanid;
-static bool           sPromiscuous = false;
-static bool           sTxWait      = false;
-static int8_t         sTxPower     = 0;
-static int8_t         sCcaEdThresh = -74;
-static int8_t         sLnaGain     = 0;
-static uint16_t       sRegionCode  = 0;
-
-enum
-{
-    kMinChannel = 11,
-    kMaxChannel = 26,
-};
-static int8_t  sChannelMaxTransmitPower[kMaxChannel - kMinChannel + 1];
-static uint8_t sCurrentChannel = kMinChannel;
-
-static bool sSrcMatchEnabled = false;
-
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-static uint8_t sAckIeData[OT_ACK_IE_MAX_SIZE];
-static uint8_t sAckIeDataLength = 0;
-#endif
-
-#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-static uint32_t sCslSampleTime;
-static uint32_t sCslPeriod;
-#endif
-
-#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
-static bool sRadioCoexEnabled = true;
-#endif
-
-otRadioCaps gRadioCaps =
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-    OT_RADIO_CAPS_TRANSMIT_SEC;
-#else
-    OT_RADIO_CAPS_NONE;
-#endif
-
-static uint32_t         sMacFrameCounter;
-static uint8_t          sKeyId;
-static otMacKeyMaterial sPrevKey;
-static otMacKeyMaterial sCurrKey;
-static otMacKeyMaterial sNextKey;
-static otRadioKeyType   sKeyType;
-
-static int8_t GetRssi(uint16_t aChannel);
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-
-static enum {
-    kFilterOff,
-    kFilterDenyList,
-    kFilterAllowList,
-} sFilterMode = kFilterOff;
-
-static uint8_t sFilterNodeIdsBitVector[(MAX_NETWORK_SIZE + 7) / 8];
-
-static bool FilterContainsId(uint16_t aNodeId)
-{
-    uint16_t index = aNodeId - 1;
-
-    return (sFilterNodeIdsBitVector[index / 8] & (0x80 >> (index % 8))) != 0;
-}
-
-static bool NodeIdFilterIsConnectable(uint16_t aNodeId)
-{
-    bool isConnectable = true;
-
-    switch (sFilterMode)
-    {
-    case kFilterOff:
-        break;
-    case kFilterDenyList:
-        isConnectable = !FilterContainsId(aNodeId);
-        break;
-    case kFilterAllowList:
-        isConnectable = FilterContainsId(aNodeId);
-        break;
-    }
-
-    return isConnectable;
-}
-
-static void AddNodeIdToFilter(uint16_t aNodeId)
-{
-    uint16_t index = aNodeId - 1;
-
-    sFilterNodeIdsBitVector[index / 8] |= 0x80 >> (index % 8);
-}
-
-OT_TOOL_WEAK void otCliOutputFormat(const char *aFmt, ...) { OT_UNUSED_VARIABLE(aFmt); }
-
-otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[])
-{
-    OT_UNUSED_VARIABLE(aContext);
-
-    otError error = OT_ERROR_NONE;
-    bool    deny  = false;
-
-    if (aArgsLength == 0)
-    {
-        switch (sFilterMode)
-        {
-        case kFilterOff:
-            otCliOutputFormat("off");
-            break;
-        case kFilterDenyList:
-            otCliOutputFormat("deny-list");
-            break;
-        case kFilterAllowList:
-            otCliOutputFormat("allow-list");
-            break;
-        }
-
-        for (uint16_t nodeId = 0; nodeId <= (uint16_t)MAX_NETWORK_SIZE; nodeId++)
-        {
-            if (FilterContainsId(nodeId))
-            {
-                otCliOutputFormat(" %d", nodeId);
-            }
-        }
-
-        otCliOutputFormat("\r\n");
-    }
-    else if (!strcmp(aArgs[0], "clear"))
-    {
-        otEXPECT_ACTION(aArgsLength == 1, error = OT_ERROR_INVALID_ARGS);
-
-        memset(sFilterNodeIdsBitVector, 0, sizeof(sFilterNodeIdsBitVector));
-        sFilterMode = kFilterOff;
-    }
-    else if ((deny = !strcmp(aArgs[0], "deny")) || !strcmp(aArgs[0], "allow"))
-    {
-        uint16_t nodeId;
-        char    *endptr;
-
-        otEXPECT_ACTION(aArgsLength == 2, error = OT_ERROR_INVALID_ARGS);
-
-        nodeId = (uint16_t)strtol(aArgs[1], &endptr, 0);
-
-        otEXPECT_ACTION(*endptr == '\0', error = OT_ERROR_INVALID_ARGS);
-        otEXPECT_ACTION(1 <= nodeId && nodeId <= MAX_NETWORK_SIZE, error = OT_ERROR_INVALID_ARGS);
-
-        otEXPECT_ACTION(sFilterMode != (deny ? kFilterAllowList : kFilterDenyList), error = OT_ERROR_INVALID_STATE);
-
-        AddNodeIdToFilter(nodeId);
-        sFilterMode = deny ? kFilterDenyList : kFilterAllowList;
-    }
-    else
-    {
-        error = OT_ERROR_INVALID_COMMAND;
-    }
-
-exit:
-    return error;
-}
-#else
-otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[])
-{
-    OT_UNUSED_VARIABLE(aContext);
-    OT_UNUSED_VARIABLE(aArgsLength);
-    OT_UNUSED_VARIABLE(aArgs);
-
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-
-static bool IsTimeAfterOrEqual(uint32_t aTimeA, uint32_t aTimeB) { return (aTimeA - aTimeB) < (1U << 31); }
-
-static void ReverseExtAddress(otExtAddress *aReversed, const otExtAddress *aOrigin)
-{
-    for (size_t i = 0; i < sizeof(*aReversed); i++)
-    {
-        aReversed->m8[i] = aOrigin->m8[sizeof(*aOrigin) - 1 - i];
-    }
-}
-
-static bool hasFramePending(const otRadioFrame *aFrame)
-{
-    bool         rval = false;
-    otMacAddress src;
-
-    otEXPECT_ACTION(sSrcMatchEnabled, rval = true);
-    otEXPECT(otMacFrameGetSrcAddr(aFrame, &src) == OT_ERROR_NONE);
-
-    switch (src.mType)
-    {
-    case OT_MAC_ADDRESS_TYPE_SHORT:
-        rval = utilsSoftSrcMatchShortFindEntry(src.mAddress.mShortAddress) >= 0;
-        break;
-    case OT_MAC_ADDRESS_TYPE_EXTENDED:
-    {
-        otExtAddress extAddr;
-
-        ReverseExtAddress(&extAddr, &src.mAddress.mExtAddress);
-        rval = utilsSoftSrcMatchExtFindEntry(&extAddr) >= 0;
-        break;
-    }
-    default:
-        break;
-    }
-
-exit:
-    return rval;
-}
-
-static uint16_t crc16_citt(uint16_t aFcs, uint8_t aByte)
-{
-    // CRC-16/CCITT, CRC-16/CCITT-TRUE, CRC-CCITT
-    // width=16 poly=0x1021 init=0x0000 refin=true refout=true xorout=0x0000 check=0x2189 name="KERMIT"
-    // http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.kermit
-    static const uint16_t sFcsTable[256] = {
-        0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5,
-        0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52,
-        0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3,
-        0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
-        0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9,
-        0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e,
-        0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f,
-        0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
-        0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862,
-        0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb,
-        0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948,
-        0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
-        0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226,
-        0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497,
-        0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704,
-        0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
-        0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb,
-        0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c,
-        0x3de3, 0x2c6a, 0x1ef1, 0x0f78};
-    return (aFcs >> 8) ^ sFcsTable[(aFcs ^ aByte) & 0xff];
-}
-
-void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    aIeeeEui64[0] = 0x18;
-    aIeeeEui64[1] = 0xb4;
-    aIeeeEui64[2] = 0x30;
-    aIeeeEui64[3] = 0x00;
-    aIeeeEui64[4] = (gNodeId >> 24) & 0xff;
-    aIeeeEui64[5] = (gNodeId >> 16) & 0xff;
-    aIeeeEui64[6] = (gNodeId >> 8) & 0xff;
-    aIeeeEui64[7] = gNodeId & 0xff;
-}
-
-void otPlatRadioSetPanId(otInstance *aInstance, otPanId aPanid)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    sPanid = aPanid;
-    utilsSoftSrcMatchSetPanId(aPanid);
-}
-
-void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    ReverseExtAddress(&sExtAddress, aExtAddress);
-}
-
-void otPlatRadioSetShortAddress(otInstance *aInstance, otShortAddress aShortAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    sShortAddress = aShortAddress;
-}
-
-void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    sPromiscuous = aEnable;
-}
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-static void initFds(void)
-{
-    int                fd;
-    int                one = 1;
-    struct sockaddr_in sockaddr;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-
-    otEXPECT_ACTION((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) != -1, perror("socket(sTxFd)"));
-
-    sPort                    = (uint16_t)(sPortBase + sPortOffset + gNodeId);
-    sockaddr.sin_family      = AF_INET;
-    sockaddr.sin_port        = htons(sPort);
-    sockaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
-
-    otEXPECT_ACTION(setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, &sockaddr.sin_addr, sizeof(sockaddr.sin_addr)) != -1,
-                    perror("setsockopt(sTxFd, IP_MULTICAST_IF)"));
-
-    otEXPECT_ACTION(setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &one, sizeof(one)) != -1,
-                    perror("setsockopt(sRxFd, IP_MULTICAST_LOOP)"));
-
-    otEXPECT_ACTION(bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) != -1, perror("bind(sTxFd)"));
-
-    // Tx fd is successfully initialized.
-    sTxFd = fd;
-
-    otEXPECT_ACTION((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) != -1, perror("socket(sRxFd)"));
-
-    otEXPECT_ACTION(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) != -1,
-                    perror("setsockopt(sRxFd, SO_REUSEADDR)"));
-    otEXPECT_ACTION(setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one)) != -1,
-                    perror("setsockopt(sRxFd, SO_REUSEPORT)"));
-
-    {
-        struct ip_mreqn mreq;
-
-        memset(&mreq, 0, sizeof(mreq));
-        inet_pton(AF_INET, OT_RADIO_GROUP, &mreq.imr_multiaddr);
-
-        // Always use loopback device to send simulation packets.
-        mreq.imr_address.s_addr = inet_addr("127.0.0.1");
-
-        otEXPECT_ACTION(setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, &mreq.imr_address, sizeof(mreq.imr_address)) != -1,
-                        perror("setsockopt(sRxFd, IP_MULTICAST_IF)"));
-        otEXPECT_ACTION(setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) != -1,
-                        perror("setsockopt(sRxFd, IP_ADD_MEMBERSHIP)"));
-    }
-
-    sockaddr.sin_family      = AF_INET;
-    sockaddr.sin_port        = htons((uint16_t)(sPortBase + sPortOffset));
-    sockaddr.sin_addr.s_addr = inet_addr(OT_RADIO_GROUP);
-
-    otEXPECT_ACTION(bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) != -1, perror("bind(sRxFd)"));
-
-    // Rx fd is successfully initialized.
-    sRxFd = fd;
-
-exit:
-    if (sRxFd == -1 || sTxFd == -1)
-    {
-        exit(EXIT_FAILURE);
-    }
-}
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-
-void platformRadioInit(void)
-{
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-    parseFromEnvAsUint16("PORT_BASE", &sPortBase);
-
-    parseFromEnvAsUint16("PORT_OFFSET", &sPortOffset);
-    sPortOffset *= (MAX_NETWORK_SIZE + 1);
-
-    initFds();
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-
-    sReceiveFrame.mPsdu  = sReceiveMessage.mPsdu;
-    sTransmitFrame.mPsdu = sTransmitMessage.mPsdu;
-    sAckFrame.mPsdu      = sAckMessage.mPsdu;
-
-#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
-    sTransmitFrame.mInfo.mTxInfo.mIeInfo = &sTransmitIeInfo;
-#else
-    sTransmitFrame.mInfo.mTxInfo.mIeInfo = NULL;
-#endif
-
-    for (size_t i = 0; i <= kMaxChannel - kMinChannel; i++)
-    {
-        sChannelMaxTransmitPower[i] = OT_RADIO_POWER_INVALID;
-    }
-
-#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
-    otLinkMetricsInit(SIM_RECEIVE_SENSITIVITY);
-#endif
-}
-
-#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-static uint16_t getCslPhase(void)
-{
-    uint32_t curTime       = otPlatAlarmMicroGetNow();
-    uint32_t cslPeriodInUs = sCslPeriod * OT_US_PER_TEN_SYMBOLS;
-    uint32_t diff = ((sCslSampleTime % cslPeriodInUs) - (curTime % cslPeriodInUs) + cslPeriodInUs) % cslPeriodInUs;
-
-    return (uint16_t)(diff / OT_US_PER_TEN_SYMBOLS);
-}
-#endif
-
-bool otPlatRadioIsEnabled(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return (sState != OT_RADIO_STATE_DISABLED) ? true : false;
-}
-
-otError otPlatRadioEnable(otInstance *aInstance)
-{
-    if (!otPlatRadioIsEnabled(aInstance))
-    {
-        sState = OT_RADIO_STATE_SLEEP;
-    }
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioDisable(otInstance *aInstance)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT(otPlatRadioIsEnabled(aInstance));
-    otEXPECT_ACTION(sState == OT_RADIO_STATE_SLEEP, error = OT_ERROR_INVALID_STATE);
-
-    sState = OT_RADIO_STATE_DISABLED;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioSleep(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    otError error = OT_ERROR_INVALID_STATE;
-
-    if (sState == OT_RADIO_STATE_SLEEP || sState == OT_RADIO_STATE_RECEIVE)
-    {
-        error  = OT_ERROR_NONE;
-        sState = OT_RADIO_STATE_SLEEP;
-    }
-
-    return error;
-}
-
-otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    otError error = OT_ERROR_INVALID_STATE;
-
-    if (sState != OT_RADIO_STATE_DISABLED)
-    {
-        error                  = OT_ERROR_NONE;
-        sState                 = OT_RADIO_STATE_RECEIVE;
-        sTxWait                = false;
-        sReceiveFrame.mChannel = aChannel;
-        sCurrentChannel        = aChannel;
-    }
-
-    return error;
-}
-
-otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aFrame);
-
-    assert(aInstance != NULL);
-    assert(aFrame != NULL);
-
-    otError error = OT_ERROR_INVALID_STATE;
-
-    if (sState == OT_RADIO_STATE_RECEIVE)
-    {
-        error           = OT_ERROR_NONE;
-        sState          = OT_RADIO_STATE_TRANSMIT;
-        sCurrentChannel = aFrame->mChannel;
-    }
-
-    return error;
-}
-
-otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    return &sTransmitFrame;
-}
-
-int8_t otPlatRadioGetRssi(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    assert(aInstance != NULL);
-
-    return GetRssi(sReceiveFrame.mChannel);
-}
-
-static int8_t GetRssi(uint16_t aChannel)
-{
-    int8_t   rssi = SIM_LOW_RSSI_SAMPLE;
-    uint32_t probabilityThreshold;
-
-    otEXPECT((SIM_RADIO_CHANNEL_MIN <= aChannel) && aChannel <= (SIM_RADIO_CHANNEL_MAX));
-
-    // To emulate a simple interference model, we return either a high or
-    // a low  RSSI value with a fixed probability per each channel. The
-    // probability is increased per channel by a constant.
-
-    probabilityThreshold = (aChannel - SIM_RADIO_CHANNEL_MIN) * SIM_HIGH_RSSI_PROB_INC_PER_CHANNEL;
-
-    if (otRandomNonCryptoGetUint16() < (probabilityThreshold * 0xffff / 100))
-    {
-        rssi = SIM_HIGH_RSSI_SAMPLE;
-    }
-
-exit:
-    return rssi;
-}
-
-otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    return gRadioCaps;
-}
-
-bool otPlatRadioGetPromiscuous(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    return sPromiscuous;
-}
-
-static void radioReceive(otInstance *aInstance)
-{
-    bool isTxDone = false;
-    bool isAck    = otMacFrameIsAck(&sReceiveFrame);
-
-    otEXPECT(sReceiveFrame.mChannel == sReceiveMessage.mChannel);
-    otEXPECT(sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_TRANSMIT);
-
-    // Unable to simulate SFD, so use the rx done timestamp instead.
-    sReceiveFrame.mInfo.mRxInfo.mTimestamp = otPlatTimeGet();
-
-    if (sTxWait)
-    {
-        if (otMacFrameIsAckRequested(&sTransmitFrame))
-        {
-            isTxDone = isAck && otMacFrameGetSequence(&sReceiveFrame) == otMacFrameGetSequence(&sTransmitFrame);
-        }
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
-        // Simulate tx done when receiving the echo frame.
-        else
-        {
-            isTxDone = !isAck && sTransmitFrame.mLength == sReceiveFrame.mLength &&
-                       memcmp(sTransmitFrame.mPsdu, sReceiveFrame.mPsdu, sTransmitFrame.mLength) == 0;
-        }
-#endif
-    }
-
-    if (isTxDone)
-    {
-        sState  = OT_RADIO_STATE_RECEIVE;
-        sTxWait = false;
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioTransmitDone(aInstance, &sTransmitFrame, OT_ERROR_NONE);
-        }
-        else
-#endif
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, (isAck ? &sReceiveFrame : NULL), OT_ERROR_NONE);
-        }
-    }
-    else if (!isAck || sPromiscuous)
-    {
-        radioProcessFrame(aInstance);
-    }
-
-exit:
-    return;
-}
-
-static void radioComputeCrc(struct RadioMessage *aMessage, uint16_t aLength)
-{
-    uint16_t crc        = 0;
-    uint16_t crc_offset = aLength - sizeof(uint16_t);
-
-    for (uint16_t i = 0; i < crc_offset; i++)
-    {
-        crc = crc16_citt(crc, aMessage->mPsdu[i]);
-    }
-
-    aMessage->mPsdu[crc_offset]     = crc & 0xff;
-    aMessage->mPsdu[crc_offset + 1] = crc >> 8;
-}
-
-static otError radioProcessTransmitSecurity(otRadioFrame *aFrame)
-{
-    otError error = OT_ERROR_NONE;
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-    otMacKeyMaterial *key = NULL;
-    uint8_t           keyId;
-
-    otEXPECT(otMacFrameIsSecurityEnabled(aFrame) && otMacFrameIsKeyIdMode1(aFrame) &&
-             !aFrame->mInfo.mTxInfo.mIsSecurityProcessed);
-
-    if (otMacFrameIsAck(aFrame))
-    {
-        keyId = otMacFrameGetKeyId(aFrame);
-
-        otEXPECT_ACTION(keyId != 0, error = OT_ERROR_FAILED);
-
-        if (keyId == sKeyId)
-        {
-            key = &sCurrKey;
-        }
-        else if (keyId == sKeyId - 1)
-        {
-            key = &sPrevKey;
-        }
-        else if (keyId == sKeyId + 1)
-        {
-            key = &sNextKey;
-        }
-        else
-        {
-            error = OT_ERROR_SECURITY;
-            otEXPECT(false);
-        }
-    }
-    else
-    {
-        key   = &sCurrKey;
-        keyId = sKeyId;
-    }
-
-    aFrame->mInfo.mTxInfo.mAesKey = key;
-
-    if (!aFrame->mInfo.mTxInfo.mIsHeaderUpdated)
-    {
-        otMacFrameSetKeyId(aFrame, keyId);
-        otMacFrameSetFrameCounter(aFrame, sMacFrameCounter++);
-    }
-#else
-    otEXPECT(!aFrame->mInfo.mTxInfo.mIsSecurityProcessed);
-#endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-
-    otMacFrameProcessTransmitAesCcm(aFrame, &sExtAddress);
-
-exit:
-    return error;
-}
-
-void radioSendMessage(otInstance *aInstance)
-{
-#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT && OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
-    if (sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset != 0)
-    {
-        uint8_t *timeIe = sTransmitFrame.mPsdu + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset;
-        uint64_t time = (uint64_t)((int64_t)otPlatTimeGet() + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mNetworkTimeOffset);
-
-        *timeIe = sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeSyncSeq;
-
-        *(++timeIe) = (uint8_t)(time & 0xff);
-        for (uint8_t i = 1; i < sizeof(uint64_t); i++)
-        {
-            time        = time >> 8;
-            *(++timeIe) = (uint8_t)(time & 0xff);
-        }
-    }
-#endif // OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT && OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
-
-#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-    if (sCslPeriod > 0 && !sTransmitFrame.mInfo.mTxInfo.mIsHeaderUpdated)
-    {
-        otMacFrameSetCslIe(&sTransmitFrame, (uint16_t)sCslPeriod, getCslPhase());
-    }
-#endif
-
-    sTransmitMessage.mChannel = sTransmitFrame.mChannel;
-
-    otEXPECT(radioProcessTransmitSecurity(&sTransmitFrame) == OT_ERROR_NONE);
-    otPlatRadioTxStarted(aInstance, &sTransmitFrame);
-    radioComputeCrc(&sTransmitMessage, sTransmitFrame.mLength);
-    radioTransmit(&sTransmitMessage, &sTransmitFrame);
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-    sTxWait = otMacFrameIsAckRequested(&sTransmitFrame);
-
-    if (!sTxWait)
-    {
-        sState = OT_RADIO_STATE_RECEIVE;
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioTransmitDone(aInstance, &sTransmitFrame, OT_ERROR_NONE);
-        }
-        else
-#endif
-        {
-            otPlatRadioTxDone(aInstance, &sTransmitFrame, NULL, OT_ERROR_NONE);
-        }
-    }
-#else
-    // Wait for echo radio in virtual time mode.
-    sTxWait = true;
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME
-exit:
-    return;
-}
-
-bool platformRadioIsTransmitPending(void) { return sState == OT_RADIO_STATE_TRANSMIT && !sTxWait; }
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
-void platformRadioReceive(otInstance *aInstance, uint8_t *aBuf, uint16_t aBufLength)
-{
-    assert(sizeof(sReceiveMessage) >= aBufLength);
-
-    memcpy(&sReceiveMessage, aBuf, aBufLength);
-
-    sReceiveFrame.mLength = (uint8_t)(aBufLength - 1);
-
-    radioReceive(aInstance);
-}
-#else
-void platformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct timeval *aTimeout, int *aMaxFd)
-{
-    if (aReadFdSet != NULL && (sState != OT_RADIO_STATE_TRANSMIT || sTxWait))
-    {
-        FD_SET(sRxFd, aReadFdSet);
-
-        if (aMaxFd != NULL && *aMaxFd < sRxFd)
-        {
-            *aMaxFd = sRxFd;
-        }
-    }
-
-    if (aWriteFdSet != NULL && platformRadioIsTransmitPending())
-    {
-        FD_SET(sTxFd, aWriteFdSet);
-
-        if (aMaxFd != NULL && *aMaxFd < sTxFd)
-        {
-            *aMaxFd = sTxFd;
-        }
-    }
-
-    if (sEnergyScanning)
-    {
-        struct timeval tv  = {0, 0};
-        uint32_t       now = otPlatAlarmMilliGetNow();
-
-        if (IsTimeAfterOrEqual(sEnergyScanEndTime, now))
-        {
-            uint32_t remaining = sEnergyScanEndTime - now;
-
-            tv.tv_sec  = remaining / MS_PER_S;
-            tv.tv_usec = (remaining % MS_PER_S) * US_PER_MS;
-        }
-
-        if (timercmp(&tv, aTimeout, <))
-        {
-            *aTimeout = tv;
-        }
-    }
-}
-
-// no need to close in virtual time mode.
-void platformRadioDeinit(void)
-{
-    if (sRxFd != -1)
-    {
-        close(sRxFd);
-    }
-
-    if (sTxFd != -1)
-    {
-        close(sTxFd);
-    }
-}
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME
-
-void platformRadioProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet)
-{
-    OT_UNUSED_VARIABLE(aReadFdSet);
-    OT_UNUSED_VARIABLE(aWriteFdSet);
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-    if (FD_ISSET(sRxFd, aReadFdSet))
-    {
-        struct sockaddr_in sockaddr;
-        socklen_t          len = sizeof(sockaddr);
-        ssize_t            rval;
-
-        memset(&sockaddr, 0, sizeof(sockaddr));
-        rval =
-            recvfrom(sRxFd, (char *)&sReceiveMessage, sizeof(sReceiveMessage), 0, (struct sockaddr *)&sockaddr, &len);
-
-        if (rval > 0)
-        {
-            uint16_t srcPort   = ntohs(sockaddr.sin_port);
-            uint16_t srcNodeId = srcPort - sPortOffset - sPortBase;
-
-            if (NodeIdFilterIsConnectable(srcNodeId) && srcPort != sPort)
-            {
-                sReceiveFrame.mLength = (uint16_t)(rval - 1);
-
-                radioReceive(aInstance);
-            }
-        }
-        else if (rval == 0)
-        {
-            // socket is closed, which should not happen
-            assert(false);
-        }
-        else if (errno != EINTR && errno != EAGAIN)
-        {
-            perror("recvfrom(sRxFd)");
-            exit(EXIT_FAILURE);
-        }
-    }
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-    if (platformRadioIsTransmitPending())
-    {
-        radioSendMessage(aInstance);
-    }
-
-    if (sEnergyScanning && IsTimeAfterOrEqual(otPlatAlarmMilliGetNow(), sEnergyScanEndTime))
-    {
-        sEnergyScanning = false;
-        otPlatRadioEnergyScanDone(aInstance, sEnergyScanResult);
-    }
-}
-
-void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFrame)
-{
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-    ssize_t            rval;
-    struct sockaddr_in sockaddr;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-    sockaddr.sin_family = AF_INET;
-    inet_pton(AF_INET, OT_RADIO_GROUP, &sockaddr.sin_addr);
-
-    sockaddr.sin_port = htons((uint16_t)(sPortBase + sPortOffset));
-    rval =
-        sendto(sTxFd, (const char *)aMessage, 1 + aFrame->mLength, 0, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
-
-    if (rval < 0)
-    {
-        perror("sendto(sTxFd)");
-        exit(EXIT_FAILURE);
-    }
-#else  // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-    struct Event event;
-
-    event.mDelay      = 1; // 1us for now
-    event.mEvent      = OT_SIM_EVENT_RADIO_RECEIVED;
-    event.mDataLength = 1 + aFrame->mLength; // include channel in first byte
-    memcpy(event.mData, aMessage, event.mDataLength);
-
-    otSimSendEvent(&event);
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-}
-
-void radioSendAck(void)
-{
-    if (
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-        // Determine if frame pending should be set
-        ((otMacFrameIsVersion2015(&sReceiveFrame) && otMacFrameIsCommand(&sReceiveFrame)) ||
-         otMacFrameIsData(&sReceiveFrame) || otMacFrameIsDataRequest(&sReceiveFrame))
-#else
-        otMacFrameIsDataRequest(&sReceiveFrame)
-#endif
-        && hasFramePending(&sReceiveFrame))
-    {
-        sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending = true;
-    }
-
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-    // Use enh-ack for 802.15.4-2015 frames
-    if (otMacFrameIsVersion2015(&sReceiveFrame))
-    {
-        uint8_t  linkMetricsDataLen = 0;
-        uint8_t *dataPtr            = NULL;
-
-#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
-        uint8_t      linkMetricsData[OT_ENH_PROBING_IE_DATA_MAX_SIZE];
-        otMacAddress macAddress;
-
-        otEXPECT(otMacFrameGetSrcAddr(&sReceiveFrame, &macAddress) == OT_ERROR_NONE);
-
-        linkMetricsDataLen = otLinkMetricsEnhAckGenData(&macAddress, sReceiveFrame.mInfo.mRxInfo.mLqi,
-                                                        sReceiveFrame.mInfo.mRxInfo.mRssi, linkMetricsData);
-
-        if (linkMetricsDataLen > 0)
-        {
-            dataPtr = linkMetricsData;
-        }
-#endif
-
-        sAckIeDataLength = generateAckIeData(dataPtr, linkMetricsDataLen);
-
-        otEXPECT(otMacFrameGenerateEnhAck(&sReceiveFrame, sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending,
-                                          sAckIeData, sAckIeDataLength, &sAckFrame) == OT_ERROR_NONE);
-#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-        if (sCslPeriod > 0)
-        {
-            otMacFrameSetCslIe(&sAckFrame, (uint16_t)sCslPeriod, getCslPhase());
-        }
-#endif
-        if (otMacFrameIsSecurityEnabled(&sAckFrame))
-        {
-            otEXPECT(radioProcessTransmitSecurity(&sAckFrame) == OT_ERROR_NONE);
-        }
-    }
-    else
-#endif
-    {
-        otMacFrameGenerateImmAck(&sReceiveFrame, sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending, &sAckFrame);
-    }
-
-    sAckMessage.mChannel = sReceiveFrame.mChannel;
-
-    radioComputeCrc(&sAckMessage, sAckFrame.mLength);
-    radioTransmit(&sAckMessage, &sAckFrame);
-
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-exit:
-#endif
-    return;
-}
-
-void radioProcessFrame(otInstance *aInstance)
-{
-    otError      error = OT_ERROR_NONE;
-    otMacAddress macAddress;
-    OT_UNUSED_VARIABLE(macAddress);
-
-    sReceiveFrame.mInfo.mRxInfo.mRssi = -20;
-    sReceiveFrame.mInfo.mRxInfo.mLqi  = OT_RADIO_LQI_NONE;
-
-    sReceiveFrame.mInfo.mRxInfo.mAckedWithFramePending = false;
-    sReceiveFrame.mInfo.mRxInfo.mAckedWithSecEnhAck    = false;
-
-    otEXPECT(sPromiscuous == false);
-
-    otEXPECT_ACTION(otMacFrameDoesAddrMatch(&sReceiveFrame, sPanid, sShortAddress, &sExtAddress),
-                    error = OT_ERROR_ABORT);
-
-#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
-    otEXPECT_ACTION(otMacFrameGetSrcAddr(&sReceiveFrame, &macAddress) == OT_ERROR_NONE, error = OT_ERROR_PARSE);
-#endif
-
-    // generate acknowledgment
-    if (otMacFrameIsAckRequested(&sReceiveFrame))
-    {
-        radioSendAck();
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-        if (otMacFrameIsSecurityEnabled(&sAckFrame))
-        {
-            sReceiveFrame.mInfo.mRxInfo.mAckedWithSecEnhAck = true;
-            sReceiveFrame.mInfo.mRxInfo.mAckFrameCounter    = otMacFrameGetFrameCounter(&sAckFrame);
-        }
-#endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-    }
-
-exit:
-
-    if (error != OT_ERROR_ABORT)
-    {
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-        if (otPlatDiagModeGet())
-        {
-            otPlatDiagRadioReceiveDone(aInstance, error == OT_ERROR_NONE ? &sReceiveFrame : NULL, error);
-        }
-        else
-#endif
-        {
-            otPlatRadioReceiveDone(aInstance, error == OT_ERROR_NONE ? &sReceiveFrame : NULL, error);
-        }
-    }
-}
-
-void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    sSrcMatchEnabled = aEnable;
-}
-
-otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aScanChannel);
-
-    otError error = OT_ERROR_NONE;
-
-    assert(aInstance != NULL);
-    assert(aScanChannel >= SIM_RADIO_CHANNEL_MIN && aScanChannel <= SIM_RADIO_CHANNEL_MAX);
-    assert(aScanDuration > 0);
-
-    otEXPECT_ACTION((gRadioCaps & OT_RADIO_CAPS_ENERGY_SCAN), error = OT_ERROR_NOT_IMPLEMENTED);
-    otEXPECT_ACTION(!sEnergyScanning, error = OT_ERROR_BUSY);
-
-    sEnergyScanResult  = GetRssi(aScanChannel);
-    sEnergyScanning    = true;
-    sEnergyScanEndTime = otPlatAlarmMilliGetNow() + aScanDuration;
-
-exit:
-    return error;
-}
-
-otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    int8_t maxPower = sChannelMaxTransmitPower[sCurrentChannel - kMinChannel];
-
-    assert(aInstance != NULL);
-
-    *aPower = sTxPower < maxPower ? sTxPower : maxPower;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    sTxPower = aPower;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    *aThreshold = sCcaEdThresh;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    sCcaEdThresh = aThreshold;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL && aGain != NULL);
-
-    *aGain = sLnaGain;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioSetFemLnaGain(otInstance *aInstance, int8_t aGain)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    sLnaGain = aGain;
-
-    return OT_ERROR_NONE;
-}
-
-int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    return SIM_RECEIVE_SENSITIVITY;
-}
-
-otRadioState otPlatRadioGetState(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return sState;
-}
-
-#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
-otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    sRadioCoexEnabled = aEnabled;
-    return OT_ERROR_NONE;
-}
-
-bool otPlatRadioIsCoexEnabled(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aInstance != NULL);
-
-    return sRadioCoexEnabled;
-}
-
-otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    assert(aInstance != NULL);
-    otEXPECT_ACTION(aCoexMetrics != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    memset(aCoexMetrics, 0, sizeof(otRadioCoexMetrics));
-
-    aCoexMetrics->mStopped                            = false;
-    aCoexMetrics->mNumGrantGlitch                     = 1;
-    aCoexMetrics->mNumTxRequest                       = 2;
-    aCoexMetrics->mNumTxGrantImmediate                = 3;
-    aCoexMetrics->mNumTxGrantWait                     = 4;
-    aCoexMetrics->mNumTxGrantWaitActivated            = 5;
-    aCoexMetrics->mNumTxGrantWaitTimeout              = 6;
-    aCoexMetrics->mNumTxGrantDeactivatedDuringRequest = 7;
-    aCoexMetrics->mNumTxDelayedGrant                  = 8;
-    aCoexMetrics->mAvgTxRequestToGrantTime            = 9;
-    aCoexMetrics->mNumRxRequest                       = 10;
-    aCoexMetrics->mNumRxGrantImmediate                = 11;
-    aCoexMetrics->mNumRxGrantWait                     = 12;
-    aCoexMetrics->mNumRxGrantWaitActivated            = 13;
-    aCoexMetrics->mNumRxGrantWaitTimeout              = 14;
-    aCoexMetrics->mNumRxGrantDeactivatedDuringRequest = 15;
-    aCoexMetrics->mNumRxDelayedGrant                  = 16;
-    aCoexMetrics->mAvgRxRequestToGrantTime            = 17;
-    aCoexMetrics->mNumRxGrantNone                     = 18;
-
-exit:
-    return error;
-}
-#endif
-
-uint64_t otPlatRadioGetNow(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return otPlatTimeGet();
-}
-
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-static uint8_t generateAckIeData(uint8_t *aLinkMetricsIeData, uint8_t aLinkMetricsIeDataLen)
-{
-    OT_UNUSED_VARIABLE(aLinkMetricsIeData);
-    OT_UNUSED_VARIABLE(aLinkMetricsIeDataLen);
-
-    uint8_t offset = 0;
-
-#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-    if (sCslPeriod > 0)
-    {
-        offset += otMacFrameGenerateCslIeTemplate(sAckIeData);
-    }
-#endif
-
-#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
-    if (aLinkMetricsIeData != NULL && aLinkMetricsIeDataLen > 0)
-    {
-        offset += otMacFrameGenerateEnhAckProbingIe(sAckIeData, aLinkMetricsIeData, aLinkMetricsIeDataLen);
-    }
-#endif
-
-    return offset;
-}
-#endif
-
-#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-otError otPlatRadioEnableCsl(otInstance         *aInstance,
-                             uint32_t            aCslPeriod,
-                             otShortAddress      aShortAddr,
-                             const otExtAddress *aExtAddr)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aShortAddr);
-    OT_UNUSED_VARIABLE(aExtAddr);
-
-    sCslPeriod = aCslPeriod;
-
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioResetCsl(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sCslPeriod = 0;
-
-    return OT_ERROR_NONE;
-}
-
-void otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTime)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sCslSampleTime = aCslSampleTime;
-}
-
-uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return 0;
-}
-#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-
-void otPlatRadioSetMacKey(otInstance             *aInstance,
-                          uint8_t                 aKeyIdMode,
-                          uint8_t                 aKeyId,
-                          const otMacKeyMaterial *aPrevKey,
-                          const otMacKeyMaterial *aCurrKey,
-                          const otMacKeyMaterial *aNextKey,
-                          otRadioKeyType          aKeyType)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aKeyIdMode);
-
-    otEXPECT(aPrevKey != NULL && aCurrKey != NULL && aNextKey != NULL);
-
-    sKeyId   = aKeyId;
-    sKeyType = aKeyType;
-    memcpy(&sPrevKey, aPrevKey, sizeof(otMacKeyMaterial));
-    memcpy(&sCurrKey, aCurrKey, sizeof(otMacKeyMaterial));
-    memcpy(&sNextKey, aNextKey, sizeof(otMacKeyMaterial));
-
-exit:
-    return;
-}
-
-void otPlatRadioSetMacFrameCounter(otInstance *aInstance, uint32_t aMacFrameCounter)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sMacFrameCounter = aMacFrameCounter;
-}
-
-otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aChannel >= kMinChannel && aChannel <= kMaxChannel, error = OT_ERROR_INVALID_ARGS);
-    sChannelMaxTransmitPower[aChannel - kMinChannel] = aMaxPower;
-
-exit:
-    return error;
-}
-
-#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
-otError otPlatRadioConfigureEnhAckProbing(otInstance          *aInstance,
-                                          otLinkMetrics        aLinkMetrics,
-                                          const otShortAddress aShortAddress,
-                                          const otExtAddress  *aExtAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    return otLinkMetricsConfigureEnhAckProbing(aShortAddress, aExtAddress, aLinkMetrics);
-}
-#endif
-
-otError otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sRegionCode = aRegionCode;
-    return OT_ERROR_NONE;
-}
-
-otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(aRegionCode != NULL, error = OT_ERROR_INVALID_ARGS);
-
-    *aRegionCode = sRegionCode;
-exit:
-    return error;
-}
-
-void parseFromEnvAsUint16(const char *aEnvName, uint16_t *aValue)
-{
-    char *env = getenv(aEnvName);
-
-    if (env)
-    {
-        char *endptr;
-
-        *aValue = (uint16_t)strtol(env, &endptr, 0);
-
-        if (*endptr != '\0')
-        {
-            fprintf(stderr, "Invalid %s: %s\n", aEnvName, env);
-            exit(EXIT_FAILURE);
-        }
-    }
-}
diff --git a/examples/platforms/simulation/spi-stubs.c b/examples/platforms/simulation/spi-stubs.c
deleted file mode 100644
index 2643402..0000000
--- a/examples/platforms/simulation/spi-stubs.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <openthread/config.h>
-#include <openthread/platform/spi-slave.h>
-
-#if OPENTHREAD_CONFIG_NCP_SPI_ENABLE
-
-// Spi-slave stubs
-
-otError otPlatSpiSlaveEnable(otPlatSpiSlaveTransactionCompleteCallback aCompleteCallback,
-                             otPlatSpiSlaveTransactionProcessCallback  aProcessCallback,
-                             void                                     *aContext)
-{
-    OT_UNUSED_VARIABLE(aCompleteCallback);
-    OT_UNUSED_VARIABLE(aProcessCallback);
-    OT_UNUSED_VARIABLE(aContext);
-
-    fprintf(stderr, "\nNo SPI support for simulation platform.");
-    exit(0);
-
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-void otPlatSpiSlaveDisable(void) {}
-
-otError otPlatSpiSlavePrepareTransaction(uint8_t *aOutputBuf,
-                                         uint16_t aOutputBufLen,
-                                         uint8_t *aInputBuf,
-                                         uint16_t aInputBufLen,
-                                         bool     aRequestTransactionFlag)
-{
-    OT_UNUSED_VARIABLE(aOutputBuf);
-    OT_UNUSED_VARIABLE(aOutputBufLen);
-    OT_UNUSED_VARIABLE(aInputBuf);
-    OT_UNUSED_VARIABLE(aInputBufLen);
-    OT_UNUSED_VARIABLE(aRequestTransactionFlag);
-
-    return OT_ERROR_NOT_IMPLEMENTED;
-}
-
-// Uart
-
-void otPlatUartSendDone(void) {}
-
-void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
-{
-    OT_UNUSED_VARIABLE(aBuf);
-    OT_UNUSED_VARIABLE(aBufLength);
-}
-
-#endif // OPENTHREAD_CONFIG_NCP_SPI_ENABLE
diff --git a/examples/platforms/simulation/system.c b/examples/platforms/simulation/system.c
deleted file mode 100644
index 535cb1c..0000000
--- a/examples/platforms/simulation/system.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- * @brief
- *   This file includes the platform-specific initializers.
- */
-
-#include "platform-simulation.h"
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
-
-#include <assert.h>
-#include <errno.h>
-#include <getopt.h>
-#include <libgen.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <openthread/tasklet.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/radio.h>
-
-uint32_t gNodeId = 1;
-
-extern bool        gPlatformPseudoResetWasRequested;
-extern otRadioCaps gRadioCaps;
-
-static volatile bool gTerminate = false;
-
-static void handleSignal(int aSignal)
-{
-    OT_UNUSED_VARIABLE(aSignal);
-
-    gTerminate = true;
-}
-
-/**
- * Defines the argument return values.
- *
- */
-enum
-{
-    OT_SIM_OPT_HELP               = 'h',
-    OT_SIM_OPT_ENABLE_ENERGY_SCAN = 'E',
-    OT_SIM_OPT_SLEEP_TO_TX        = 't',
-    OT_SIM_OPT_TIME_SPEED         = 's',
-    OT_SIM_OPT_LOG_FILE           = 'l',
-    OT_SIM_OPT_UNKNOWN            = '?',
-};
-
-static void PrintUsage(const char *aProgramName, int aExitCode)
-{
-    fprintf(stderr,
-            "Syntax:\n"
-            "    %s [Options] NodeId\n"
-            "Options:\n"
-            "    -h --help                  Display this usage information.\n"
-            "    -E --enable-energy-scan    Enable energy scan capability.\n"
-            "    -t --sleep-to-tx           Let radio support direct transition from sleep to TX with CSMA.\n"
-            "    -s --time-speed=val        Speed up the time in simulation.\n"
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-            "    -l --log-file=name         File name to write logs.\n"
-#endif
-            ,
-            aProgramName);
-
-    exit(aExitCode);
-}
-
-void otSysInit(int aArgCount, char *aArgVector[])
-{
-    char    *endptr;
-    uint32_t speedUpFactor = 1;
-
-    static const struct option long_options[] = {
-        {"help", no_argument, 0, OT_SIM_OPT_HELP},
-        {"enable-energy-scan", no_argument, 0, OT_SIM_OPT_ENABLE_ENERGY_SCAN},
-        {"sleep-to-tx", no_argument, 0, OT_SIM_OPT_SLEEP_TO_TX},
-        {"time-speed", required_argument, 0, OT_SIM_OPT_TIME_SPEED},
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-        {"log-file", required_argument, 0, OT_SIM_OPT_LOG_FILE},
-#endif
-        {0, 0, 0, 0},
-    };
-
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-    static const char options[] = "Ehts:l:";
-#else
-    static const char options[] = "Ehts:";
-#endif
-
-    if (gPlatformPseudoResetWasRequested)
-    {
-        gPlatformPseudoResetWasRequested = false;
-        return;
-    }
-
-    optind = 1;
-
-    while (true)
-    {
-        int c = getopt_long(aArgCount, aArgVector, options, long_options, NULL);
-
-        if (c == -1)
-        {
-            break;
-        }
-
-        switch (c)
-        {
-        case OT_SIM_OPT_UNKNOWN:
-            PrintUsage(aArgVector[0], EXIT_FAILURE);
-            break;
-        case OT_SIM_OPT_HELP:
-            PrintUsage(aArgVector[0], EXIT_SUCCESS);
-            break;
-        case OT_SIM_OPT_ENABLE_ENERGY_SCAN:
-            gRadioCaps |= OT_RADIO_CAPS_ENERGY_SCAN;
-            break;
-        case OT_SIM_OPT_SLEEP_TO_TX:
-            gRadioCaps |= OT_RADIO_CAPS_SLEEP_TO_TX;
-            break;
-        case OT_SIM_OPT_TIME_SPEED:
-            speedUpFactor = (uint32_t)strtol(optarg, &endptr, 10);
-            if (*endptr != '\0' || speedUpFactor == 0)
-            {
-                fprintf(stderr, "Invalid value for TimerSpeedUpFactor: %s\n", optarg);
-                exit(EXIT_FAILURE);
-            }
-            break;
-#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
-        case OT_SIM_OPT_LOG_FILE:
-            platformLoggingSetFileName(optarg);
-            break;
-#endif
-        default:
-            break;
-        }
-    }
-
-    if (optind != aArgCount - 1)
-    {
-        PrintUsage(aArgVector[0], EXIT_FAILURE);
-    }
-
-    gNodeId = (uint32_t)strtol(aArgVector[optind], &endptr, 0);
-
-    if (*endptr != '\0' || gNodeId < 1 || gNodeId > MAX_NETWORK_SIZE)
-    {
-        fprintf(stderr, "Invalid NodeId: %s\n", aArgVector[optind]);
-        exit(EXIT_FAILURE);
-    }
-
-    signal(SIGTERM, &handleSignal);
-    signal(SIGHUP, &handleSignal);
-
-    platformLoggingInit(basename(aArgVector[0]));
-    platformAlarmInit(speedUpFactor);
-    platformRadioInit();
-#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
-    platformTrelInit(speedUpFactor);
-#endif
-    platformRandomInit();
-}
-
-bool otSysPseudoResetWasRequested(void) { return gPlatformPseudoResetWasRequested; }
-
-void otSysDeinit(void)
-{
-    platformRadioDeinit();
-#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
-    platformTrelDeinit();
-#endif
-    platformLoggingDeinit();
-}
-
-void otSysProcessDrivers(otInstance *aInstance)
-{
-    fd_set         read_fds;
-    fd_set         write_fds;
-    fd_set         error_fds;
-    int            max_fd = -1;
-    struct timeval timeout;
-    int            rval;
-
-    FD_ZERO(&read_fds);
-    FD_ZERO(&write_fds);
-    FD_ZERO(&error_fds);
-
-    platformUartUpdateFdSet(&read_fds, &write_fds, &error_fds, &max_fd);
-    platformAlarmUpdateTimeout(&timeout);
-    platformRadioUpdateFdSet(&read_fds, &write_fds, &timeout, &max_fd);
-#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
-    platformTrelUpdateFdSet(&read_fds, &write_fds, &timeout, &max_fd);
-#endif
-
-    if (otTaskletsArePending(aInstance))
-    {
-        timeout.tv_sec  = 0;
-        timeout.tv_usec = 0;
-    }
-
-    rval = select(max_fd + 1, &read_fds, &write_fds, &error_fds, &timeout);
-
-    if (rval >= 0)
-    {
-        platformUartProcess();
-        platformRadioProcess(aInstance, &read_fds, &write_fds);
-    }
-    else if (errno != EINTR)
-    {
-        perror("select");
-        exit(EXIT_FAILURE);
-    }
-
-    platformAlarmProcess(aInstance);
-#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
-    platformTrelProcess(aInstance, &read_fds, &write_fds);
-#endif
-
-    if (gTerminate)
-    {
-        exit(0);
-    }
-}
-
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
diff --git a/examples/platforms/simulation/trel.c b/examples/platforms/simulation/trel.c
deleted file mode 100644
index cfc34ac..0000000
--- a/examples/platforms/simulation/trel.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- *  Copyright (c) 2019-21, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#include <openthread/random_noncrypto.h>
-#include <openthread/platform/trel.h>
-
-#include "utils/code_utils.h"
-
-#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
-
-// Change DEBUG_LOG to all extra logging
-#define DEBUG_LOG 0
-
-// The IPv4 group for receiving
-#define TREL_SIM_GROUP "224.0.0.116"
-#define TREL_SIM_PORT 9200
-
-#define TREL_MAX_PACKET_SIZE 1800
-
-#define TREL_MAX_PENDING_TX 64
-
-#define TREL_MAX_SERVICE_TXT_DATA_LEN 128
-
-typedef enum MessageType
-{
-    TREL_DATA_MESSAGE,
-    TREL_DNSSD_BROWSE_MESSAGE,
-    TREL_DNSSD_ADD_SERVICE_MESSAGE,
-    TREL_DNSSD_REMOVE_SERVICE_MESSAGE,
-} MessageType;
-
-typedef struct Message
-{
-    MessageType mType;
-    otSockAddr  mSockAddr;                   // Destination (when TREL_DATA_MESSAGE), or peer addr (when DNS-SD service)
-    uint16_t    mDataLength;                 // mData length
-    uint8_t     mData[TREL_MAX_PACKET_SIZE]; // TREL UDP packet (when TREL_DATA_MESSAGE), or service TXT data.
-} Message;
-
-static uint8_t sNumPendingTx = 0;
-static Message sPendingTx[TREL_MAX_PENDING_TX];
-
-static int      sTxFd       = -1;
-static int      sRxFd       = -1;
-static uint16_t sPortOffset = 0;
-static bool     sEnabled    = false;
-static uint16_t sUdpPort;
-
-static bool               sServiceRegistered = false;
-static uint16_t           sServicePort;
-static uint8_t            sServiceTxtLength;
-static char               sServiceTxtData[TREL_MAX_SERVICE_TXT_DATA_LEN];
-static otPlatTrelCounters sCounters;
-
-#if DEBUG_LOG
-static void dumpBuffer(const void *aBuffer, uint16_t aLength)
-{
-    const uint8_t *buffer = (const uint8_t *)aBuffer;
-    fprintf(stderr, "[ (len:%d) ", aLength);
-
-    while (aLength--)
-    {
-        fprintf(stderr, "%02x ", *buffer++);
-    }
-
-    fprintf(stderr, "]");
-}
-
-static const char *messageTypeToString(MessageType aType)
-{
-    const char *str = "unknown";
-
-    switch (aType)
-    {
-    case TREL_DATA_MESSAGE:
-        str = "data";
-        break;
-    case TREL_DNSSD_BROWSE_MESSAGE:
-        str = "browse";
-        break;
-    case TREL_DNSSD_ADD_SERVICE_MESSAGE:
-        str = "add-service";
-        break;
-    case TREL_DNSSD_REMOVE_SERVICE_MESSAGE:
-        str = "remove-service";
-        break;
-    }
-
-    return str;
-}
-#endif
-
-static void initFds(void)
-{
-    int                fd;
-    int                one = 1;
-    struct sockaddr_in sockaddr;
-    struct ip_mreqn    mreq;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-
-    otEXPECT_ACTION((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) != -1, perror("socket(sTxFd)"));
-
-    sUdpPort                 = (uint16_t)(TREL_SIM_PORT + sPortOffset + gNodeId);
-    sockaddr.sin_family      = AF_INET;
-    sockaddr.sin_port        = htons(sUdpPort);
-    sockaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
-
-    otEXPECT_ACTION(setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, &sockaddr.sin_addr, sizeof(sockaddr.sin_addr)) != -1,
-                    perror("setsockopt(sTxFd, IP_MULTICAST_IF)"));
-
-    otEXPECT_ACTION(setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &one, sizeof(one)) != -1,
-                    perror("setsockopt(sTxFd, IP_MULTICAST_LOOP)"));
-
-    otEXPECT_ACTION(bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) != -1, perror("bind(sTxFd)"));
-
-    // Tx fd is successfully initialized.
-    sTxFd = fd;
-
-    otEXPECT_ACTION((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) != -1, perror("socket(sRxFd)"));
-
-    otEXPECT_ACTION(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) != -1,
-                    perror("setsockopt(sRxFd, SO_REUSEADDR)"));
-    otEXPECT_ACTION(setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one)) != -1,
-                    perror("setsockopt(sRxFd, SO_REUSEPORT)"));
-
-    memset(&mreq, 0, sizeof(mreq));
-    inet_pton(AF_INET, TREL_SIM_GROUP, &mreq.imr_multiaddr);
-
-    // Always use loopback device to send simulation packets.
-    mreq.imr_address.s_addr = inet_addr("127.0.0.1");
-
-    otEXPECT_ACTION(setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, &mreq.imr_address, sizeof(mreq.imr_address)) != -1,
-                    perror("setsockopt(sRxFd, IP_MULTICAST_IF)"));
-    otEXPECT_ACTION(setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) != -1,
-                    perror("setsockopt(sRxFd, IP_ADD_MEMBERSHIP)"));
-
-    sockaddr.sin_family      = AF_INET;
-    sockaddr.sin_port        = htons((uint16_t)(TREL_SIM_PORT + sPortOffset));
-    sockaddr.sin_addr.s_addr = inet_addr(TREL_SIM_GROUP);
-
-    otEXPECT_ACTION(bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) != -1, perror("bind(sRxFd)"));
-
-    // Rx fd is successfully initialized.
-    sRxFd = fd;
-
-exit:
-    if (sRxFd == -1 || sTxFd == -1)
-    {
-        exit(EXIT_FAILURE);
-    }
-}
-
-static void deinitFds(void)
-{
-    if (sRxFd != -1)
-    {
-        close(sRxFd);
-    }
-
-    if (sTxFd != -1)
-    {
-        close(sTxFd);
-    }
-}
-
-static uint16_t getMessageSize(const Message *aMessage)
-{
-    return (uint16_t)(&aMessage->mData[aMessage->mDataLength] - (const uint8_t *)aMessage);
-}
-
-static void sendPendingTxMessages(void)
-{
-    ssize_t            rval;
-    struct sockaddr_in sockaddr;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-    sockaddr.sin_family = AF_INET;
-    inet_pton(AF_INET, TREL_SIM_GROUP, &sockaddr.sin_addr);
-
-    sockaddr.sin_port = htons((uint16_t)(TREL_SIM_PORT + sPortOffset));
-
-    for (uint8_t i = 0; i < sNumPendingTx; i++)
-    {
-        uint16_t size = getMessageSize(&sPendingTx[i]);
-
-#if DEBUG_LOG
-        fprintf(stderr, "\r\n[trel-sim] Sending message (num:%d, type:%s, port:%u)\r\n", i,
-                messageTypeToString(sPendingTx[i].mType), sPendingTx[i].mSockAddr.mPort);
-#endif
-
-        rval = sendto(sTxFd, &sPendingTx[i], size, 0, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
-
-        if (rval < 0)
-        {
-            perror("sendto(sTxFd)");
-            exit(EXIT_FAILURE);
-        }
-    }
-
-    sNumPendingTx = 0;
-}
-
-static void sendBrowseMessage(void)
-{
-    Message *message;
-
-    assert(sNumPendingTx < TREL_MAX_PENDING_TX);
-    message = &sPendingTx[sNumPendingTx++];
-
-    message->mType       = TREL_DNSSD_BROWSE_MESSAGE;
-    message->mDataLength = 0;
-
-#if DEBUG_LOG
-    fprintf(stderr, "\r\n[trel-sim] sendBrowseMessage()\r\n");
-#endif
-}
-
-static void sendServiceMessage(MessageType aType)
-{
-    Message *message;
-
-    assert((aType == TREL_DNSSD_ADD_SERVICE_MESSAGE) || (aType == TREL_DNSSD_REMOVE_SERVICE_MESSAGE));
-
-    assert(sNumPendingTx < TREL_MAX_PENDING_TX);
-    message = &sPendingTx[sNumPendingTx++];
-
-    message->mType = aType;
-    memset(&message->mSockAddr, 0, sizeof(otSockAddr));
-    message->mSockAddr.mPort = sServicePort;
-    message->mDataLength     = sServiceTxtLength;
-    memcpy(message->mData, sServiceTxtData, sServiceTxtLength);
-
-#if DEBUG_LOG
-    fprintf(stderr, "\r\n[trel-sim] sendServiceMessage(%s): service-port:%u, txt-len:%u\r\n",
-            aType == TREL_DNSSD_ADD_SERVICE_MESSAGE ? "add" : "remove", sServicePort, sServiceTxtLength);
-#endif
-}
-
-static void processMessage(otInstance *aInstance, Message *aMessage, uint16_t aLength)
-{
-    otPlatTrelPeerInfo peerInfo;
-
-#if DEBUG_LOG
-    fprintf(stderr, "\r\n[trel-sim] processMessage(len:%u, type:%s, port:%u)\r\n", aLength,
-            messageTypeToString(aMessage->mType), aMessage->mSockAddr.mPort);
-#endif
-
-    otEXPECT(aLength > 0);
-    otEXPECT(getMessageSize(aMessage) == aLength);
-
-    switch (aMessage->mType)
-    {
-    case TREL_DATA_MESSAGE:
-        otEXPECT(aMessage->mSockAddr.mPort == sUdpPort);
-        otPlatTrelHandleReceived(aInstance, aMessage->mData, aMessage->mDataLength);
-        break;
-
-    case TREL_DNSSD_BROWSE_MESSAGE:
-        sendServiceMessage(TREL_DNSSD_ADD_SERVICE_MESSAGE);
-        break;
-
-    case TREL_DNSSD_ADD_SERVICE_MESSAGE:
-    case TREL_DNSSD_REMOVE_SERVICE_MESSAGE:
-        memset(&peerInfo, 0, sizeof(peerInfo));
-        peerInfo.mRemoved   = (aMessage->mType == TREL_DNSSD_REMOVE_SERVICE_MESSAGE);
-        peerInfo.mTxtData   = aMessage->mData;
-        peerInfo.mTxtLength = (uint8_t)(aMessage->mDataLength);
-        peerInfo.mSockAddr  = aMessage->mSockAddr;
-        otPlatTrelHandleDiscoveredPeerInfo(aInstance, &peerInfo);
-        break;
-    }
-
-exit:
-    return;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-// otPlatTrel
-
-void otPlatTrelEnable(otInstance *aInstance, uint16_t *aUdpPort)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    *aUdpPort = sUdpPort;
-
-#if DEBUG_LOG
-    fprintf(stderr, "\r\n[trel-sim] otPlatTrelEnable() *aUdpPort=%u\r\n", *aUdpPort);
-#endif
-
-    if (!sEnabled)
-    {
-        sEnabled = true;
-        sendBrowseMessage();
-    }
-}
-
-void otPlatTrelDisable(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-#if DEBUG_LOG
-    fprintf(stderr, "\r\n[trel-sim] otPlatTrelDisable()\r\n");
-#endif
-
-    if (sEnabled)
-    {
-        sEnabled = false;
-
-        if (sServiceRegistered)
-        {
-            sendServiceMessage(TREL_DNSSD_REMOVE_SERVICE_MESSAGE);
-            sServiceRegistered = false;
-        }
-    }
-}
-
-void otPlatTrelRegisterService(otInstance *aInstance, uint16_t aPort, const uint8_t *aTxtData, uint8_t aTxtLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    assert(aTxtLength <= TREL_MAX_SERVICE_TXT_DATA_LEN);
-
-    if (sServiceRegistered)
-    {
-        sendServiceMessage(TREL_DNSSD_REMOVE_SERVICE_MESSAGE);
-    }
-
-    sServiceRegistered = true;
-    sServicePort       = aPort;
-    sServiceTxtLength  = aTxtLength;
-    memcpy(sServiceTxtData, aTxtData, aTxtLength);
-
-    sendServiceMessage(TREL_DNSSD_ADD_SERVICE_MESSAGE);
-
-#if DEBUG_LOG
-    fprintf(stderr, "\r\n[trel-sim] otPlatTrelRegisterService(aPort:%d, aTxtData:", aPort);
-    dumpBuffer(aTxtData, aTxtLength);
-    fprintf(stderr, ")\r\n");
-#endif
-}
-
-void otPlatTrelSend(otInstance       *aInstance,
-                    const uint8_t    *aUdpPayload,
-                    uint16_t          aUdpPayloadLen,
-                    const otSockAddr *aDestSockAddr)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    Message *message;
-
-    assert(sNumPendingTx < TREL_MAX_PENDING_TX);
-    assert(aUdpPayloadLen <= TREL_MAX_PACKET_SIZE);
-
-    message = &sPendingTx[sNumPendingTx++];
-
-    message->mType       = TREL_DATA_MESSAGE;
-    message->mSockAddr   = *aDestSockAddr;
-    message->mDataLength = aUdpPayloadLen;
-    memcpy(message->mData, aUdpPayload, aUdpPayloadLen);
-
-#if DEBUG_LOG
-    fprintf(stderr, "\r\n[trel-sim] otPlatTrelSend(len:%u, port:%u)\r\n", aUdpPayloadLen, aDestSockAddr->mPort);
-#endif
-    ++sCounters.mTxPackets;
-    sCounters.mTxBytes += aUdpPayloadLen;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-// platformTrel system
-
-void platformTrelInit(uint32_t aSpeedUpFactor)
-{
-    char *str;
-
-    str = getenv("PORT_OFFSET");
-
-    if (str != NULL)
-    {
-        char *endptr;
-
-        sPortOffset = (uint16_t)strtol(str, &endptr, 0);
-
-        if (*endptr != '\0')
-        {
-            fprintf(stderr, "\r\nInvalid PORT_OFFSET: %s\r\n", str);
-            exit(EXIT_FAILURE);
-        }
-
-        sPortOffset *= (MAX_NETWORK_SIZE + 1);
-    }
-
-    initFds();
-
-    OT_UNUSED_VARIABLE(aSpeedUpFactor);
-}
-
-void platformTrelDeinit(void) { deinitFds(); }
-
-void platformTrelUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct timeval *aTimeout, int *aMaxFd)
-{
-    OT_UNUSED_VARIABLE(aTimeout);
-
-    // Always ready to receive
-    if (aReadFdSet != NULL)
-    {
-        FD_SET(sRxFd, aReadFdSet);
-
-        if (aMaxFd != NULL && *aMaxFd < sRxFd)
-        {
-            *aMaxFd = sRxFd;
-        }
-    }
-
-    if ((aWriteFdSet != NULL) && (sNumPendingTx > 0))
-    {
-        FD_SET(sTxFd, aWriteFdSet);
-
-        if (aMaxFd != NULL && *aMaxFd < sTxFd)
-        {
-            *aMaxFd = sTxFd;
-        }
-    }
-}
-
-void platformTrelProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet)
-{
-    if (FD_ISSET(sTxFd, aWriteFdSet) && (sNumPendingTx > 0))
-    {
-        sendPendingTxMessages();
-    }
-
-    if (FD_ISSET(sRxFd, aReadFdSet))
-    {
-        Message message;
-        ssize_t rval;
-
-        message.mDataLength = 0;
-
-        rval = recvfrom(sRxFd, (char *)&message, sizeof(message), 0, NULL, NULL);
-
-        if (rval < 0)
-        {
-            perror("recvfrom(sRxFd)");
-            exit(EXIT_FAILURE);
-        }
-
-        processMessage(aInstance, &message, (uint16_t)(rval));
-    }
-}
-
-const otPlatTrelCounters *otPlatTrelGetCounters(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    return &sCounters;
-}
-
-void otPlatTrelResetCounters(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    memset(&sCounters, 0, sizeof(sCounters));
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-
-// This is added for RCP build to be built ok
-OT_TOOL_WEAK void otPlatTrelHandleReceived(otInstance *aInstance, uint8_t *aBuffer, uint16_t aLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aBuffer);
-    OT_UNUSED_VARIABLE(aLength);
-
-    assert(false);
-}
-
-OT_TOOL_WEAK void otPlatTrelHandleDiscoveredPeerInfo(otInstance *aInstance, const otPlatTrelPeerInfo *aInfo)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aInfo);
-
-    assert(false);
-}
-
-#endif // OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
diff --git a/examples/platforms/simulation/uart.c b/examples/platforms/simulation/uart.c
deleted file mode 100644
index fe3fceb..0000000
--- a/examples/platforms/simulation/uart.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <termios.h>
-#include <unistd.h>
-
-#include <openthread/platform/debug_uart.h>
-
-#include "utils/code_utils.h"
-#include "utils/uart.h"
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART == 0
-
-static uint8_t        s_receive_buffer[128];
-static const uint8_t *s_write_buffer;
-static uint16_t       s_write_length;
-static int            s_in_fd;
-static int            s_out_fd;
-
-static struct termios original_stdin_termios;
-static struct termios original_stdout_termios;
-
-static void restore_stdin_termios(void) { tcsetattr(s_in_fd, TCSAFLUSH, &original_stdin_termios); }
-
-static void restore_stdout_termios(void) { tcsetattr(s_out_fd, TCSAFLUSH, &original_stdout_termios); }
-
-void platformUartRestore(void)
-{
-    restore_stdin_termios();
-    restore_stdout_termios();
-    dup2(s_out_fd, STDOUT_FILENO);
-}
-
-otError otPlatUartEnable(void)
-{
-    otError        error = OT_ERROR_NONE;
-    struct termios termios;
-
-    s_in_fd  = dup(STDIN_FILENO);
-    s_out_fd = dup(STDOUT_FILENO);
-    dup2(STDERR_FILENO, STDOUT_FILENO);
-
-    // We need this signal to make sure that this
-    // process terminates properly.
-    signal(SIGPIPE, SIG_DFL);
-
-    if (isatty(s_in_fd))
-    {
-        tcgetattr(s_in_fd, &original_stdin_termios);
-        atexit(&restore_stdin_termios);
-    }
-
-    if (isatty(s_out_fd))
-    {
-        tcgetattr(s_out_fd, &original_stdout_termios);
-        atexit(&restore_stdout_termios);
-    }
-
-    if (isatty(s_in_fd))
-    {
-        // get current configuration
-        otEXPECT_ACTION(tcgetattr(s_in_fd, &termios) == 0, perror("tcgetattr"); error = OT_ERROR_GENERIC);
-
-        // Set up the termios settings for raw mode. This turns
-        // off input/output processing, line processing, and character processing.
-        cfmakeraw(&termios);
-
-        // Set up our cflags for local use. Turn on hangup-on-close.
-        termios.c_cflag |= HUPCL | CREAD | CLOCAL;
-
-        // "Minimum number of characters for noncanonical read"
-        termios.c_cc[VMIN] = 1;
-
-        // "Timeout in deciseconds for noncanonical read"
-        termios.c_cc[VTIME] = 0;
-
-        // configure baud rate
-        otEXPECT_ACTION(cfsetispeed(&termios, OPENTHREAD_SIMULATION_UART_BAUDRATE) == 0, perror("cfsetispeed");
-                        error = OT_ERROR_GENERIC);
-
-        // set configuration
-        otEXPECT_ACTION(tcsetattr(s_in_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC);
-    }
-
-    if (isatty(s_out_fd))
-    {
-        // get current configuration
-        otEXPECT_ACTION(tcgetattr(s_out_fd, &termios) == 0, perror("tcgetattr"); error = OT_ERROR_GENERIC);
-
-        // Set up the termios settings for raw mode. This turns
-        // off input/output processing, line processing, and character processing.
-        cfmakeraw(&termios);
-
-        // Absolutely obliterate all output processing.
-        termios.c_oflag = 0;
-
-        // Set up our cflags for local use. Turn on hangup-on-close.
-        termios.c_cflag |= HUPCL | CREAD | CLOCAL;
-
-        // configure baud rate
-        otEXPECT_ACTION(cfsetospeed(&termios, OPENTHREAD_SIMULATION_UART_BAUDRATE) == 0, perror("cfsetospeed");
-                        error = OT_ERROR_GENERIC);
-
-        // set configuration
-        otEXPECT_ACTION(tcsetattr(s_out_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC);
-    }
-
-    return error;
-
-exit:
-    close(s_in_fd);
-    close(s_out_fd);
-    return error;
-}
-
-otError otPlatUartDisable(void)
-{
-    otError error = OT_ERROR_NONE;
-
-    close(s_in_fd);
-    close(s_out_fd);
-
-    return error;
-}
-
-otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
-{
-    otError error = OT_ERROR_NONE;
-
-    otEXPECT_ACTION(s_write_length == 0, error = OT_ERROR_BUSY);
-
-    s_write_buffer = aBuf;
-    s_write_length = aBufLength;
-
-exit:
-    return error;
-}
-
-void platformUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, fd_set *aErrorFdSet, int *aMaxFd)
-{
-    if (aReadFdSet != NULL)
-    {
-        FD_SET(s_in_fd, aReadFdSet);
-
-        if (aErrorFdSet != NULL)
-        {
-            FD_SET(s_in_fd, aErrorFdSet);
-        }
-
-        if (aMaxFd != NULL && *aMaxFd < s_in_fd)
-        {
-            *aMaxFd = s_in_fd;
-        }
-    }
-
-    if ((aWriteFdSet != NULL) && (s_write_length > 0))
-    {
-        FD_SET(s_out_fd, aWriteFdSet);
-
-        if (aErrorFdSet != NULL)
-        {
-            FD_SET(s_out_fd, aErrorFdSet);
-        }
-
-        if (aMaxFd != NULL && *aMaxFd < s_out_fd)
-        {
-            *aMaxFd = s_out_fd;
-        }
-    }
-}
-
-otError otPlatUartFlush(void)
-{
-    otError error = OT_ERROR_NONE;
-    ssize_t count;
-
-    otEXPECT_ACTION(s_write_buffer != NULL && s_write_length > 0, error = OT_ERROR_INVALID_STATE);
-
-    while ((count = write(s_out_fd, s_write_buffer, s_write_length)) > 0 && (s_write_length -= count) > 0)
-    {
-        s_write_buffer += count;
-    }
-
-    if (count != -1)
-    {
-        assert(s_write_length == 0);
-        s_write_buffer = NULL;
-    }
-    else
-    {
-        perror("write(UART)");
-        exit(EXIT_FAILURE);
-    }
-
-exit:
-    return error;
-}
-
-void platformUartProcess(void)
-{
-    ssize_t       rval;
-    const int     error_flags = POLLERR | POLLNVAL | POLLHUP;
-    struct pollfd pollfd[]    = {
-           {s_in_fd, POLLIN | error_flags, 0},
-           {s_out_fd, POLLOUT | error_flags, 0},
-    };
-
-    errno = 0;
-
-    rval = poll(pollfd, sizeof(pollfd) / sizeof(*pollfd), 0);
-
-    if (rval < 0)
-    {
-        perror("poll");
-        exit(EXIT_FAILURE);
-    }
-
-    if (rval > 0)
-    {
-        if ((pollfd[0].revents & error_flags) != 0)
-        {
-            perror("s_in_fd");
-            exit(EXIT_FAILURE);
-        }
-
-        if ((pollfd[1].revents & error_flags) != 0)
-        {
-            perror("s_out_fd");
-            exit(EXIT_FAILURE);
-        }
-
-        if (pollfd[0].revents & POLLIN)
-        {
-            rval = read(s_in_fd, s_receive_buffer, sizeof(s_receive_buffer));
-
-            if (rval <= 0)
-            {
-                perror("read");
-                exit(EXIT_FAILURE);
-            }
-
-            otPlatUartReceived(s_receive_buffer, (uint16_t)rval);
-        }
-
-        if ((s_write_length > 0) && (pollfd[1].revents & POLLOUT))
-        {
-            rval = write(s_out_fd, s_write_buffer, s_write_length);
-
-            if (rval >= 0)
-            {
-                s_write_buffer += (uint16_t)rval;
-                s_write_length -= (uint16_t)rval;
-
-                if (s_write_length == 0)
-                {
-                    otPlatUartSendDone();
-                }
-            }
-            else if (errno != EINTR)
-            {
-                perror("write");
-                exit(EXIT_FAILURE);
-            }
-        }
-    }
-}
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART == 0
-
-#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART && (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART)
-
-static FILE *posix_logfile;
-
-otError otPlatDebugUart_logfile(const char *filename)
-{
-    posix_logfile = fopen(filename, "wt");
-
-    return posix_logfile ? OT_ERROR_NONE : OT_ERROR_FAILED;
-}
-
-void otPlatDebugUart_putchar_raw(int c)
-{
-    FILE *fp;
-
-    /* note: log file will have a mix of cr/lf and
-     * in some/many cases duplicate cr because in
-     * some cases the log function {ie: Mbed} already
-     * includes the CR or LF... but other log functions
-     * do not include cr/lf and expect it appended
-     */
-    fp = posix_logfile;
-
-    if (fp != NULL)
-    {
-        /* log is lost ... until a file is setup */
-        fputc(c, fp);
-        /* we could "fflush" but will not */
-    }
-}
-
-int otPlatDebugUart_kbhit(void)
-{
-    /* not supported */
-    return 0;
-}
-
-int otPlatDebugUart_getc(void)
-{
-    /* not supported */
-    return -1;
-}
-
-#endif
diff --git a/examples/platforms/simulation/virtual_time/alarm-sim.c b/examples/platforms/simulation/virtual_time/alarm-sim.c
deleted file mode 100644
index 7c2cea1..0000000
--- a/examples/platforms/simulation/virtual_time/alarm-sim.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "platform-simulation.h"
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <openthread/platform/alarm-micro.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/diag.h>
-
-#define US_PER_MS 1000
-
-extern uint64_t sNow; // microseconds
-
-static bool     sIsMsRunning = false;
-static uint32_t sMsAlarm     = 0;
-
-static bool     sIsUsRunning = false;
-static uint32_t sUsAlarm     = 0;
-
-void platformAlarmInit(uint32_t aSpeedUpFactor)
-{
-    OT_UNUSED_VARIABLE(aSpeedUpFactor);
-
-    sNow = 0;
-}
-
-uint64_t platformAlarmGetNow(void) { return sNow; }
-
-void platformAlarmAdvanceNow(uint64_t aDelta) { sNow += aDelta; }
-
-uint32_t otPlatAlarmMilliGetNow(void) { return (uint32_t)(sNow / US_PER_MS); }
-
-void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sMsAlarm     = aT0 + aDt;
-    sIsMsRunning = true;
-}
-
-void otPlatAlarmMilliStop(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sIsMsRunning = false;
-}
-
-uint32_t otPlatAlarmMicroGetNow(void) { return (uint32_t)sNow; }
-
-void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sUsAlarm     = aT0 + aDt;
-    sIsUsRunning = true;
-}
-
-void otPlatAlarmMicroStop(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    sIsUsRunning = false;
-}
-
-uint64_t platformAlarmGetNext(void)
-{
-    uint64_t remaining = INT64_MAX;
-
-    if (sIsMsRunning)
-    {
-        int32_t milli = (int32_t)(sMsAlarm - otPlatAlarmMilliGetNow());
-
-        if (milli < 0)
-        {
-            remaining = 0;
-        }
-        else
-        {
-            remaining = (uint64_t)milli;
-            remaining *= US_PER_MS;
-        }
-    }
-
-#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
-    if (sIsUsRunning)
-    {
-        int32_t micro = (int32_t)(sUsAlarm - otPlatAlarmMicroGetNow());
-
-        if (micro < 0)
-        {
-            remaining = 0;
-        }
-        else if (remaining > ((uint64_t)micro))
-        {
-            remaining = (uint64_t)micro;
-        }
-    }
-#endif
-
-    return remaining;
-}
-
-void platformAlarmProcess(otInstance *aInstance)
-{
-    int32_t remaining;
-
-    if (sIsMsRunning)
-    {
-        remaining = (int32_t)(sMsAlarm - otPlatAlarmMilliGetNow());
-
-        if (remaining <= 0)
-        {
-            sIsMsRunning = false;
-
-#if OPENTHREAD_CONFIG_DIAG_ENABLE
-
-            if (otPlatDiagModeGet())
-            {
-                otPlatDiagAlarmFired(aInstance);
-            }
-            else
-#endif
-            {
-                otPlatAlarmMilliFired(aInstance);
-            }
-        }
-    }
-
-#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
-
-    if (sIsUsRunning)
-    {
-        remaining = (int32_t)(sUsAlarm - otPlatAlarmMicroGetNow());
-
-        if (remaining <= 0)
-        {
-            sIsUsRunning = false;
-
-            otPlatAlarmMicroFired(aInstance);
-        }
-    }
-
-#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
-}
-
-uint64_t otPlatTimeGet(void) { return platformAlarmGetNow(); }
-
-#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
-uint16_t otPlatTimeGetXtalAccuracy(void) { return 0; }
-#endif
-
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME
diff --git a/examples/platforms/simulation/virtual_time/platform-sim.c b/examples/platforms/simulation/virtual_time/platform-sim.c
deleted file mode 100644
index 1c2c818..0000000
--- a/examples/platforms/simulation/virtual_time/platform-sim.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- * @brief
- *   This file includes the platform-specific initializers.
- */
-
-#include "platform-simulation.h"
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
-
-#include <assert.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <libgen.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <syslog.h>
-
-#include <openthread/tasklet.h>
-#include <openthread/platform/alarm-milli.h>
-
-#include "utils/uart.h"
-
-uint32_t gNodeId = 1;
-
-extern bool          gPlatformPseudoResetWasRequested;
-static volatile bool gTerminate = false;
-
-int    gArgumentsCount = 0;
-char **gArguments      = NULL;
-
-uint64_t sNow = 0; // microseconds
-int      sSockFd;
-uint16_t sPortBase = 9000;
-uint16_t sPortOffset;
-
-static void handleSignal(int aSignal)
-{
-    OT_UNUSED_VARIABLE(aSignal);
-
-    gTerminate = true;
-}
-
-void otSimSendEvent(const struct Event *aEvent)
-{
-    ssize_t            rval;
-    struct sockaddr_in sockaddr;
-
-    memset(&sockaddr, 0, sizeof(sockaddr));
-    sockaddr.sin_family = AF_INET;
-    inet_pton(AF_INET, "127.0.0.1", &sockaddr.sin_addr);
-    sockaddr.sin_port = htons(sPortBase + sPortOffset);
-
-    rval = sendto(sSockFd, aEvent, offsetof(struct Event, mData) + aEvent->mDataLength, 0, (struct sockaddr *)&sockaddr,
-                  sizeof(sockaddr));
-
-    if (rval < 0)
-    {
-        perror("sendto");
-        exit(EXIT_FAILURE);
-    }
-}
-
-static void receiveEvent(otInstance *aInstance)
-{
-    struct Event event;
-    ssize_t      rval = recvfrom(sSockFd, (char *)&event, sizeof(event), 0, NULL, NULL);
-
-    if (rval < 0 || (uint16_t)rval < offsetof(struct Event, mData))
-    {
-        perror("recvfrom");
-        exit(EXIT_FAILURE);
-    }
-
-    platformAlarmAdvanceNow(event.mDelay);
-
-    switch (event.mEvent)
-    {
-    case OT_SIM_EVENT_ALARM_FIRED:
-        break;
-
-    case OT_SIM_EVENT_RADIO_RECEIVED:
-        platformRadioReceive(aInstance, event.mData, event.mDataLength);
-        break;
-
-    case OT_SIM_EVENT_UART_WRITE:
-        otPlatUartReceived(event.mData, event.mDataLength);
-        break;
-
-    default:
-        assert(false);
-    }
-}
-
-static void platformSendSleepEvent(void)
-{
-    struct Event event;
-
-    assert(platformAlarmGetNext() > 0);
-
-    event.mDelay      = platformAlarmGetNext();
-    event.mEvent      = OT_SIM_EVENT_ALARM_FIRED;
-    event.mDataLength = 0;
-
-    otSimSendEvent(&event);
-}
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
-void platformUartRestore(void) {}
-
-otError otPlatUartEnable(void) { return OT_ERROR_NONE; }
-
-otError otPlatUartDisable(void) { return OT_ERROR_NONE; }
-
-otError otPlatUartSend(const uint8_t *aData, uint16_t aLength)
-{
-    otError      error = OT_ERROR_NONE;
-    struct Event event;
-
-    event.mDelay      = 0;
-    event.mEvent      = OT_SIM_EVENT_UART_WRITE;
-    event.mDataLength = aLength;
-
-    memcpy(event.mData, aData, aLength);
-
-    otSimSendEvent(&event);
-
-    otPlatUartSendDone();
-
-    return error;
-}
-
-otError otPlatUartFlush(void) { return OT_ERROR_NONE; }
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART
-
-static void socket_init(void)
-{
-    struct sockaddr_in sockaddr;
-    memset(&sockaddr, 0, sizeof(sockaddr));
-    sockaddr.sin_family = AF_INET;
-
-    parseFromEnvAsUint16("PORT_BASE", &sPortBase);
-
-    parseFromEnvAsUint16("PORT_OFFSET", &sPortOffset);
-    sPortOffset *= (MAX_NETWORK_SIZE + 1);
-
-    sockaddr.sin_port        = htons((uint16_t)(sPortBase + sPortOffset + gNodeId));
-    sockaddr.sin_addr.s_addr = INADDR_ANY;
-
-    sSockFd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
-
-    if (sSockFd == -1)
-    {
-        perror("socket");
-        exit(EXIT_FAILURE);
-    }
-
-    if (bind(sSockFd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) == -1)
-    {
-        perror("bind");
-        exit(EXIT_FAILURE);
-    }
-}
-
-void otSysInit(int argc, char *argv[])
-{
-    char *endptr;
-
-    if (gPlatformPseudoResetWasRequested)
-    {
-        gPlatformPseudoResetWasRequested = false;
-        return;
-    }
-
-    if (argc != 2)
-    {
-        exit(EXIT_FAILURE);
-    }
-
-    openlog(basename(argv[0]), LOG_PID, LOG_USER);
-    setlogmask(setlogmask(0) & LOG_UPTO(LOG_NOTICE));
-
-    gArgumentsCount = argc;
-    gArguments      = argv;
-
-    gNodeId = (uint32_t)strtol(argv[1], &endptr, 0);
-
-    if (*endptr != '\0' || gNodeId < 1 || gNodeId > MAX_NETWORK_SIZE)
-    {
-        fprintf(stderr, "Invalid NodeId: %s\n", argv[1]);
-        exit(EXIT_FAILURE);
-    }
-
-    socket_init();
-
-    platformAlarmInit(1);
-    platformRadioInit();
-    platformRandomInit();
-
-    signal(SIGTERM, &handleSignal);
-    signal(SIGHUP, &handleSignal);
-}
-
-bool otSysPseudoResetWasRequested(void) { return gPlatformPseudoResetWasRequested; }
-
-void otSysDeinit(void) { close(sSockFd); }
-
-void otSysProcessDrivers(otInstance *aInstance)
-{
-    fd_set read_fds;
-    fd_set write_fds;
-    fd_set error_fds;
-    int    max_fd = -1;
-    int    rval;
-
-    if (gTerminate)
-    {
-        exit(0);
-    }
-
-    FD_ZERO(&read_fds);
-    FD_ZERO(&write_fds);
-    FD_ZERO(&error_fds);
-
-    FD_SET(sSockFd, &read_fds);
-    max_fd = sSockFd;
-
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART == 0
-    platformUartUpdateFdSet(&read_fds, &write_fds, &error_fds, &max_fd);
-#endif
-
-    if (!otTaskletsArePending(aInstance) && platformAlarmGetNext() > 0 && !platformRadioIsTransmitPending())
-    {
-        platformSendSleepEvent();
-
-        rval = select(max_fd + 1, &read_fds, &write_fds, &error_fds, NULL);
-
-        if ((rval < 0) && (errno != EINTR))
-        {
-            perror("select");
-            exit(EXIT_FAILURE);
-        }
-
-        if (rval > 0 && FD_ISSET(sSockFd, &read_fds))
-        {
-            receiveEvent(aInstance);
-        }
-    }
-
-    platformAlarmProcess(aInstance);
-    platformRadioProcess(aInstance, &read_fds, &write_fds);
-#if OPENTHREAD_SIMULATION_VIRTUAL_TIME_UART == 0
-    platformUartProcess();
-#endif
-}
-
-#if OPENTHREAD_CONFIG_OTNS_ENABLE
-
-void otPlatOtnsStatus(const char *aStatus)
-{
-    struct Event event;
-    uint16_t     statusLength = (uint16_t)strlen(aStatus);
-
-    assert(statusLength < sizeof(event.mData));
-
-    memcpy(event.mData, aStatus, statusLength);
-    event.mDataLength = statusLength;
-    event.mDelay      = 0;
-    event.mEvent      = OT_SIM_EVENT_OTNS_STATUS_PUSH;
-
-    otSimSendEvent(&event);
-}
-
-#endif // OPENTHREAD_CONFIG_OTNS_ENABLE
-
-#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME
diff --git a/examples/platforms/utils/CMakeLists.txt b/examples/platforms/utils/CMakeLists.txt
deleted file mode 100644
index 3e4a680..0000000
--- a/examples/platforms/utils/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-#  Copyright (c) 2019, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-add_library(openthread-platform-utils OBJECT
-    debug_uart.c
-    link_metrics.cpp
-    logging_rtt.c
-    mac_frame.cpp
-    otns_utils.cpp
-    settings_ram.c
-    soft_source_match_table.c
-    uart_rtt.c
-)
-
-target_compile_definitions(openthread-platform-utils PRIVATE
-    $<TARGET_PROPERTY:ot-config,INTERFACE_COMPILE_DEFINITIONS>
-)
-
-if(OT_RTT_UART)
-    target_compile_definitions(openthread-platform-utils PRIVATE
-        OPENTHREAD_UART_RTT_ENABLE=1
-    )
-endif()
-
-target_include_directories(openthread-platform-utils PRIVATE
-    ${OT_PUBLIC_INCLUDES}
-    $<TARGET_PROPERTY:ot-config,INTERFACE_INCLUDE_DIRECTORIES>
-    ${PROJECT_SOURCE_DIR}/examples/platforms
-    ${PROJECT_SOURCE_DIR}/examples/platforms/utils
-    ${PROJECT_SOURCE_DIR}/third_party/jlink/SEGGER_RTT_V640/RTT
-)
-
-# Provide a static library implementation of platform-utils for non-cmake platforms
-add_library(openthread-platform-utils-static $<TARGET_OBJECTS:openthread-platform-utils>)
diff --git a/examples/platforms/utils/code_utils.h b/examples/platforms/utils/code_utils.h
deleted file mode 100644
index d9ed6a2..0000000
--- a/examples/platforms/utils/code_utils.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  Copyright (c) 2017, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- *   This file includes macros for validating runtime conditions.
- */
-
-#ifndef CODE_UTILS_H
-#define CODE_UTILS_H
-
-/**
- *  This checks for the specified condition, which is expected to
- *  commonly be true, and branches to the local label 'exit' if the
- *  condition is false.
- *
- *  @param[in]  aCondition  A Boolean expression to be evaluated.
- *
- */
-#define otEXPECT(aCondition) \
-    do                       \
-    {                        \
-        if (!(aCondition))   \
-        {                    \
-            goto exit;       \
-        }                    \
-    } while (0)
-
-/**
- *  This checks for the specified condition, which is expected to
- *  commonly be true, and both executes @p anAction and branches to
- *  the local label 'exit' if the condition is false.
- *
- *  @param[in]  aCondition  A Boolean expression to be evaluated.
- *  @param[in]  aAction     An expression or block to execute when the
- *                          assertion fails.
- *
- */
-#define otEXPECT_ACTION(aCondition, aAction) \
-    do                                       \
-    {                                        \
-        if (!(aCondition))                   \
-        {                                    \
-            aAction;                         \
-            goto exit;                       \
-        }                                    \
-    } while (0)
-
-/**
- * Calculates the number of elements in an array.
- *
- * @param[in] aArray  Name of the array variable.
- *
- * @returns Number of elements in the array.
- *
- */
-#define otARRAY_LENGTH(aArray) (sizeof(aArray) / sizeof(aArray[0]))
-
-#endif // CODE_UTILS_H
diff --git a/examples/platforms/utils/debug_uart.c b/examples/platforms/utils/debug_uart.c
deleted file mode 100644
index 169c65d..0000000
--- a/examples/platforms/utils/debug_uart.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *  Copyright (c) 2017, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-#include <openthread-core-config.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <openthread/config.h>
-
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/debug_uart.h>
-#include <openthread/platform/toolchain.h>
-
-/*
- * Implementation note:
- *   These are all "weak" so that a platform may if it chooses  override the instance.
- */
-
-OT_TOOL_WEAK
-void otPlatDebugUart_printf(const char *fmt, ...)
-{
-    va_list ap;
-    va_start(ap, fmt);
-    otPlatDebugUart_vprintf(fmt, ap);
-    va_end(ap);
-}
-
-OT_TOOL_WEAK
-void otPlatDebugUart_vprintf(const char *fmt, va_list ap)
-{
-    char buf[128];
-    /* by standard ...
-     * vsnprintf() always null terminates
-     */
-    vsnprintf(buf, sizeof(buf), fmt, ap);
-    /* however ... some platforms have bugs */
-    buf[sizeof(buf) - 1] = 0;
-    otPlatDebugUart_puts_no_nl(buf);
-}
-
-OT_TOOL_WEAK
-void otPlatDebugUart_write_bytes(const uint8_t *pBytes, int nBytes)
-{
-    while (nBytes > 0)
-    {
-        otPlatDebugUart_putchar((int)(*pBytes));
-        pBytes++;
-        nBytes--;
-    }
-}
-
-OT_TOOL_WEAK
-void otPlatDebugUart_puts_no_nl(const char *s)
-{
-    while (*s)
-    {
-        otPlatDebugUart_putchar(*s);
-        s++;
-    }
-}
-
-OT_TOOL_WEAK
-void otPlatDebugUart_puts(const char *s)
-{
-    otPlatDebugUart_puts_no_nl(s);
-    otPlatDebugUart_putchar('\n');
-}
-
-OT_TOOL_WEAK
-void otPlatDebugUart_putchar(int c)
-{
-    /* map lf to crlf as needed */
-    if (c == '\n')
-    {
-        otPlatDebugUart_putchar_raw('\r');
-    }
-
-    otPlatDebugUart_putchar_raw(c);
-}
-
-/* provide WEAK stubs for platforms that do not implement all functions */
-OT_TOOL_WEAK
-void otPlatDebugUart_putchar_raw(int c) { OT_UNUSED_VARIABLE(c); }
-
-OT_TOOL_WEAK
-int otPlatDebugUart_kbhit(void) { return 0; /* nothing */ }
-
-OT_TOOL_WEAK
-int otPlatDebugUart_getc(void) { return -1; /* nothing */ }
-
-OT_TOOL_WEAK
-otError otPlatDebugUart_logfile(const char *filename)
-{
-    OT_UNUSED_VARIABLE(filename);
-
-    return OT_ERROR_FAILED;
-}
-
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART)
-/* this should not be a WEAK function */
-void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
-{
-    OT_UNUSED_VARIABLE(aLogLevel);
-    OT_UNUSED_VARIABLE(aLogRegion);
-
-    va_list  ap;
-    uint32_t now;
-
-    now = otPlatAlarmMilliGetNow();
-    otPlatDebugUart_printf("%3d.%03d | ", (int)(now / 1000), (int)(now % 1000));
-    va_start(ap, aFormat);
-    otPlatDebugUart_vprintf(aFormat, ap);
-    va_end(ap);
-
-    otPlatDebugUart_putchar('\n');
-}
-#endif
diff --git a/examples/platforms/utils/encoding.h b/examples/platforms/utils/encoding.h
deleted file mode 100644
index 55e3f43..0000000
--- a/examples/platforms/utils/encoding.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- *   This file includes macros for validating runtime conditions.
- */
-
-#ifndef PLATFORM_UTILS_ENCODING_H
-#define PLATFORM_UTILS_ENCODING_H
-
-#include <stdint.h>
-
-/**
- * Converts a 64-bit unsigned integer stored as a little-endian byte
- * array to uint64_t.
- *
- * Allows for the array to be byte-aligned, so that loading the
- * uint64_t value via this function avoids a processor exception due
- * to unaligned access.
- *
- * @param[in]  aSource  The byte array.
- *
- * @returns The 64-bit value as a uint64_t.
- *
- */
-static inline uint64_t otEncodingReadUint64Le(const uint8_t *aSource)
-{
-    uint64_t value = 0;
-
-    value |= (uint64_t)aSource[0];
-    value |= ((uint64_t)aSource[1]) << 8;
-    value |= ((uint64_t)aSource[2]) << 16;
-    value |= ((uint64_t)aSource[3]) << 24;
-    value |= ((uint64_t)aSource[4]) << 32;
-    value |= ((uint64_t)aSource[5]) << 40;
-    value |= ((uint64_t)aSource[6]) << 48;
-    value |= ((uint64_t)aSource[7]) << 56;
-
-    return value;
-}
-
-#endif // PLATFORM_UTILS_ENCODING_H
diff --git a/examples/platforms/utils/link_metrics.cpp b/examples/platforms/utils/link_metrics.cpp
deleted file mode 100644
index 301fc08..0000000
--- a/examples/platforms/utils/link_metrics.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "link_metrics.h"
-
-#include <openthread/link_metrics.h>
-
-#include "common/clearable.hpp"
-#include "common/linked_list.hpp"
-#include "common/pool.hpp"
-#include "thread/link_quality.hpp"
-
-#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE || OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
-
-using namespace ot;
-
-static int8_t sNoiseFloor; ///< The noise floor used by Link Metrics. It should be set to the platform's
-                           ///< noise floor (measured noise floor, receiver sensitivity or a constant).
-
-class LinkMetricsDataInfo : public LinkedListEntry<LinkMetricsDataInfo>, public Clearable<LinkMetricsDataInfo>
-{
-    friend class LinkedList<LinkMetricsDataInfo>;
-    friend class LinkedListEntry<LinkMetricsDataInfo>;
-
-public:
-    /**
-     * Constructor.
-     *
-     */
-    LinkMetricsDataInfo(void) { Clear(); };
-
-    /**
-     * Set the information for this object.
-     *
-     * @param[in]  aLinkMetrics     Flags specifying what metrics to query.
-     * @param[in]  aShortAddress    Short Address of the Probing Initiator tracked by this object.
-     * @param[in]  aExtAddress      A reference to the Extended Address of the Probing Initiator tracked by this
-     *                              object.
-     *
-     */
-    void Set(otLinkMetrics aLinkMetrics, otShortAddress aShortAddress, const otExtAddress &aExtAddress)
-    {
-        mLinkMetrics  = aLinkMetrics;
-        mShortAddress = aShortAddress;
-        memcpy(mExtAddress.m8, aExtAddress.m8, sizeof(aExtAddress));
-    }
-
-    /**
-     * Gets Link Metrics data stored in this object.
-     *
-     * TODO: Currently the order of Link Metircs data is fixed. Will update it to follow the order specified in TLV.
-     *
-     * @param[in]   aLqi     LQI value of the acknowledeged frame.
-     * @param[in]   aRssi    RSSI value of the acknowledged frame.
-     * @param[out]  aData    A pointer to the output buffer. @p aData MUST NOT be `nullptr`. The buffer must have
-     *                       at least 2 bytes (per spec 4.11.3.4.4.6). Otherwise the behavior would be undefined.
-     *
-     * @returns  The number of bytes written. `0` on failure.
-     *
-     */
-    uint8_t GetEnhAckData(uint8_t aLqi, int8_t aRssi, uint8_t *aData) const
-    {
-        enum
-        {
-            kEnhAckProbingDataMaxLen = 2,
-        };
-
-        uint8_t bytes = 0;
-
-        VerifyOrExit(aData != nullptr);
-
-        if (mLinkMetrics.mLqi)
-        {
-            aData[bytes++] = aLqi;
-        }
-        if (mLinkMetrics.mLinkMargin)
-        {
-            aData[bytes++] = static_cast<uint8_t>(GetLinkMargin(aRssi) * 255 /
-                                                  130); // Linear scale Link Margin from [0, 130] to [0, 255]
-        }
-        if (bytes < kEnhAckProbingDataMaxLen && mLinkMetrics.mRssi)
-        {
-            aData[bytes++] =
-                static_cast<uint8_t>((aRssi + 130) * 255 / 130); // Linear scale RSSI from [-130, 0] to [0, 255]
-        }
-
-    exit:
-        return bytes;
-    }
-
-    /**
-     * Gets the length of Link Metrics Data.
-     *
-     * @returns  The number of bytes for the data.
-     *
-     */
-    uint8_t GetEnhAckDataLen() const
-    {
-        return static_cast<uint8_t>(mLinkMetrics.mLqi) + static_cast<uint8_t>(mLinkMetrics.mLinkMargin) +
-               static_cast<uint8_t>(mLinkMetrics.mRssi);
-    }
-
-    /**
-     * Gets the metrics configured for the Enhanced-ACK Based Probing.
-     *
-     * @returns  The metrics configured.
-     *
-     */
-    otLinkMetrics GetLinkMetrics(void) const { return mLinkMetrics; }
-
-private:
-    uint8_t GetLinkMargin(int8_t aRssi) const { return ComputeLinkMargin(sNoiseFloor, aRssi); }
-
-    bool Matches(const otShortAddress &aShortAddress) const { return mShortAddress == aShortAddress; };
-
-    bool Matches(const otExtAddress &aExtAddress) const
-    {
-        return memcmp(&mExtAddress, &aExtAddress, sizeof(otExtAddress)) == 0;
-    };
-
-    LinkMetricsDataInfo *mNext;
-
-    otLinkMetrics mLinkMetrics;
-
-    otShortAddress mShortAddress;
-    otExtAddress   mExtAddress;
-};
-
-enum
-{
-    kMaxEnhAckProbingInitiator = OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED,
-};
-
-typedef Pool<LinkMetricsDataInfo, kMaxEnhAckProbingInitiator> LinkMetricsDataInfoPool;
-
-typedef LinkedList<LinkMetricsDataInfo> LinkMetricsDataInfoList;
-
-static LinkMetricsDataInfoPool &GetLinkMetricsDataInfoPool(void)
-{
-    static LinkMetricsDataInfoPool sDataInfoPool;
-    return sDataInfoPool;
-}
-
-static LinkMetricsDataInfoList &GetLinkMetricsDataInfoActiveList(void)
-{
-    static LinkMetricsDataInfoList sDataInfoActiveList;
-    return sDataInfoActiveList;
-}
-
-static inline bool IsLinkMetricsClear(otLinkMetrics aLinkMetrics)
-{
-    return !aLinkMetrics.mPduCount && !aLinkMetrics.mLqi && !aLinkMetrics.mLinkMargin && !aLinkMetrics.mRssi;
-}
-
-void otLinkMetricsInit(int8_t aNoiseFloor) { sNoiseFloor = aNoiseFloor; }
-
-otError otLinkMetricsConfigureEnhAckProbing(otShortAddress      aShortAddress,
-                                            const otExtAddress *aExtAddress,
-                                            otLinkMetrics       aLinkMetrics)
-{
-    otError              error    = OT_ERROR_NONE;
-    LinkMetricsDataInfo *dataInfo = nullptr;
-
-    VerifyOrExit(aExtAddress != nullptr, error = OT_ERROR_INVALID_ARGS);
-
-    if (IsLinkMetricsClear(aLinkMetrics)) ///< Remove the entry
-    {
-        dataInfo = GetLinkMetricsDataInfoActiveList().RemoveMatching(aShortAddress);
-        VerifyOrExit(dataInfo != nullptr, error = OT_ERROR_NOT_FOUND);
-        GetLinkMetricsDataInfoPool().Free(*dataInfo);
-    }
-    else
-    {
-        dataInfo = GetLinkMetricsDataInfoActiveList().FindMatching(aShortAddress);
-
-        if (dataInfo == nullptr)
-        {
-            dataInfo = GetLinkMetricsDataInfoPool().Allocate();
-            VerifyOrExit(dataInfo != nullptr, error = OT_ERROR_NO_BUFS);
-            dataInfo->Clear();
-            GetLinkMetricsDataInfoActiveList().Push(*dataInfo);
-        }
-
-        // Overwrite the previous configuration if it already existed.
-        dataInfo->Set(aLinkMetrics, aShortAddress, *aExtAddress);
-    }
-
-exit:
-    return error;
-}
-
-LinkMetricsDataInfo *GetLinkMetricsInfoByMacAddress(const otMacAddress *aMacAddress)
-{
-    LinkMetricsDataInfo *dataInfo = nullptr;
-
-    VerifyOrExit(aMacAddress != nullptr);
-
-    if (aMacAddress->mType == OT_MAC_ADDRESS_TYPE_SHORT)
-    {
-        dataInfo = GetLinkMetricsDataInfoActiveList().FindMatching(aMacAddress->mAddress.mShortAddress);
-    }
-    else if (aMacAddress->mType == OT_MAC_ADDRESS_TYPE_EXTENDED)
-    {
-        dataInfo = GetLinkMetricsDataInfoActiveList().FindMatching(aMacAddress->mAddress.mExtAddress);
-    }
-
-exit:
-    return dataInfo;
-}
-
-uint8_t otLinkMetricsEnhAckGenData(const otMacAddress *aMacAddress, uint8_t aLqi, int8_t aRssi, uint8_t *aData)
-{
-    uint8_t              bytes    = 0;
-    LinkMetricsDataInfo *dataInfo = GetLinkMetricsInfoByMacAddress(aMacAddress);
-
-    VerifyOrExit(dataInfo != nullptr);
-
-    bytes = dataInfo->GetEnhAckData(aLqi, aRssi, aData);
-
-exit:
-    return bytes;
-}
-
-uint8_t otLinkMetricsEnhAckGetDataLen(const otMacAddress *aMacAddress)
-{
-    uint8_t              len      = 0;
-    LinkMetricsDataInfo *dataInfo = GetLinkMetricsInfoByMacAddress(aMacAddress);
-
-    VerifyOrExit(dataInfo != nullptr);
-    len = dataInfo->GetEnhAckDataLen();
-
-exit:
-    return len;
-}
-#endif // OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE || OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
diff --git a/examples/platforms/utils/link_metrics.h b/examples/platforms/utils/link_metrics.h
deleted file mode 100644
index 1cde18b..0000000
--- a/examples/platforms/utils/link_metrics.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *  Copyright (c) 2020, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- * @brief
- *   This file defines the link metrics interface for OpenThread platform radio drivers.
- *
- *   APIs defined in this module could be used by a platform to implement Enhanced-ACK Based Probing feature
- *   (Probing Subject side) in its radio driver.
- *
- */
-
-#ifndef OPENTHREAD_UTILS_LINK_METRICS_H
-#define OPENTHREAD_UTILS_LINK_METRICS_H
-
-#include <openthread/link_metrics.h>
-
-#include "mac_frame.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Initializes the Link Metrics util module.
- *
- * @param[in]  aNoiseFloor    The noise floor used by Link Metrics. It should be set to the platform's
- *                            noise floor (measured noise floor, receiver sensitivity or a constant).
- *
- */
-void otLinkMetricsInit(int8_t aNoiseFloor);
-
-/**
- * Sets/clears Enhanced-ACK Based Probing for a specific Initiator.
- *
- * Can start/stop Enhanced-ACK Based Probing for a neighbor that has the address @p aShortAddress and
- * @p aExtAddress. Once the Probing is started, the device would record the Link Metrics data of link layer frames
- * sent from that neighbor and include the data into header IE in Enhanced-ACK sent to that neighbor.
- *
- * @param[in]  aShortAddress    The short address of the Initiator.
- * @param[in]  aExtAddress      A pointer to the extended address of the Initiator.
- * @param[in]  aLinkMetrics     Flags specifying what metrics to query (Pdu Count would be omitted). When
- *                              @p aLinkMetrics is equal to `0`, this method clears the Initiator.
- *
- * @retval  OT_ERROR_NONE            Successfully configured the Enhanced-ACK Based Probing.
- * @retval  OT_ERROR_INVALID_ARGS    @p aExtAddress is `nullptr`.
- * @retval  OT_ERROR_NOT_FOUND       The Initiator indicated by @p aShortAddress is not found when trying to clear.
- * @retval  OT_ERROR_NO_BUFS         No more Initiator can be supported.
- *
- */
-otError otLinkMetricsConfigureEnhAckProbing(otShortAddress      aShortAddress,
-                                            const otExtAddress *aExtAddress,
-                                            otLinkMetrics       aLinkMetrics);
-
-/**
- * Generates the Link Metrics data (assessed for the acknowledged frame) bytes that would be included in
- * Vendor-Specific IE.
- *
- * First checks what Link Metrics are specified by the Initiator indicated by @p aMacAddress. And then
- * write the values to @p aData.
- *
- * @param[in]  aMacAddress    The Mac address of the Initiator.
- * @param[in]  aLqi           LQI value of the acknowledged frame.
- * @param[in]  aRssi          RSSI value of the acknowledged frame.
- * @param[out] aData          A pointer to the buffer where the data would be written to. The caller should make
- *                            sure that the size of the buffer is not less than the size of Link Metrics data
- *                            configured before.
- *
- * @returns  The size of data read. Would be `0` if the Initiator is not found or @p aData is invalid.
- *
- */
-uint8_t otLinkMetricsEnhAckGenData(const otMacAddress *aMacAddress, uint8_t aLqi, int8_t aRssi, uint8_t *aData);
-
-/**
- * Returns the data length of Enhanced-ACK Based Probing for a specific Initiator.
- *
- * @param[in]  aMacAddress    The Mac address of the Initiator.
- *
- * @returns  The size of data. `0` if it's not configured for the Initiator.
- *
- */
-uint8_t otLinkMetricsEnhAckGetDataLen(const otMacAddress *aMacAddress);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // OPENTHREAD_UTILS_LINK_METRICS_H
diff --git a/examples/platforms/utils/logging_rtt.c b/examples/platforms/utils/logging_rtt.c
deleted file mode 100644
index 0c72051..0000000
--- a/examples/platforms/utils/logging_rtt.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- *   This file implements the OpenThread platform abstraction for logging.
- *
- */
-
-#include <openthread-core-config.h>
-#include <openthread/config.h>
-
-#include <utils/code_utils.h>
-#include <openthread/platform/alarm-milli.h>
-#include <openthread/platform/logging.h>
-
-#include "SEGGER_RTT.h"
-#include "logging_rtt.h"
-
-#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
-#if (LOG_RTT_COLOR_ENABLE == 1)
-#define RTT_COLOR_CODE_DEFAULT "\x1B[0m"
-#define RTT_COLOR_CODE_RED "\x1B[1;31m"
-#define RTT_COLOR_CODE_GREEN "\x1B[1;32m"
-#define RTT_COLOR_CODE_YELLOW "\x1B[1;33m"
-#define RTT_COLOR_CODE_CYAN "\x1B[1;36m"
-#else // LOG_RTT_COLOR_ENABLE == 1
-#define RTT_COLOR_CODE_DEFAULT ""
-#define RTT_COLOR_CODE_RED ""
-#define RTT_COLOR_CODE_GREEN ""
-#define RTT_COLOR_CODE_YELLOW ""
-#define RTT_COLOR_CODE_CYAN ""
-#endif // LOG_RTT_COLOR_ENABLE == 1
-
-static bool sLogInitialized = false;
-
-#if LOG_RTT_BUFFER_INDEX != 0
-static uint8_t sLogBuffer[LOG_RTT_BUFFER_SIZE];
-#endif
-
-/**
- * Function for getting color of a given level log.
- *
- * @param[in]  aLogLevel The log level.
- *
- * @returns  String with a log level color value.
- */
-static inline const char *levelToString(otLogLevel aLogLevel)
-{
-    switch (aLogLevel)
-    {
-    case OT_LOG_LEVEL_CRIT:
-        return RTT_COLOR_CODE_RED;
-
-    case OT_LOG_LEVEL_WARN:
-        return RTT_COLOR_CODE_YELLOW;
-
-    case OT_LOG_LEVEL_INFO:
-        return RTT_COLOR_CODE_GREEN;
-
-    case OT_LOG_LEVEL_DEBG:
-    default:
-        return RTT_COLOR_CODE_DEFAULT;
-    }
-}
-
-#if (LOG_TIMESTAMP_ENABLE == 1)
-/**
- * Function for printing actual timestamp.
- *
- * @param[in,out]  aLogString Pointer to the log buffer.
- * @param[in]      aMaxSize   Maximum size of the log buffer.
- *
- * @returns  Number of bytes successfully written to the log buffer.
- */
-static inline int logTimestamp(char *aLogString, uint16_t aMaxSize)
-{
-    long unsigned int now = otPlatAlarmMilliGetNow();
-    return snprintf(aLogString, (size_t)aMaxSize, "%s[%010lu]", RTT_COLOR_CODE_CYAN, now);
-}
-#endif
-
-/**
- * Function for printing log level.
- *
- * @param[in,out]  aLogString  Pointer to log buffer.
- * @param[in]      aMaxSize    Maximum size of log buffer.
- * @param[in]      aLogLevel   Log level.
- *
- * @returns  Number of bytes successfully written to the log buffer.
- */
-static inline int logLevel(char *aLogString, uint16_t aMaxSize, otLogLevel aLogLevel)
-{
-    return snprintf(aLogString, (size_t)aMaxSize, "%s ", levelToString(aLogLevel));
-}
-
-void utilsLogRttInit(void)
-{
-#if LOG_RTT_BUFFER_INDEX != 0
-    int res = SEGGER_RTT_ConfigUpBuffer(LOG_RTT_BUFFER_INDEX, LOG_RTT_BUFFER_NAME, sLogBuffer, LOG_RTT_BUFFER_SIZE,
-                                        SEGGER_RTT_MODE_NO_BLOCK_TRIM);
-#else
-    int res = SEGGER_RTT_SetFlagsUpBuffer(LOG_RTT_BUFFER_INDEX, SEGGER_RTT_MODE_NO_BLOCK_TRIM);
-#endif
-
-    otEXPECT(res >= 0);
-
-    sLogInitialized = true;
-
-exit:
-    return;
-}
-
-void utilsLogRttDeinit(void) { sLogInitialized = false; }
-
-void utilsLogRttOutput(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list ap)
-{
-    (void)aLogRegion;
-
-    uint16_t length = 0;
-    int      charsWritten;
-    char     logString[LOG_PARSE_BUFFER_SIZE + 1];
-
-    otEXPECT(sLogInitialized == true);
-
-#if (LOG_TIMESTAMP_ENABLE == 1)
-    length += logTimestamp(logString, LOG_PARSE_BUFFER_SIZE);
-#endif
-
-    // Add level information.
-    length += logLevel(&logString[length], (LOG_PARSE_BUFFER_SIZE - length), aLogLevel);
-
-    charsWritten = vsnprintf(&logString[length], (size_t)(LOG_PARSE_BUFFER_SIZE - length), aFormat, ap);
-    otEXPECT(charsWritten >= 0);
-    length += charsWritten;
-
-    if (length > LOG_PARSE_BUFFER_SIZE)
-    {
-        length = LOG_PARSE_BUFFER_SIZE;
-    }
-
-    logString[length++] = '\n';
-
-    // Write user log to the RTT memory block.
-    SEGGER_RTT_WriteNoLock(LOG_RTT_BUFFER_INDEX, logString, length);
-
-exit:
-    return;
-}
-#endif // (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
diff --git a/examples/platforms/utils/logging_rtt.h b/examples/platforms/utils/logging_rtt.h
deleted file mode 100644
index ea8b380..0000000
--- a/examples/platforms/utils/logging_rtt.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *  Copyright (c) 2018, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- * @brief
- *   This file defines the logging rtt interfaces and default constants used by logging_rtt.c.
- */
-
-#ifndef UTILS_LOGGING_RTT_H
-#define UTILS_LOGGING_RTT_H
-
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-
-#include "openthread-core-config.h"
-#include <openthread/config.h>
-#include <openthread/platform/logging.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @def LOG_RTT_BUFFER_INDEX
- *
- * RTT's buffer index.
- *
- */
-#ifndef LOG_RTT_BUFFER_INDEX
-#define LOG_RTT_BUFFER_INDEX 0
-#endif
-
-/**
- * @def LOG_RTT_BUFFER_NAME
- *
- * RTT's name. Only used if LOG_RTT_BUFFER_INDEX is not 0. Otherwise,
- * the buffer name is fixed to "Terminal".
- *
- */
-#ifndef LOG_RTT_BUFFER_NAME
-#define LOG_RTT_BUFFER_NAME "Terminal"
-#endif
-
-/**
- * @def LOG_RTT_BUFFER_SIZE
- *
- * LOG RTT's buffer size. Only used if LOG_RTT_BUFFER_INDEX is not 0. To
- * configure buffer #0 size, check the BUFFER_SIZE_UP definition in
- * SEGGER_RTT_Conf.h
- *
- */
-#ifndef LOG_RTT_BUFFER_SIZE
-#define LOG_RTT_BUFFER_SIZE 256
-#endif
-
-/**
- * @def LOG_RTT_COLOR_ENABLE
- *
- * Enable colors on RTT Viewer.
- *
- */
-#ifndef LOG_RTT_COLOR_ENABLE
-#define LOG_RTT_COLOR_ENABLE 1
-#endif
-
-/**
- * @def LOG_PARSE_BUFFER_SIZE
- *
- * LOG buffer used to parse print format. It will be locally allocated on the
- * stack.
- *
- */
-#ifndef LOG_PARSE_BUFFER_SIZE
-#define LOG_PARSE_BUFFER_SIZE 128
-#endif
-
-/**
- * @def LOG_TIMESTAMP_ENABLE
- *
- * Enable timestamp in the logs.
- *
- */
-#ifndef LOG_TIMESTAMP_ENABLE
-#define LOG_TIMESTAMP_ENABLE 1
-#endif
-
-/**
- * Initialization of Logger driver.
- *
- */
-void utilsLogRttInit(void);
-
-/**
- * Deinitialization of Logger driver.
- *
- */
-void utilsLogRttDeinit(void);
-
-/**
- * Outputs logs to SEGGER RTT.
- *
- * @param[in]  aLogLevel   The log level.
- * @param[in]  aLogRegion  The log region.
- * @param[in]  aFormat     A pointer to the format string.
- * @param[in]  ap          va_list matching information for aFormat
- *
- */
-void utilsLogRttOutput(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list ap);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // UTILS_LOGGING_RTT_H
diff --git a/examples/platforms/utils/mac_frame.cpp b/examples/platforms/utils/mac_frame.cpp
deleted file mode 100644
index 0ae88db..0000000
--- a/examples/platforms/utils/mac_frame.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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.
- */
-
-#include "mac_frame.h"
-
-#include <assert.h>
-#include "mac/mac_frame.hpp"
-
-using namespace ot;
-
-bool otMacFrameDoesAddrMatch(const otRadioFrame *aFrame,
-                             otPanId             aPanId,
-                             otShortAddress      aShortAddress,
-                             const otExtAddress *aExtAddress)
-{
-    const Mac::Frame &frame = *static_cast<const Mac::Frame *>(aFrame);
-    bool              rval  = true;
-    Mac::Address      dst;
-    Mac::PanId        panid;
-
-    SuccessOrExit(frame.GetDstAddr(dst));
-
-    switch (dst.GetType())
-    {
-    case Mac::Address::kTypeShort:
-        VerifyOrExit(dst.GetShort() == Mac::kShortAddrBroadcast || dst.GetShort() == aShortAddress, rval = false);
-        break;
-
-    case Mac::Address::kTypeExtended:
-        VerifyOrExit(dst.GetExtended() == *static_cast<const Mac::ExtAddress *>(aExtAddress), rval = false);
-        break;
-
-    case Mac::Address::kTypeNone:
-        break;
-    }
-
-    SuccessOrExit(frame.GetDstPanId(panid));
-    VerifyOrExit(panid == Mac::kPanIdBroadcast || panid == aPanId, rval = false);
-
-exit:
-    return rval;
-}
-
-bool otMacFrameIsAck(const otRadioFrame *aFrame)
-{
-    return static_cast<const Mac::Frame *>(aFrame)->GetType() == Mac::Frame::kTypeAck;
-}
-
-bool otMacFrameIsData(const otRadioFrame *aFrame)
-{
-    return static_cast<const Mac::Frame *>(aFrame)->GetType() == Mac::Frame::kTypeData;
-}
-
-bool otMacFrameIsCommand(const otRadioFrame *aFrame)
-{
-    return static_cast<const Mac::Frame *>(aFrame)->GetType() == Mac::Frame::kTypeMacCmd;
-}
-
-bool otMacFrameIsDataRequest(const otRadioFrame *aFrame)
-{
-    return static_cast<const Mac::Frame *>(aFrame)->IsDataRequestCommand();
-}
-
-bool otMacFrameIsAckRequested(const otRadioFrame *aFrame)
-{
-    return static_cast<const Mac::Frame *>(aFrame)->GetAckRequest();
-}
-
-static void GetOtMacAddress(const Mac::Address &aInAddress, otMacAddress *aOutAddress)
-{
-    switch (aInAddress.GetType())
-    {
-    case Mac::Address::kTypeNone:
-        aOutAddress->mType = OT_MAC_ADDRESS_TYPE_NONE;
-        break;
-
-    case Mac::Address::kTypeShort:
-        aOutAddress->mType                  = OT_MAC_ADDRESS_TYPE_SHORT;
-        aOutAddress->mAddress.mShortAddress = aInAddress.GetShort();
-        break;
-
-    case Mac::Address::kTypeExtended:
-        aOutAddress->mType                = OT_MAC_ADDRESS_TYPE_EXTENDED;
-        aOutAddress->mAddress.mExtAddress = aInAddress.GetExtended();
-        break;
-    }
-}
-
-otError otMacFrameGetSrcAddr(const otRadioFrame *aFrame, otMacAddress *aMacAddress)
-{
-    otError      error;
-    Mac::Address address;
-
-    error = static_cast<const Mac::Frame *>(aFrame)->GetSrcAddr(address);
-    SuccessOrExit(error);
-
-    GetOtMacAddress(address, aMacAddress);
-
-exit:
-    return error;
-}
-
-otError otMacFrameGetDstAddr(const otRadioFrame *aFrame, otMacAddress *aMacAddress)
-{
-    otError      error;
-    Mac::Address address;
-
-    error = static_cast<const Mac::Frame *>(aFrame)->GetDstAddr(address);
-    SuccessOrExit(error);
-
-    GetOtMacAddress(address, aMacAddress);
-
-exit:
-    return error;
-}
-
-uint8_t otMacFrameGetSequence(const otRadioFrame *aFrame)
-{
-    return static_cast<const Mac::Frame *>(aFrame)->GetSequence();
-}
-
-void otMacFrameProcessTransmitAesCcm(otRadioFrame *aFrame, const otExtAddress *aExtAddress)
-{
-    static_cast<Mac::TxFrame *>(aFrame)->ProcessTransmitAesCcm(*static_cast<const Mac::ExtAddress *>(aExtAddress));
-}
-
-bool otMacFrameIsVersion2015(const otRadioFrame *aFrame)
-{
-    return static_cast<const Mac::Frame *>(aFrame)->IsVersion2015();
-}
-
-void otMacFrameGenerateImmAck(const otRadioFrame *aFrame, bool aIsFramePending, otRadioFrame *aAckFrame)
-{
-    assert(aFrame != nullptr && aAckFrame != nullptr);
-
-    static_cast<Mac::TxFrame *>(aAckFrame)->GenerateImmAck(*static_cast<const Mac::RxFrame *>(aFrame), aIsFramePending);
-}
-
-#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
-otError otMacFrameGenerateEnhAck(const otRadioFrame *aFrame,
-                                 bool                aIsFramePending,
-                                 const uint8_t      *aIeData,
-                                 uint8_t             aIeLength,
-                                 otRadioFrame       *aAckFrame)
-{
-    assert(aFrame != nullptr && aAckFrame != nullptr);
-
-    return static_cast<Mac::TxFrame *>(aAckFrame)->GenerateEnhAck(*static_cast<const Mac::RxFrame *>(aFrame),
-                                                                  aIsFramePending, aIeData, aIeLength);
-}
-#endif
-
-#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-void otMacFrameSetCslIe(otRadioFrame *aFrame, uint16_t aCslPeriod, uint16_t aCslPhase)
-{
-    static_cast<Mac::Frame *>(aFrame)->SetCslIe(aCslPeriod, aCslPhase);
-}
-#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-
-bool otMacFrameIsSecurityEnabled(otRadioFrame *aFrame)
-{
-    return static_cast<const Mac::Frame *>(aFrame)->GetSecurityEnabled();
-}
-
-bool otMacFrameIsKeyIdMode1(otRadioFrame *aFrame)
-{
-    uint8_t keyIdMode;
-    otError error;
-
-    error = static_cast<const Mac::Frame *>(aFrame)->GetKeyIdMode(keyIdMode);
-
-    return (error == OT_ERROR_NONE) ? (keyIdMode == Mac::Frame::kKeyIdMode1) : false;
-}
-
-uint8_t otMacFrameGetKeyId(otRadioFrame *aFrame)
-{
-    uint8_t keyId = 0;
-
-    IgnoreError(static_cast<const Mac::Frame *>(aFrame)->GetKeyId(keyId));
-
-    return keyId;
-}
-
-void otMacFrameSetKeyId(otRadioFrame *aFrame, uint8_t aKeyId) { static_cast<Mac::Frame *>(aFrame)->SetKeyId(aKeyId); }
-
-uint32_t otMacFrameGetFrameCounter(otRadioFrame *aFrame)
-{
-    uint32_t frameCounter = UINT32_MAX;
-
-    IgnoreError(static_cast<Mac::Frame *>(aFrame)->GetFrameCounter(frameCounter));
-
-    return frameCounter;
-}
-
-void otMacFrameSetFrameCounter(otRadioFrame *aFrame, uint32_t aFrameCounter)
-{
-    static_cast<Mac::Frame *>(aFrame)->SetFrameCounter(aFrameCounter);
-}
-
-#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
-uint8_t otMacFrameGenerateCslIeTemplate(uint8_t *aDest)
-{
-    assert(aDest != nullptr);
-
-    reinterpret_cast<Mac::HeaderIe *>(aDest)->SetId(Mac::CslIe::kHeaderIeId);
-    reinterpret_cast<Mac::HeaderIe *>(aDest)->SetLength(sizeof(Mac::CslIe));
-
-    return sizeof(Mac::HeaderIe) + sizeof(Mac::CslIe);
-}
-#endif
-
-#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
-uint8_t otMacFrameGenerateEnhAckProbingIe(uint8_t *aDest, const uint8_t *aIeData, uint8_t aIeDataLength)
-{
-    uint8_t len = sizeof(Mac::VendorIeHeader) + aIeDataLength;
-
-    assert(aDest != nullptr);
-
-    reinterpret_cast<Mac::HeaderIe *>(aDest)->SetId(Mac::ThreadIe::kHeaderIeId);
-    reinterpret_cast<Mac::HeaderIe *>(aDest)->SetLength(len);
-
-    aDest += sizeof(Mac::HeaderIe);
-
-    reinterpret_cast<Mac::VendorIeHeader *>(aDest)->SetVendorOui(Mac::ThreadIe::kVendorOuiThreadCompanyId);
-    reinterpret_cast<Mac::VendorIeHeader *>(aDest)->SetSubType(Mac::ThreadIe::kEnhAckProbingIe);
-
-    if (aIeData != nullptr)
-    {
-        aDest += sizeof(Mac::VendorIeHeader);
-        memcpy(aDest, aIeData, aIeDataLength);
-    }
-
-    return sizeof(Mac::HeaderIe) + len;
-}
-
-void otMacFrameSetEnhAckProbingIe(otRadioFrame *aFrame, const uint8_t *aData, uint8_t aDataLen)
-{
-    assert(aFrame != nullptr && aData != nullptr);
-
-    reinterpret_cast<Mac::Frame *>(aFrame)->SetEnhAckProbingIe(aData, aDataLen);
-}
-#endif // OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
diff --git a/examples/platforms/utils/mac_frame.h b/examples/platforms/utils/mac_frame.h
deleted file mode 100644
index 5fba6ec..0000000
--- a/examples/platforms/utils/mac_frame.h
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- * @brief
- *   This file defines the mac frame interface for OpenThread platform radio drivers.
- *
- */
-
-#ifndef OPENTHREAD_UTILS_MAC_FRAME_H
-#define OPENTHREAD_UTILS_MAC_FRAME_H
-
-#include <openthread/platform/radio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Specifies the IEEE 802.15.4 Address type.
- *
- */
-typedef enum
-{
-    OT_MAC_ADDRESS_TYPE_NONE,     ///< No address.
-    OT_MAC_ADDRESS_TYPE_SHORT,    ///< IEEE 802.15.4 Short Address.
-    OT_MAC_ADDRESS_TYPE_EXTENDED, ///< IEEE 802.15.4 Extended Address.
-} otMacAddressType;
-
-/**
- * Represents an IEEE 802.15.4 short or extended Address.
- *
- */
-typedef struct otMacAddress
-{
-    union
-    {
-        otShortAddress mShortAddress; ///< The IEEE 802.15.4 Short Address.
-        otExtAddress   mExtAddress;   ///< The IEEE 802.15.4 Extended Address.
-    } mAddress;
-
-    otMacAddressType mType; ///< The address type (short, extended, or none).
-} otMacAddress;
-
-/**
- * Check if @p aFrame is an Ack frame.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @retval  true    It is an ACK frame.
- * @retval  false   It is not an ACK frame.
- *
- */
-bool otMacFrameIsAck(const otRadioFrame *aFrame);
-
-/**
- * Check if @p aFrame is a Data frame.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @retval  true    It is a Data frame.
- * @retval  false   It is not a Data frame.
- *
- */
-bool otMacFrameIsData(const otRadioFrame *aFrame);
-
-/**
- * Check if @p aFrame is a Command frame.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @retval  true    It is a Command frame.
- * @retval  false   It is not a Command frame.
- *
- */
-bool otMacFrameIsCommand(const otRadioFrame *aFrame);
-
-/**
- * Check if @p aFrame is a Data Request Command.
- *
- * @param[in]   aFrame          A pointer to the frame. For 802.15.4-2015 and above frame,
- *                              the frame should be already decrypted.
- *
- * @retval  true    It is a Data Request Command frame.
- * @retval  false   It is not a Data Request Command frame.
- *
- */
-bool otMacFrameIsDataRequest(const otRadioFrame *aFrame);
-
-/**
- * Check if @p aFrame requests ACK.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @retval  true    It requests ACK.
- * @retval  false   It does not request ACK.
- *
- */
-bool otMacFrameIsAckRequested(const otRadioFrame *aFrame);
-
-/**
- * Check if @p aFrame matches the @p aPandId and @p aShortAddress or @p aExtAddress.
- *
- * @param[in]   aFrame          A pointer to the frame.
- * @param[in]   aPanId          The PAN id to match with.
- * @param[in]   aShortAddress   The short address to match with.
- * @param[in]   aExtAddress     The extended address to match with.
- *
- * @retval  true    It is a broadcast or matches with the PAN id and one of the addresses.
- * @retval  false   It doesn't match.
- *
- */
-bool otMacFrameDoesAddrMatch(const otRadioFrame *aFrame,
-                             otPanId             aPanId,
-                             otShortAddress      aShortAddress,
-                             const otExtAddress *aExtAddress);
-
-/**
- * Get source MAC address.
- *
- * @param[in]   aFrame          A pointer to the frame.
- * @param[out]  aMacAddress     A pointer to MAC address.
- *
- * @retval  OT_ERROR_NONE   Successfully got the source MAC address.
- * @retval  OT_ERROR_PARSE  Failed to parse the source MAC address.
- *
- */
-otError otMacFrameGetSrcAddr(const otRadioFrame *aFrame, otMacAddress *aMacAddress);
-
-/**
- * Get destination MAC address.
- *
- * @param[in]   aFrame          A pointer to the frame.
- * @param[out]  aMacAddress     A pointer to MAC address.
- *
- * @retval  OT_ERROR_NONE   Successfully got the destination MAC address.
- * @retval  OT_ERROR_PARSE  Failed to parse the destination MAC address.
- *
- */
-otError otMacFrameGetDstAddr(const otRadioFrame *aFrame, otMacAddress *aMacAddress);
-
-/**
- * Get the sequence of @p aFrame.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @returns The sequence of the frame.
- *
- */
-uint8_t otMacFrameGetSequence(const otRadioFrame *aFrame);
-
-/**
- * Performs AES CCM on the frame which is going to be sent.
- *
- * @param[in]  aFrame       A pointer to the MAC frame buffer that is going to be sent.
- * @param[in]  aExtAddress  A pointer to the extended address, which will be used to generate nonce
- *                          for AES CCM computation.
- *
- */
-void otMacFrameProcessTransmitAesCcm(otRadioFrame *aFrame, const otExtAddress *aExtAddress);
-
-/**
- * Tell if the version of @p aFrame is 2015.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @retval  true    It is a version 2015 frame.
- * @retval  false   It is not a version 2015 frame.
- *
- */
-bool otMacFrameIsVersion2015(const otRadioFrame *aFrame);
-
-/**
- * Generate Imm-Ack for @p aFrame.
- *
- * @param[in]    aFrame             A pointer to the frame.
- * @param[in]    aIsFramePending    Value of the ACK's frame pending bit.
- * @param[out]   aAckFrame          A pointer to the ack frame to be generated.
- *
- */
-void otMacFrameGenerateImmAck(const otRadioFrame *aFrame, bool aIsFramePending, otRadioFrame *aAckFrame);
-
-/**
- * Generate Enh-Ack for @p aFrame.
- *
- * @param[in]    aFrame             A pointer to the frame.
- * @param[in]    aIsFramePending    Value of the ACK's frame pending bit.
- * @param[in]    aIeData            A pointer to the IE data portion of the ACK to be sent.
- * @param[in]    aIeLength          The length of IE data portion of the ACK to be sent.
- * @param[out]   aAckFrame          A pointer to the ack frame to be generated.
- *
- * @retval  OT_ERROR_NONE           Successfully generated Enh Ack in @p aAckFrame.
- * @retval  OT_ERROR_PARSE          @p aFrame has incorrect format.
- *
- */
-otError otMacFrameGenerateEnhAck(const otRadioFrame *aFrame,
-                                 bool                aIsFramePending,
-                                 const uint8_t      *aIeData,
-                                 uint8_t             aIeLength,
-                                 otRadioFrame       *aAckFrame);
-
-/**
- * Set CSL IE content into the frame.
- *
- * @param[in,out]   aFrame         A pointer to the frame to be modified.
- * @param[in]       aCslPeriod     CSL Period in CSL IE.
- * @param[in]       aCslPhase      CSL Phase in CSL IE.
- *
- */
-void otMacFrameSetCslIe(otRadioFrame *aFrame, uint16_t aCslPeriod, uint16_t aCslPhase);
-
-/**
- * Tell if the security of @p aFrame is enabled.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @retval  true    The frame has security enabled.
- * @retval  false   The frame does not have security enabled.
- *
- */
-bool otMacFrameIsSecurityEnabled(otRadioFrame *aFrame);
-
-/**
- * Tell if the key ID mode of @p aFrame is 1.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @retval  true    The frame key ID mode is 1.
- * @retval  false   The frame security is not enabled or key ID mode is not 1.
- *
- */
-bool otMacFrameIsKeyIdMode1(otRadioFrame *aFrame);
-
-/**
- * Get the key ID of @p aFrame.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @returns The key ID of the frame with key ID mode 1. Returns 0 if failed.
- *
- */
-uint8_t otMacFrameGetKeyId(otRadioFrame *aFrame);
-
-/**
- * Set key ID to @p aFrame with key ID mode 1.
- *
- * @param[in,out]   aFrame     A pointer to the frame to be modified.
- * @param[in]       aKeyId     Key ID to be set to the frame.
- *
- */
-void otMacFrameSetKeyId(otRadioFrame *aFrame, uint8_t aKeyId);
-
-/**
- * Get the frame counter of @p aFrame.
- *
- * @param[in]   aFrame          A pointer to the frame.
- *
- * @returns The frame counter of the frame. Returns UINT32_MAX if failed.
- *
- */
-uint32_t otMacFrameGetFrameCounter(otRadioFrame *aFrame);
-
-/**
- * Set frame counter to @p aFrame.
- *
- * @param[in,out]   aFrame         A pointer to the frame to be modified.
- * @param[in]       aFrameCounter  Frame counter to be set to the frame.
- *
- */
-void otMacFrameSetFrameCounter(otRadioFrame *aFrame, uint32_t aFrameCounter);
-
-/**
- * Write CSL IE to a buffer (without setting IE value).
- *
- * @param[out]  aDest    A pointer to the output buffer.
- *
- * @returns  The total count of bytes (total length of CSL IE) written to the buffer.
- *
- */
-uint8_t otMacFrameGenerateCslIeTemplate(uint8_t *aDest);
-
-/**
- * Write Enh-ACK Probing IE (Vendor IE with THREAD OUI) to a buffer.
- *
- * @p aIeData could be `NULL`. If @p aIeData is `NULL`, this method generates the IE with the data unset. This allows
- * users to generate the pattern first and update value later. (For example, using `otMacFrameSetEnhAckProbingIe`)
- *
- * @param[out]  aDest          A pointer to the output buffer.
- * @param[in]   aIeData        A pointer to the Link Metrics data.
- * @param[in]   aIeDataLength  The length of Link Metrics data value. Should be `1` or `2`. (Per spec 4.11.3.4.4.6)
- *
- * @returns  The total count of bytes (total length of the Vendor IE) written to the buffer.
- *
- */
-uint8_t otMacFrameGenerateEnhAckProbingIe(uint8_t *aDest, const uint8_t *aIeData, uint8_t aIeDataLength);
-
-/**
- * Sets the data value of Enh-ACK Probing IE (Vendor IE with THREAD OUI) in a frame.
- *
- * If no Enh-ACK Probing IE is found in @p aFrame, nothing would be done.
- *
- * @param[in]  aFrame    The target frame that contains the IE. MUST NOT be `NULL`.
- * @param[in]  aData     A pointer to the data value. MUST NOT be `NULL`.
- * @param[in]  aDataLen  The length of @p aData.
- *
- */
-void otMacFrameSetEnhAckProbingIe(otRadioFrame *aFrame, const uint8_t *aData, uint8_t aDataLen);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // OPENTHREAD_UTILS_MAC_FRAME_H
diff --git a/examples/platforms/utils/settings.h b/examples/platforms/utils/settings.h
deleted file mode 100644
index 7b4e545..0000000
--- a/examples/platforms/utils/settings.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Copyright (c) 2016-2020, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- *   This file defines the configuration options for platform abstraction of non-volatile storage of settings.
- *
- */
-
-#ifndef UTILS_SETTINGS_H_
-#define UTILS_SETTINGS_H_
-
-#include <openthread-core-config.h>
-
-/**
- * @def OPENTHREAD_SETTINGS_RAM
- *
- * Define as 1 to enable saving the settings in RAM instead of flash.
- *
- */
-#ifndef OPENTHREAD_SETTINGS_RAM
-#define OPENTHREAD_SETTINGS_RAM 0
-#endif
-
-#endif // UTILS_SETTINGS_H_
diff --git a/examples/platforms/utils/settings_ram.c b/examples/platforms/utils/settings_ram.c
deleted file mode 100644
index d8e7c0f..0000000
--- a/examples/platforms/utils/settings_ram.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- *   This file implements OpenThread platform abstraction for storage of settings in RAM.
- *
- */
-
-#include "settings.h"
-
-#include <assert.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <openthread/instance.h>
-#include <openthread/platform/settings.h>
-
-#define SETTINGS_BUFFER_SIZE 1024
-
-#if OPENTHREAD_SETTINGS_RAM
-
-static uint8_t  sSettingsBuf[SETTINGS_BUFFER_SIZE];
-static uint16_t sSettingsBufLength;
-
-OT_TOOL_PACKED_BEGIN
-struct settingsBlock
-{
-    uint16_t key;
-    uint16_t length;
-} OT_TOOL_PACKED_END;
-
-// settings API
-void otPlatSettingsInit(otInstance *aInstance, const uint16_t *aSensitiveKeys, uint16_t aSensitiveKeysLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-    OT_UNUSED_VARIABLE(aSensitiveKeys);
-    OT_UNUSED_VARIABLE(aSensitiveKeysLength);
-
-    sSettingsBufLength = 0;
-}
-
-void otPlatSettingsDeinit(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); }
-
-otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint16_t                    i           = 0;
-    uint16_t                    valueLength = 0;
-    uint16_t                    readLength;
-    int                         currentIndex = 0;
-    const struct settingsBlock *currentBlock;
-    otError                     error = OT_ERROR_NOT_FOUND;
-
-    while (i < sSettingsBufLength)
-    {
-        currentBlock = (struct settingsBlock *)&sSettingsBuf[i];
-
-        if (aKey == currentBlock->key)
-        {
-            if (currentIndex == aIndex)
-            {
-                readLength = currentBlock->length;
-
-                // Perform read only if an input buffer was passed in
-                if (aValue != NULL && aValueLength != NULL)
-                {
-                    // Adjust read length if input buffer size is smaller
-                    if (readLength > *aValueLength)
-                    {
-                        readLength = *aValueLength;
-                    }
-
-                    memcpy(aValue, &sSettingsBuf[i + sizeof(struct settingsBlock)], readLength);
-                }
-
-                valueLength = currentBlock->length;
-                error       = OT_ERROR_NONE;
-                break;
-            }
-
-            currentIndex++;
-        }
-
-        i += sizeof(struct settingsBlock) + currentBlock->length;
-    }
-
-    if (aValueLength != NULL)
-    {
-        *aValueLength = valueLength;
-    }
-
-    return error;
-}
-
-otError otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    uint16_t                    i = 0;
-    uint16_t                    currentBlockLength;
-    uint16_t                    nextBlockStart;
-    const struct settingsBlock *currentBlock;
-
-    // Delete all entries of aKey
-    while (i < sSettingsBufLength)
-    {
-        currentBlock       = (struct settingsBlock *)&sSettingsBuf[i];
-        currentBlockLength = sizeof(struct settingsBlock) + currentBlock->length;
-
-        if (aKey == currentBlock->key)
-        {
-            nextBlockStart = i + currentBlockLength;
-
-            if (nextBlockStart < sSettingsBufLength)
-            {
-                memmove(&sSettingsBuf[i], &sSettingsBuf[nextBlockStart], sSettingsBufLength - nextBlockStart);
-            }
-
-            assert(sSettingsBufLength >= currentBlockLength);
-            sSettingsBufLength -= currentBlockLength;
-        }
-        else
-        {
-            i += currentBlockLength;
-        }
-    }
-
-    return otPlatSettingsAdd(aInstance, aKey, aValue, aValueLength);
-}
-
-otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError               error;
-    struct settingsBlock *currentBlock;
-    const uint16_t        newBlockLength = sizeof(struct settingsBlock) + aValueLength;
-
-    if (sSettingsBufLength + newBlockLength <= sizeof(sSettingsBuf))
-    {
-        currentBlock         = (struct settingsBlock *)&sSettingsBuf[sSettingsBufLength];
-        currentBlock->key    = aKey;
-        currentBlock->length = aValueLength;
-
-        memcpy(&sSettingsBuf[sSettingsBufLength + sizeof(struct settingsBlock)], aValue, aValueLength);
-        sSettingsBufLength += newBlockLength;
-
-        error = OT_ERROR_NONE;
-    }
-    else
-    {
-        error = OT_ERROR_NO_BUFS;
-    }
-
-    return error;
-}
-
-otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    uint16_t                    i            = 0;
-    int                         currentIndex = 0;
-    uint16_t                    nextBlockStart;
-    uint16_t                    currentBlockLength;
-    const struct settingsBlock *currentBlock;
-    otError                     error = OT_ERROR_NOT_FOUND;
-
-    while (i < sSettingsBufLength)
-    {
-        currentBlock       = (struct settingsBlock *)&sSettingsBuf[i];
-        currentBlockLength = sizeof(struct settingsBlock) + currentBlock->length;
-
-        if (aKey == currentBlock->key)
-        {
-            if (currentIndex == aIndex)
-            {
-                nextBlockStart = i + currentBlockLength;
-
-                if (nextBlockStart < sSettingsBufLength)
-                {
-                    memmove(&sSettingsBuf[i], &sSettingsBuf[nextBlockStart], sSettingsBufLength - nextBlockStart);
-                }
-
-                assert(sSettingsBufLength >= currentBlockLength);
-                sSettingsBufLength -= currentBlockLength;
-
-                error = OT_ERROR_NONE;
-                break;
-            }
-            else
-            {
-                currentIndex++;
-            }
-        }
-
-        i += currentBlockLength;
-    }
-
-    return error;
-}
-
-void otPlatSettingsWipe(otInstance *aInstance) { otPlatSettingsInit(aInstance, NULL, 0); }
-
-#endif // OPENTHREAD_SETTINGS_RAM
diff --git a/examples/platforms/utils/soft_source_match_table.c b/examples/platforms/utils/soft_source_match_table.c
deleted file mode 100644
index 3d8a8a6..0000000
--- a/examples/platforms/utils/soft_source_match_table.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- *   This file implements a software Source Match table, for radios that don't have
- *   such hardware acceleration. It supports only the single-instance build of
- *   OpenThread.
- *
- */
-
-#include "utils/soft_source_match_table.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <openthread/logging.h>
-
-#include "utils/code_utils.h"
-
-#if RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM || RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
-static uint16_t sPanId = 0;
-
-void utilsSoftSrcMatchSetPanId(uint16_t aPanId) { sPanId = aPanId; }
-#endif // RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM || RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
-
-#if RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM
-typedef struct srcMatchShortEntry
-{
-    uint16_t checksum;
-    bool     allocated;
-} sSrcMatchShortEntry;
-
-static sSrcMatchShortEntry srcMatchShortEntry[RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM];
-
-int16_t utilsSoftSrcMatchShortFindEntry(uint16_t aShortAddress)
-{
-    int16_t  entry    = -1;
-    uint16_t checksum = aShortAddress + sPanId;
-
-    for (int16_t i = 0; i < RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM; i++)
-    {
-        if (checksum == srcMatchShortEntry[i].checksum && srcMatchShortEntry[i].allocated)
-        {
-            entry = i;
-            break;
-        }
-    }
-
-    return entry;
-}
-
-static int16_t findSrcMatchShortAvailEntry(void)
-{
-    int16_t entry = -1;
-
-    for (int16_t i = 0; i < RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM; i++)
-    {
-        if (!srcMatchShortEntry[i].allocated)
-        {
-            entry = i;
-            break;
-        }
-    }
-
-    return entry;
-}
-
-static inline void addToSrcMatchShortIndirect(uint16_t entry, uint16_t aShortAddress)
-{
-    uint16_t checksum = aShortAddress + sPanId;
-
-    srcMatchShortEntry[entry].checksum  = checksum;
-    srcMatchShortEntry[entry].allocated = true;
-}
-
-static inline void removeFromSrcMatchShortIndirect(uint16_t entry)
-{
-    srcMatchShortEntry[entry].allocated = false;
-    srcMatchShortEntry[entry].checksum  = 0;
-}
-
-otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-    int16_t entry = -1;
-
-    entry = findSrcMatchShortAvailEntry();
-    otLogDebgPlat("Add ShortAddr entry: %d", entry);
-
-    otEXPECT_ACTION(entry >= 0 && entry < RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM, error = OT_ERROR_NO_BUFS);
-
-    addToSrcMatchShortIndirect((uint16_t)entry, aShortAddress);
-
-exit:
-    return error;
-}
-
-otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-    int16_t entry = -1;
-
-    entry = utilsSoftSrcMatchShortFindEntry(aShortAddress);
-    otLogDebgPlat("Clear ShortAddr entry: %d", entry);
-
-    otEXPECT_ACTION(entry >= 0 && entry < RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM, error = OT_ERROR_NO_ADDRESS);
-
-    removeFromSrcMatchShortIndirect((uint16_t)entry);
-
-exit:
-    return error;
-}
-
-void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otLogDebgPlat("Clear ShortAddr entries");
-
-    memset(srcMatchShortEntry, 0, sizeof(srcMatchShortEntry));
-}
-#endif // RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM
-
-#if RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
-typedef struct srcMatchExtEntry
-{
-    uint16_t checksum;
-    bool     allocated;
-} sSrcMatchExtEntry;
-
-static sSrcMatchExtEntry srcMatchExtEntry[RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM];
-
-int16_t utilsSoftSrcMatchExtFindEntry(const otExtAddress *aExtAddress)
-{
-    int16_t  entry    = -1;
-    uint16_t checksum = sPanId;
-
-    checksum += (uint16_t)aExtAddress->m8[0] | (uint16_t)(aExtAddress->m8[1] << 8);
-    checksum += (uint16_t)aExtAddress->m8[2] | (uint16_t)(aExtAddress->m8[3] << 8);
-    checksum += (uint16_t)aExtAddress->m8[4] | (uint16_t)(aExtAddress->m8[5] << 8);
-    checksum += (uint16_t)aExtAddress->m8[6] | (uint16_t)(aExtAddress->m8[7] << 8);
-
-    for (int16_t i = 0; i < RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM; i++)
-    {
-        if (checksum == srcMatchExtEntry[i].checksum && srcMatchExtEntry[i].allocated)
-        {
-            entry = i;
-            break;
-        }
-    }
-
-    return entry;
-}
-
-static int16_t findSrcMatchExtAvailEntry(void)
-{
-    int16_t entry = -1;
-
-    for (int16_t i = 0; i < RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM; i++)
-    {
-        if (!srcMatchExtEntry[i].allocated)
-        {
-            entry = i;
-            break;
-        }
-    }
-
-    return entry;
-}
-
-static inline void addToSrcMatchExtIndirect(uint16_t entry, const otExtAddress *aExtAddress)
-{
-    uint16_t checksum = sPanId;
-
-    checksum += (uint16_t)aExtAddress->m8[0] | (uint16_t)(aExtAddress->m8[1] << 8);
-    checksum += (uint16_t)aExtAddress->m8[2] | (uint16_t)(aExtAddress->m8[3] << 8);
-    checksum += (uint16_t)aExtAddress->m8[4] | (uint16_t)(aExtAddress->m8[5] << 8);
-    checksum += (uint16_t)aExtAddress->m8[6] | (uint16_t)(aExtAddress->m8[7] << 8);
-
-    srcMatchExtEntry[entry].checksum  = checksum;
-    srcMatchExtEntry[entry].allocated = true;
-}
-
-static inline void removeFromSrcMatchExtIndirect(uint16_t entry)
-{
-    srcMatchExtEntry[entry].allocated = false;
-    srcMatchExtEntry[entry].checksum  = 0;
-}
-
-otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-    int16_t entry = -1;
-
-    entry = findSrcMatchExtAvailEntry();
-    otLogDebgPlat("Add ExtAddr entry: %d", entry);
-
-    otEXPECT_ACTION(entry >= 0 && entry < RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM, error = OT_ERROR_NO_BUFS);
-
-    addToSrcMatchExtIndirect((uint16_t)entry, aExtAddress);
-
-exit:
-    return error;
-}
-
-otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otError error = OT_ERROR_NONE;
-    int16_t entry = -1;
-
-    entry = utilsSoftSrcMatchExtFindEntry(aExtAddress);
-    otLogDebgPlat("Clear ExtAddr entry: %d", entry);
-
-    otEXPECT_ACTION(entry >= 0 && entry < RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM, error = OT_ERROR_NO_ADDRESS);
-
-    removeFromSrcMatchExtIndirect((uint16_t)entry);
-
-exit:
-    return error;
-}
-
-void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
-{
-    OT_UNUSED_VARIABLE(aInstance);
-
-    otLogDebgPlat("Clear ExtAddr entries");
-
-    memset(srcMatchExtEntry, 0, sizeof(srcMatchExtEntry));
-}
-#endif // RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
diff --git a/examples/platforms/utils/soft_source_match_table.h b/examples/platforms/utils/soft_source_match_table.h
deleted file mode 100644
index f34427a..0000000
--- a/examples/platforms/utils/soft_source_match_table.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Copyright (c) 2019, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- * @brief
- *   This file defines the software source match table interfaces used by
- *   soft_source_match_table.c.
- */
-
-#ifndef SOFT_SOURCE_MATCH_TABLE_H
-#define SOFT_SOURCE_MATCH_TABLE_H
-
-#include "openthread-core-config.h"
-#include <openthread/platform/radio.h>
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM
-#define RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM OPENTHREAD_CONFIG_MLE_MAX_CHILDREN
-#endif
-
-#ifndef RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
-#define RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM OPENTHREAD_CONFIG_MLE_MAX_CHILDREN
-#endif
-
-#if RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM || RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
-void utilsSoftSrcMatchSetPanId(uint16_t aPanId);
-#endif // RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM || RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
-
-#if RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM
-int16_t utilsSoftSrcMatchShortFindEntry(uint16_t aShortAddress);
-#endif // RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM
-
-#if RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
-int16_t utilsSoftSrcMatchExtFindEntry(const otExtAddress *aExtAddress);
-#endif // RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // SOFT_SOURCE_MATCH_TABLE_H
diff --git a/examples/platforms/utils/uart.h b/examples/platforms/utils/uart.h
deleted file mode 100644
index 6366dfe..0000000
--- a/examples/platforms/utils/uart.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *  Copyright (c) 2016, The OpenThread Authors.
- *  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 the copyright holder nor the
- *     names of its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- *
- *  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 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; 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
- * @brief
- *   This file includes the platform abstraction for UART communication.
- */
-
-#ifndef OPENTHREAD_PLATFORM_UART_H_
-#define OPENTHREAD_PLATFORM_UART_H_
-
-#include <stdint.h>
-
-#include <openthread/error.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup plat-uart
- *
- * @brief
- *   This module includes the platform abstraction for UART communication.
- *
- * @{
- *
- */
-
-/**
- * Enable the UART.
- *
- * @retval OT_ERROR_NONE    Successfully enabled the UART.
- * @retval OT_ERROR_FAILED  Failed to enabled the UART.
- *
- */
-otError otPlatUartEnable(void);
-
-/**
- * Disable the UART.
- *
- * @retval OT_ERROR_NONE    Successfully disabled the UART.
- * @retval OT_ERROR_FAILED  Failed to disable the UART.
- *
- */
-otError otPlatUartDisable(void);
-
-/**
- * Send bytes over the UART.
- *
- * @param[in] aBuf        A pointer to the data buffer.
- * @param[in] aBufLength  Number of bytes to transmit.
- *
- * @retval OT_ERROR_NONE    Successfully started transmission.
- * @retval OT_ERROR_FAILED  Failed to start the transmission.
- *
- */
-otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength);
-
-/**
- * Flush the outgoing transmit buffer and wait for the data to be sent.
- * This is called when the CLI UART interface has a full buffer but still
- * wishes to send more data.
- *
- * @retval OT_ERROR_NONE                Flush succeeded, we can proceed to write more
- *                                      data to the buffer.
- *
- * @retval OT_ERROR_NOT_IMPLEMENTED     Driver does not support synchronous flush.
- * @retval OT_ERROR_INVALID_STATE       Driver has no data to flush.
- */
-otError otPlatUartFlush(void);
-
-/**
- * The UART driver calls this method to notify OpenThread that the requested bytes have been sent.
- *
- */
-extern void otPlatUartSendDone(void);
-
-/**
- * The UART driver calls this method to notify OpenThread that bytes have been received.
- *
- * @param[in]  aBuf        A pointer to the received bytes.
- * @param[in]  aBufLength  The number of bytes received.
- *
- */
-extern void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength);
-
-/**
- * @}
- *
- */
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // OPENTHREAD_PLATFORM_UART_H_
diff --git a/examples/platforms/zephyr/CMakeLists.txt b/examples/platforms/zephyr/CMakeLists.txt
deleted file mode 100644
index dcdad63..0000000
--- a/examples/platforms/zephyr/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-#  Copyright (c) 2022, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-# Intentionally empty, the file is only needed to enable "zephyr" target
-# as OT platform for CMake
diff --git a/examples/platforms/zephyr/README.md b/examples/platforms/zephyr/README.md
deleted file mode 100644
index b6e9828..0000000
--- a/examples/platforms/zephyr/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-The OpenThread stack is integrated with ZephyrOS and nRF Connect SDK.
-
-See the [Zephyr's OpenThread platform](https://github.com/zephyrproject-rtos/zephyr/tree/main/modules/openthread) and [CLI example](https://github.com/nrfconnect/sdk-nrf/tree/main/samples/openthread/cli) for more information about the integration.
diff --git a/examples/platforms/simulation/ble.c b/include/ble.c
similarity index 100%
rename from examples/platforms/simulation/ble.c
rename to include/ble.c
diff --git a/examples/platforms/simulation/dns.c b/include/dns.c
similarity index 100%
rename from examples/platforms/simulation/dns.c
rename to include/dns.c
diff --git a/examples/platforms/simulation/dnssd.c b/include/dnssd.c
similarity index 100%
rename from examples/platforms/simulation/dnssd.c
rename to include/dnssd.c
diff --git a/examples/platforms/simulation/dso_transport.c b/include/dso_transport.c
similarity index 100%
rename from examples/platforms/simulation/dso_transport.c
rename to include/dso_transport.c
diff --git a/examples/platforms/simulation/multipan.c b/include/multipan.c
similarity index 100%
rename from examples/platforms/simulation/multipan.c
rename to include/multipan.c
diff --git a/examples/platforms/utils/otns_utils.cpp b/include/openthread-config-fuchsia-legacy-extensions.h
similarity index 71%
rename from examples/platforms/utils/otns_utils.cpp
rename to include/openthread-config-fuchsia-legacy-extensions.h
index 1c8db69..75ca8c4 100644
--- a/examples/platforms/utils/otns_utils.cpp
+++ b/include/openthread-config-fuchsia-legacy-extensions.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2020, The OpenThread Authors.
+ *  Copyright (c) 2018, The OpenThread Authors.
  *  All rights reserved.
  *
  *  Redistribution and use in source and binary forms, with or without
@@ -25,15 +25,25 @@
  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  *  POSSIBILITY OF SUCH DAMAGE.
  */
-#include <openthread-core-config.h>
-#include <openthread/config.h>
 
-#include <openthread/platform/otns.h>
-#include <openthread/platform/toolchain.h>
+#ifndef OPENTHREAD_INCLUDE_OPENTHREAD_CONFIG_FUCHSIA_LEGACY_EXTENSIONS_H_
+#define OPENTHREAD_INCLUDE_OPENTHREAD_CONFIG_FUCHSIA_LEGACY_EXTENSIONS_H_
 
-#include "common/log.hpp"
+#include "openthread-config-fuchsia.h"
 
-using namespace ot;
+/**
+ * @def OPENTHREAD_CONFIG_LEGACY_ENABLE
+ * Define to 1 if you want to use legacy network support
+ *
+ */
+#define OPENTHREAD_CONFIG_LEGACY_ENABLE 1
+
+/**
+ * @def OPENTHREAD_ENABLE_VENDOR_EXTENSION
+ * Define to 1 if you want to use any kind of extensions like legacy network support.
+ *
+ */
+#define OPENTHREAD_ENABLE_VENDOR_EXTENSION 1
 
 /*
  * Implementation note:
@@ -42,7 +52,16 @@
 
 #if OPENTHREAD_CONFIG_OTNS_ENABLE
 
-OT_TOOL_WEAK
-void otPlatOtnsStatus(const char *aStatus) { LogAlways("[OTNS] %s", aStatus); }
+#include <openthread/platform/toolchain.h>
+#include "common/log.hpp"
 
+using namespace ot;
+
+OT_TOOL_WEAK
+void otPlatOtnsStatus(const char *aStatus)
+{
+    LogAlways("[OTNS] %s", aStatus);
+}
 #endif // OPENTHREAD_CONFIG_OTNS_ENABLE
+
+#endif  // OPENTHREAD_INCLUDE_OPENTHREAD_CONFIG_FUCHSIA_LEGACY_EXTENSIONS_H_
diff --git a/include/openthread-config-fuchsia.h b/include/openthread-config-fuchsia.h
new file mode 100644
index 0000000..81ea71a
--- /dev/null
+++ b/include/openthread-config-fuchsia.h
@@ -0,0 +1,247 @@
+/*
+ *  Copyright (c) 2018, The OpenThread Authors.
+ *  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 the copyright holder nor the
+ *     names of its contributors may be used to endorse or promote products
+ *     derived from this software without specific prior written permission.
+ *
+ *  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 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; 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.
+ */
+
+#ifndef THIRD_PARTY_OPENTHREAD_INCLUDE_OPENTHREAD_CONFIG_FUCHSIA_H_
+#define THIRD_PARTY_OPENTHREAD_INCLUDE_OPENTHREAD_CONFIG_FUCHSIA_H_
+
+#ifdef OPENTHREAD_CONFIG_ANDROID_VERSION_HEADER_ENABLE
+#include <openthread-config-android-version.h>
+#endif
+
+/* Define to 1 to no longer require the use of the va_list on otCliOutputCallback. */
+#define OPENTHREAD_CONFIG_CLI_PREFORMAT_OUTPUT 1
+
+/* Define to 1 to enable the DNS-SD Server API. */
+#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1
+
+/* Define to 1 to enable the SRP client API. */
+#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
+
+/* Define to 1 to enable the DNS client API. */
+#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
+
+/* Define to 1 to enable the DNS client service discovery API. */
+#define OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 1
+
+/* Define to 1 to enable the ping sender API. */
+#define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1
+
+/* Define to 0 to disable the CLI prompt. */
+#define OPENTHREAD_CONFIG_CLI_PROMPT_ENABLE 0
+
+/* Define to 1 to enable the border agent feature. */
+#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1
+
+/* Define to 1 if you want to enable Border Router */
+#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1
+
+/* Define to 1 if you want to enable Border Routing */
+#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 1
+
+/* Define to 1 if you want to enable platform UDP. */
+#define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 1
+
+/* Define to 1 if you want to enable TREL support */
+#define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE 1
+
+/* Define to 1 if you want to enable SRP server support */
+#define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 1
+
+/* Define to 1 if you want to enable support for ECDSA */
+#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
+
+/* Define to 1 to enable OpenThread's TCP API */
+#define OPENTHREAD_CONFIG_TCP_ENABLE 0
+
+/* Define to 1 if you want to enable channel manager feature */
+#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 0
+
+/* Define to 1 if you want to use channel monitor feature */
+#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE 1
+
+/* Define to 1 to enable dtls support. */
+#define OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE 1
+
+/* Define to 1 if you want to use jam detection feature */
+#define OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 1
+
+/* Define to 1 to enable the joiner role. */
+#define OPENTHREAD_CONFIG_JOINER_ENABLE 1
+
+/* Define to 1 to enable being a commissioner. */
+#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1
+
+/* Define to 1 to enable the NCP HDLC interface. */
+#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 0
+
+/* Define to 1 to enable posix platform. */
+#define OPENTHREAD_PLATFORM_POSIX 0
+
+/* Define to 1 if you want to enable Service */
+#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1
+
+/* Define to 1 if you want to enable mac filter */
+#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1
+
+/* Define to 1 if you want to enable SLAAC address management */
+#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
+
+/* OpenThread examples */
+#define OPENTHREAD_EXAMPLES none
+
+/* OpenThread diagnostic feature */
+#define OPENTHREAD_CONFIG_DIAG_ENABLE 1
+
+/* OpenThread mac filter settings */
+#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1
+
+/* Allow OOB steering data to be set */
+#define OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 1
+
+/* The settings storage path on android. */
+#define OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH "/data/thread"
+
+/* Enable radio coex capability */
+#define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 1
+
+/* Allow the log level to be adjusted dynamicly */
+#define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 1
+
+/* Set the default log level to be "note" */
+#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG
+
+/**
+ * @def OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS
+ *
+ * The maximum number of supported IPv6 multicast addresses allows to be externally added.
+ *
+ */
+#ifndef OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS
+#define OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS 32
+#endif
+
+/**
+ * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN
+ *
+ * The maximum number of children.
+ *
+ */
+#define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 128
+
+/**
+ * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE
+ *
+ * Rx frame buffer in openthread
+ *
+ */
+#define OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE 65535
+
+// The number of outstanding message buffers allowed to be allocated.
+#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 512
+
+/**
+ * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
+ *
+ * Mandatory for 1.2+ FTD for 1.2 low power feature
+ *
+ */
+#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1
+
+/**
+ * @def OPENTHREAD_CONFIG_MLR_ENABLE
+ *
+ * Set to 1 to Enable Multicast Listener Registration
+ *
+ */
+#define OPENTHREAD_CONFIG_MLR_ENABLE 1
+
+/**
+ * @def OPENTHREAD_CONFIG_MLR_ENABLE
+ *
+ * Set to 1 to enable Backbone Router features
+ *
+ */
+#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1
+
+/**
+ * @def OPENTHREAD_CONFIG_MLR_ENABLE
+ *
+ * Set to 1 to Enable Multicast Routing on Backbone Link
+ *
+ */
+#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE 1
+
+/**
+ * @def OPENTHREAD_CONFIG_UPTIME_ENABLE
+ *
+ * Define to 1 to enable tracking the uptime of OpenThread instance.
+ *
+ */
+#define OPENTHREAD_CONFIG_UPTIME_ENABLE 1
+
+/**
+ * This is needed for fuchsia to compile for the change:
+ * https://github.com/openthread/openthread/commit/287ff433fb20279d444ffdb1b5a49678d6c847f6
+ */
+#define OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL (60 * 1000 * 1000)
+
+/**
+ * @def OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE
+ *
+ * Define to 1 to crash OpenThread once the RCP crashes.
+ *
+ */
+#define OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE 1
+
+/**
+ * @def OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE
+ *
+ * Define to 1 to enable NAT64 Translator in OpenThread instance.
+ *
+ */
+#define OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE 1
+
+// Needed to make sure the DHCPv6 is supported.
+#define OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE 1
+
+/**
+ * @def OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE
+ *
+ * Define to 1 to enable NAT64 in OpenThread instance.
+ *
+ */
+#define OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE 1
+
+/**
+ * @def OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE
+ *
+ * Define to 0 for now as Fuchsia platform have a conflict for this feature
+ *
+ */
+#define OPENTHREAD_CONFIG_BORDER_ROUTING_USE_HEAP_ENABLE 0
+#endif // THIRD_PARTY_OPENTHREAD_INCLUDE_OPENTHREAD_CONFIG_FUCHSIA_H_
diff --git a/include/openthread/BUILD.gn b/include/openthread/BUILD.gn
index 5948fb7..88680fc 100644
--- a/include/openthread/BUILD.gn
+++ b/include/openthread/BUILD.gn
@@ -37,6 +37,20 @@
   public_configs = [ "../..:openthread_config" ]
 }
 
+
+source_set("openthread_config_legacy_extensions") {
+  public = [ "config.h" ]
+
+  if (openthread_config_file == "") {
+    public_deps = [ ":openthread_config_generic" ]
+  } else {
+    public_deps = openthread_config_deps
+  }
+
+  public_configs = [ "../..:openthread_config_legacy_extensions" ]
+}
+
+
 source_set("openthread") {
   public = [
     "backbone_router.h",
@@ -129,3 +143,77 @@
 
   public_deps = [ ":openthread_config" ]
 }
+
+source_set("openthread_legacy_extensions") {
+  public = [
+    "backbone_router.h",
+    "backbone_router_ftd.h",
+    "border_agent.h",
+    "border_router.h",
+    "channel_manager.h",
+    "channel_monitor.h",
+    "child_supervision.h",
+    "cli.h",
+    "coap.h",
+    "coap_secure.h",
+    "commissioner.h",
+    "config.h",
+    "crypto.h",
+    "dataset.h",
+    "dataset_ftd.h",
+    "dataset_updater.h",
+    "diag.h",
+    "dns.h",
+    "dns_client.h",
+    "entropy.h",
+    "error.h",
+    "heap.h",
+    "icmp6.h",
+    "instance.h",
+    "ip6.h",
+    "jam_detection.h",
+    "joiner.h",
+    "link.h",
+    "link_metrics.h",
+    "link_raw.h",
+    "logging.h",
+    "message.h",
+    "multi_radio.h",
+    "ncp.h",
+    "netdata.h",
+    "netdiag.h",
+    "network_time.h",
+    "ping_sender.h",
+    "platform/alarm-micro.h",
+    "platform/alarm-milli.h",
+    "platform/debug_uart.h",
+    "platform/diag.h",
+    "platform/entropy.h",
+    "platform/flash.h",
+    "platform/infra_if.h",
+    "platform/logging.h",
+    "platform/memory.h",
+    "platform/messagepool.h",
+    "platform/misc.h",
+    "platform/otns.h",
+    "platform/radio.h",
+    "platform/settings.h",
+    "platform/spi-slave.h",
+    "platform/time.h",
+    "platform/toolchain.h",
+    "platform/trel-udp6.h",
+    "platform/udp.h",
+    "random_crypto.h",
+    "random_noncrypto.h",
+    "server.h",
+    "sntp.h",
+    "srp_client.h",
+    "srp_server.h",
+    "tasklet.h",
+    "thread.h",
+    "thread_ftd.h",
+    "udp.h",
+  ]
+
+  public_deps = [ ":openthread_config_legacy_extensions" ]
+}
diff --git a/include/openthread/platform/logging.h b/include/openthread/platform/logging.h
index 20235df..e9f5cfa 100644
--- a/include/openthread/platform/logging.h
+++ b/include/openthread/platform/logging.h
@@ -162,7 +162,7 @@
 void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...);
 
 /**
- * Handles OpenThread log level changes.
+ * This function handles OpenThread log level changes.
  *
  * This platform function is called whenever the OpenThread log level changes.
  * This platform function is optional since an empty weak implementation has been provided.
diff --git a/examples/platforms/utils/uart_rtt.c b/include/uart_rtt.c
similarity index 100%
rename from examples/platforms/utils/uart_rtt.c
rename to include/uart_rtt.c
diff --git a/examples/platforms/utils/uart_rtt.h b/include/uart_rtt.h
similarity index 100%
rename from examples/platforms/utils/uart_rtt.h
rename to include/uart_rtt.h
diff --git a/openthread_upstream_version.gni b/openthread_upstream_version.gni
new file mode 100644
index 0000000..d4d9111
--- /dev/null
+++ b/openthread_upstream_version.gni
@@ -0,0 +1,3 @@
+# This file is added to support soft-transition in Fuchsia.
+
+openthread_upstream_version = "49c59ec519cc8b49dd58978d1bc80b7ae7ba88d0"
diff --git a/src/cli/BUILD.gn b/src/cli/BUILD.gn
index 318a4d0..d37de23 100644
--- a/src/cli/BUILD.gn
+++ b/src/cli/BUILD.gn
@@ -87,3 +87,17 @@
   public_configs = [":cli_config"]
   visibility = [ "../../*" ]
 }
+
+static_library("libopenthread-cli-ftd-legacy-extensions") {
+  sources = openthread_cli_sources
+  public_deps = [ "../core:libopenthread-ftd-legacy-extensions" ]
+  public_configs = [":cli_config"]
+  visibility = [ "../../*" ]
+}
+
+static_library("libopenthread-cli-mtd-legacy-extensions") {
+  sources = openthread_cli_sources
+  public_deps = [ "../core:libopenthread-mtd-legacy-extensions" ]
+  public_configs = [":cli_config"]
+  visibility = [ "../../*" ]
+}
diff --git a/src/cli/cli_output.cpp b/src/cli/cli_output.cpp
index c70eacd..679f045 100644
--- a/src/cli/cli_output.cpp
+++ b/src/cli/cli_output.cpp
@@ -287,7 +287,13 @@
     va_copy(args, aArguments);
 #endif
 
+#if OPENTHREAD_CONFIG_CLI_PREFORMAT_OUTPUT
+    char outputString[kInputOutputLogStringSize];
+    vsnprintf(outputString, sizeof(outputString) - 1, aFormat, aArguments);
+    mCallback(mCallbackContext, outputString, aArguments);
+#else
     mCallback(mCallbackContext, aFormat, aArguments);
+#endif
 
 #if OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE
     VerifyOrExit(mEmittingCommandOutput);
diff --git a/src/core/BUILD.gn b/src/core/BUILD.gn
index a866cd0..c7ee0fa 100644
--- a/src/core/BUILD.gn
+++ b/src/core/BUILD.gn
@@ -275,6 +275,7 @@
 config("core_config") {
   defines = []
   configs = []
+  cflags = [ "-Wno-ambiguous-reversed-operator" ]
 
   if (openthread_project_core_config_file != "") {
     defines += [ "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${openthread_project_core_config_file}\"" ]
@@ -840,6 +841,52 @@
   public_deps += openthread_core_config_deps
 }
 
+source_set("libopenthread_core_config_legacy_extensions") {
+  public = [
+    "config/announce_sender.h",
+    "config/backbone_router.h",
+    "config/border_router.h",
+    "config/channel_manager.h",
+    "config/channel_monitor.h",
+    "config/child_supervision.h",
+    "config/coap.h",
+    "config/commissioner.h",
+    "config/dataset_updater.h",
+    "config/dhcp6_client.h",
+    "config/dhcp6_server.h",
+    "config/diag.h",
+    "config/dns_client.h",
+    "config/dnssd_server.h",
+    "config/dtls.h",
+    "config/ip6.h",
+    "config/joiner.h",
+    "config/link_quality.h",
+    "config/link_raw.h",
+    "config/logging.h",
+    "config/mac.h",
+    "config/mle.h",
+    "config/openthread-core-config-check.h",
+    "config/openthread-core-default-config.h",
+    "config/parent_search.h",
+    "config/ping_sender.h",
+    "config/platform.h",
+    "config/radio_link.h",
+    "config/sntp_client.h",
+    "config/srp_client.h",
+    "config/srp_server.h",
+    "config/time_sync.h",
+    "config/tmf.h",
+    "openthread-core-config.h",
+  ]
+  public_configs = [
+    ":core_config",
+    "../..:openthread_config_legacy_extensions",
+  ]
+  public_deps =
+      [ "../../include/openthread:openthread_config_legacy_extensions" ]
+  public_deps += openthread_core_config_deps
+}
+
 source_set("libopenthread_core_headers") {
   public = openthread_core_headers
   public_deps = [
@@ -849,6 +896,15 @@
   visibility += [ "*" ]
 }
 
+source_set("libopenthread_core_headers_legacy_extensions") {
+  public = openthread_core_headers
+  public_deps = [
+    ":libopenthread_core_config_legacy_extensions",
+    "../../include/openthread:openthread_legacy_extensions",
+  ]
+  visibility += [ "*" ]
+}
+
 group("libopenthread_platform") {
   public_deps = []
   if (openthread_external_platform != "") {
@@ -860,20 +916,49 @@
   ]
 }
 
+group("libopenthread_platform_legacy_extensions") {
+  public_deps = []
+  if (openthread_external_platform != "") {
+    public_deps += [ openthread_external_platform ]
+  }
+  public_deps += [
+    ":libopenthread_core_headers_legacy_extensions",
+    "${mbedtls_target}" + ":mbedtls_legacy_extensions",
+  ]
+}
+
 static_library("libopenthread-ftd") {
   sources = openthread_core_sources
   public_deps = [ ":libopenthread_platform" ]
   public_configs = [ "../..:openthread_ftd_config" ]
 }
 
+static_library("libopenthread-ftd-legacy-extensions") {
+  sources = openthread_core_sources
+  public_deps = [ ":libopenthread_platform_legacy_extensions" ]
+  public_configs = [ "../..:openthread_ftd_config" ]
+}
+
 static_library("libopenthread-mtd") {
   sources = openthread_core_sources
   public_deps = [ ":libopenthread_platform" ]
   public_configs = [ "../..:openthread_mtd_config" ]
 }
 
+static_library("libopenthread-mtd-legacy-extensions") {
+  sources = openthread_core_sources
+  public_deps = [ ":libopenthread_platform_legacy_extensions" ]
+  public_configs = [ "../..:openthread_mtd_config" ]
+}
+
 static_library("libopenthread-radio") {
   sources = openthread_radio_sources
   public_deps = [ ":libopenthread_platform" ]
   public_configs = [ "../..:openthread_radio_config" ]
 }
+
+static_library("libopenthread-radio-legacy-extensions") {
+  sources = openthread_radio_sources
+  public_deps = [ ":libopenthread_platform_legacy_extensions" ]
+  public_configs = [ "../..:openthread_radio_config" ]
+}
diff --git a/src/core/common/heap_allocatable.hpp b/src/core/common/heap_allocatable.hpp
index b51018d..441bf0c 100644
--- a/src/core/common/heap_allocatable.hpp
+++ b/src/core/common/heap_allocatable.hpp
@@ -39,7 +39,10 @@
 #include "common/code_utils.hpp"
 #include "common/error.hpp"
 #include "common/heap.hpp"
+
+#ifndef __Fuchsia__
 #include "common/new.hpp"
+#endif
 
 namespace ot {
 namespace Heap {
diff --git a/src/core/common/heap_array.hpp b/src/core/common/heap_array.hpp
index a4f549a..833d92b 100644
--- a/src/core/common/heap_array.hpp
+++ b/src/core/common/heap_array.hpp
@@ -43,7 +43,7 @@
 #include "common/code_utils.hpp"
 #include "common/error.hpp"
 #include "common/heap.hpp"
-#include "common/new.hpp"
+//#include "common/new.hpp"
 
 namespace ot {
 namespace Heap {
diff --git a/src/core/meshcop/border_agent.cpp b/src/core/meshcop/border_agent.cpp
index 142c606..7678942 100644
--- a/src/core/meshcop/border_agent.cpp
+++ b/src/core/meshcop/border_agent.cpp
@@ -40,7 +40,6 @@
 #include "common/heap.hpp"
 #include "common/locator_getters.hpp"
 #include "common/log.hpp"
-#include "common/owned_ptr.hpp"
 #include "common/settings.hpp"
 #include "instance/instance.hpp"
 #include "meshcop/meshcop.hpp"
@@ -57,10 +56,10 @@
 //----------------------------------------------------------------------------------------------------------------------
 // `BorderAgent::ForwardContext`
 
-Error BorderAgent::ForwardContext::Init(Instance            &aInstance,
-                                        const Coap::Message &aMessage,
-                                        bool                 aPetition,
-                                        bool                 aSeparate)
+void BorderAgent::ForwardContext::Init(Instance            &aInstance,
+                                       const Coap::Message &aMessage,
+                                       bool                 aPetition,
+                                       bool                 aSeparate)
 {
     InstanceLocatorInit::Init(aInstance);
     mMessageId   = aMessage.GetMessageId();
@@ -69,11 +68,9 @@
     mType        = aMessage.GetType();
     mTokenLength = aMessage.GetTokenLength();
     memcpy(mToken, aMessage.GetToken(), mTokenLength);
-
-    return kErrorNone;
 }
 
-Error BorderAgent::ForwardContext::ToHeader(Coap::Message &aMessage, uint8_t aCode) const
+Error BorderAgent::ForwardContext::ToHeader(Coap::Message &aMessage, uint8_t aCode)
 {
     if ((mType == Coap::kTypeNonConfirmable) || mSeparate)
     {
@@ -117,7 +114,7 @@
     return code;
 }
 
-void BorderAgent::SendErrorMessage(const ForwardContext &aForwardContext, Error aError)
+void BorderAgent::SendErrorMessage(ForwardContext &aForwardContext, Error aError)
 {
     Error          error   = kErrorNone;
     Coap::Message *message = nullptr;
@@ -173,14 +170,12 @@
 {
     OT_UNUSED_VARIABLE(aMessageInfo);
 
-    OwnedPtr<ForwardContext> forwardContext(static_cast<ForwardContext *>(aContext));
+    ForwardContext &forwardContext = *static_cast<ForwardContext *>(aContext);
 
-    forwardContext->Get<BorderAgent>().HandleCoapResponse(*forwardContext.Get(), AsCoapMessagePtr(aMessage), aResult);
+    forwardContext.Get<BorderAgent>().HandleCoapResponse(forwardContext, AsCoapMessagePtr(aMessage), aResult);
 }
 
-void BorderAgent::HandleCoapResponse(const ForwardContext &aForwardContext,
-                                     const Coap::Message  *aResponse,
-                                     Error                 aResult)
+void BorderAgent::HandleCoapResponse(ForwardContext &aForwardContext, const Coap::Message *aResponse, Error aResult)
 {
     Coap::Message *message = nullptr;
     Error          error;
@@ -228,6 +223,8 @@
 
         SendErrorMessage(aForwardContext, error);
     }
+
+    Heap::Free(&aForwardContext);
 }
 
 BorderAgent::BorderAgent(Instance &aInstance)
@@ -519,12 +516,12 @@
 
 Error BorderAgent::ForwardToLeader(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo, Uri aUri)
 {
-    Error                    error = kErrorNone;
-    OwnedPtr<ForwardContext> forwardContext;
-    Tmf::MessageInfo         messageInfo(GetInstance());
-    Coap::Message           *message  = nullptr;
-    bool                     petition = false;
-    bool                     separate = false;
+    Error            error          = kErrorNone;
+    ForwardContext  *forwardContext = nullptr;
+    Tmf::MessageInfo messageInfo(GetInstance());
+    Coap::Message   *message  = nullptr;
+    bool             petition = false;
+    bool             separate = false;
 
     VerifyOrExit(mState != kStateStopped);
 
@@ -546,8 +543,10 @@
         SuccessOrExit(error = Get<Tmf::SecureAgent>().SendAck(aMessage, aMessageInfo));
     }
 
-    forwardContext.Reset(ForwardContext::AllocateAndInit(GetInstance(), aMessage, petition, separate));
-    VerifyOrExit(!forwardContext.IsNull(), error = kErrorNoBufs);
+    forwardContext = static_cast<ForwardContext *>(Heap::CAlloc(1, sizeof(ForwardContext)));
+    VerifyOrExit(forwardContext != nullptr, error = kErrorNoBufs);
+
+    forwardContext->Init(GetInstance(), aMessage, petition, separate);
 
     message = Get<Tmf::Agent>().NewPriorityConfirmablePostMessage(aUri);
     VerifyOrExit(message != nullptr, error = kErrorNoBufs);
@@ -558,14 +557,10 @@
     SuccessOrExit(error = messageInfo.SetSockAddrToRlocPeerAddrToLeaderAloc());
     messageInfo.SetSockPortToTmf();
 
-    SuccessOrExit(error =
-                      Get<Tmf::Agent>().SendMessage(*message, messageInfo, HandleCoapResponse, forwardContext.Get()));
+    SuccessOrExit(error = Get<Tmf::Agent>().SendMessage(*message, messageInfo, HandleCoapResponse, forwardContext));
 
-    // Release the ownership of `forwardContext` since `SendMessage()`
-    // will own it. We take back ownership from `HandleCoapResponse()`
-    // callback.
-
-    forwardContext.Release();
+    // HandleCoapResponse is responsible to free this forward context.
+    forwardContext = nullptr;
 
     LogInfo("Forwarded request to leader on %s", PathForUri(aUri));
 
@@ -574,6 +569,11 @@
 
     if (error != kErrorNone)
     {
+        if (forwardContext != nullptr)
+        {
+            Heap::Free(forwardContext);
+        }
+
         FreeMessage(message);
         SendErrorMessage(aMessage, separate, error);
     }
diff --git a/src/core/meshcop/border_agent.hpp b/src/core/meshcop/border_agent.hpp
index 9f721d6..76d2938 100644
--- a/src/core/meshcop/border_agent.hpp
+++ b/src/core/meshcop/border_agent.hpp
@@ -41,7 +41,6 @@
 #include <openthread/border_agent.h>
 
 #include "common/as_core_type.hpp"
-#include "common/heap_allocatable.hpp"
 #include "common/locator.hpp"
 #include "common/non_copyable.hpp"
 #include "common/notifier.hpp"
@@ -154,13 +153,13 @@
     static constexpr uint16_t kUdpPort          = OPENTHREAD_CONFIG_BORDER_AGENT_UDP_PORT;
     static constexpr uint32_t kKeepAliveTimeout = 50 * 1000; // Timeout to reject a commissioner (in msec)
 
-    class ForwardContext : public InstanceLocatorInit, public Heap::Allocatable<ForwardContext>
+    class ForwardContext : public InstanceLocatorInit
     {
     public:
-        Error    Init(Instance &aInstance, const Coap::Message &aMessage, bool aPetition, bool aSeparate);
+        void     Init(Instance &aInstance, const Coap::Message &aMessage, bool aPetition, bool aSeparate);
         bool     IsPetition(void) const { return mPetition; }
         uint16_t GetMessageId(void) const { return mMessageId; }
-        Error    ToHeader(Coap::Message &aMessage, uint8_t aCode) const;
+        Error    ToHeader(Coap::Message &aMessage, uint8_t aCode);
 
     private:
         uint16_t mMessageId;                             // The CoAP Message ID of the original request.
@@ -175,7 +174,7 @@
 
     Coap::Message::Code CoapCodeFromError(Error aError);
     Error               SendMessage(Coap::Message &aMessage);
-    void                SendErrorMessage(const ForwardContext &aForwardContext, Error aError);
+    void                SendErrorMessage(ForwardContext &aForwardContext, Error aError);
     void                SendErrorMessage(const Coap::Message &aRequest, bool aSeparate, Error aError);
 
     static void HandleConnected(bool aConnected, void *aContext);
@@ -189,9 +188,9 @@
                                    otMessage           *aMessage,
                                    const otMessageInfo *aMessageInfo,
                                    Error                aResult);
-    void  HandleCoapResponse(const ForwardContext &aForwardContext, const Coap::Message *aResponse, Error aResult);
-    Error ForwardToLeader(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo, Uri aUri);
-    Error ForwardToCommissioner(Coap::Message &aForwardMessage, const Message &aMessage);
+    void        HandleCoapResponse(ForwardContext &aForwardContext, const Coap::Message *aResponse, Error aResult);
+    Error       ForwardToLeader(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo, Uri aUri);
+    Error       ForwardToCommissioner(Coap::Message &aForwardMessage, const Message &aMessage);
     static bool HandleUdpReceive(void *aContext, const otMessage *aMessage, const otMessageInfo *aMessageInfo);
     bool        HandleUdpReceive(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
 
diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp
index df1aa25..99531a1 100644
--- a/src/core/thread/mesh_forwarder.cpp
+++ b/src/core/thread/mesh_forwarder.cpp
@@ -83,7 +83,6 @@
         // layer. As a result, `GetKeyIdMode()` will never return
         // failure here.
         IgnoreError(aFrame.GetKeyIdMode(keyIdMode));
-
         mLinkSecurity = (keyIdMode == Mac::Frame::kKeyIdMode0) || (keyIdMode == Mac::Frame::kKeyIdMode1);
     }
     else
diff --git a/src/lib/spinel/BUILD.gn b/src/lib/spinel/BUILD.gn
index f03d945..33e0eb1 100644
--- a/src/lib/spinel/BUILD.gn
+++ b/src/lib/spinel/BUILD.gn
@@ -85,3 +85,23 @@
   ]
   public_configs = [ ":spinel_config_openthread_message_disable" ]
 }
+
+static_library("libopenthread-spinel-ncp-legacy-extensions") {
+  sources = spinel_sources
+  public_deps = [
+    ":spinel-api",
+    "../../core:libopenthread_core_headers_legacy_extensions",
+    "../platform:libopenthread-platform",
+  ]
+  public_configs = [ ":spinel_config_openthread_message_enable" ]
+}
+
+static_library("libopenthread-spinel-rcp-legacy-extensions") {
+  sources = spinel_sources
+  public_deps = [
+    ":spinel-api",
+    "../../core:libopenthread_core_headers_legacy_extensions",
+    "../platform:libopenthread-platform",
+  ]
+  public_configs = [ ":spinel_config_openthread_message_disable" ]
+}
diff --git a/src/ncp/BUILD.gn b/src/ncp/BUILD.gn
index 2bb9981..8ca5bbc 100644
--- a/src/ncp/BUILD.gn
+++ b/src/ncp/BUILD.gn
@@ -59,6 +59,16 @@
   visibility = [ "../../*" ]
 }
 
+static_library("libopenthread-ncp-ftd-legacy-extensions") {
+  sources = openthread_ncp_sources
+  public_deps = [
+    "../core:libopenthread-ftd-legacy-extensions",
+    "../lib/spinel:libopenthread-spinel-ncp-legacy-extensions",
+  ]
+  public_configs = [ ":ncp_config" ]
+  visibility = [ "../../*" ]
+}
+
 static_library("libopenthread-ncp-mtd") {
   sources = openthread_ncp_sources
   public_deps = [
@@ -69,6 +79,16 @@
   visibility = [ "../../*" ]
 }
 
+static_library("libopenthread-ncp-mtd-legacy-extensions") {
+  sources = openthread_ncp_sources
+  public_deps = [
+    "../core:libopenthread-mtd-legacy-extensions",
+    "../lib/spinel:libopenthread-spinel-ncp-legacy-extensions",
+  ]
+  public_configs = [ ":ncp_config" ]
+  visibility = [ "../../*" ]
+}
+
 static_library("libopenthread-rcp") {
   sources = openthread_ncp_sources
   public_deps = [
@@ -78,3 +98,13 @@
   public_configs = [ ":ncp_config" ]
   visibility = [ "../../*" ]
 }
+
+static_library("libopenthread-rcp-legacy-extensions") {
+  sources = openthread_ncp_sources
+  public_deps = [
+    "../core:libopenthread-radio-legacy-extensions",
+    "../lib/spinel:libopenthread-spinel-rcp-legacy-extensions",
+  ]
+  public_configs = [ ":ncp_config" ]
+  visibility = [ "../../*" ]
+}
diff --git a/tests/scripts/expect/cli_non_rcp-radiostats.exp b/tests/scripts/expect/cli_non_rcp-radiostats.exp
deleted file mode 100755
index 2dcdabd..0000000
--- a/tests/scripts/expect/cli_non_rcp-radiostats.exp
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/expect -f
-#
-#  Copyright (c) 2023, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-source "tests/scripts/expect/_common.exp"
-source "tests/scripts/expect/_multinode.exp"
-
-setup_two_nodes "-"
-
-switch_node 2
-set addr [get_ipaddr mleid]
-send "pollperiod 3000\n"
-expect_line "Done"
-send "radio stats clear\n"
-expect_line "Done"
-
-switch_node 1
-for {set i 1} {$i <= 10} {incr i} {
-    send "ping $addr\n"
-    sleep 3
-    expect "16 bytes from $addr: icmp_seq="
-}
-
-switch_node 2
-send "radio stats\n"
-expect_line "Radio Statistics:"
-expect -re {Total Time: \d+\.\d+s}
-expect -re {Tx Time: \d+\.\d+s \(\d+\.\d+%\)}
-expect -re {Rx Time: \d+\.\d+s \(\d+\.\d+%\)}
-expect -re {Sleep Time: \d+\.\d+s \(\d+\.\d+%\)}
-expect -re {Disabled Time: \d+\.\d+s \(\d+\.\d+%\)}
-dispose_all
diff --git a/tests/scripts/expect/posix-channel-mask.exp b/tests/scripts/expect/posix-channel-mask.exp
deleted file mode 100644
index d754fea..0000000
--- a/tests/scripts/expect/posix-channel-mask.exp
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/expect -f
-#
-#  Copyright (c) 2023, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-source "tests/scripts/expect/_common.exp"
-
-spawn_node 1
-
-send "channel supported\n"
-expect "0x7fff800"
-expect_line "Done"
-
-send "channel preferred\n"
-expect "0x7fff800"
-expect_line "Done"
-
-send "region US\n"
-expect_line "Done"
-
-send "channel supported\n"
-expect "0x7fff800"
-expect_line "Done"
-
-send "channel preferred\n"
-expect "0x3fff800"
-expect_line "Done"
-
-send "region WW\n"
-expect_line "Done"
-
-send "channel supported\n"
-expect "0x3fff800"
-expect_line "Done"
-
-send "channel preferred\n"
-expect "0x1fff800"
-expect_line "Done"
-
-send "region US\n"
-expect_line "Done"
-
-send "channel supported\n"
-expect "0x7fff800"
-expect_line "Done"
-
-send "dataset init new\n"
-expect_line "Done"
-send "dataset channel 26\n"
-expect_line "Done"
-send "dataset commit active\n"
-expect_line "Done"
-
-attach "leader"
-
-send "channel\n"
-expect "26"
-expect_line "Done"
-
-send "region WW\n"
-expect_line "Done"
-
-wait_for "state" "disabled"
-expect_line "Done"
-
-send "channel supported\n"
-expect "0x3fff800"
-expect_line "Done"
-
-send "channel\n"
-expect "26"
-expect_line "Done"
-
-dispose_node 1
diff --git a/tests/scripts/expect/v1_2-linkmetricsmgr.exp b/tests/scripts/expect/v1_2-linkmetricsmgr.exp
deleted file mode 100755
index 4746e89..0000000
--- a/tests/scripts/expect/v1_2-linkmetricsmgr.exp
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/expect -f
-#
-#  Copyright (c) 2023, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-source "tests/scripts/expect/_common.exp"
-source "tests/scripts/expect/_multinode.exp"
-
-setup_two_nodes
-
-switch_node 1
-send "linkmetricsmgr enable\n"
-expect_line "Done"
-
-sleep 10
-
-switch_node 2
-set addr [get_ipaddr mleid]
-
-switch_node 1
-send "ping $addr\n"
-expect "16 bytes from $addr: icmp_seq=1"
-send "linkmetricsmgr show\n"
-expect -re {ExtAddr:([0-9a-f]){16}, LinkMargin:\d+, Rssi:\-?\d+}
-expect "Done"
-
-sleep 5
-
-send "linkmetricsmgr disable\n"
-expect_line "Done"
-send "linkmetricsmgr show\n"
-expect_line "Done"
-send "linkmetricsmgr xxx\n"
-expect_line "InvalidCommand"
-
-dispose_all
diff --git a/third_party/build_gn/BUILDCONFIG.gn b/third_party/build_gn/BUILDCONFIG.gn
deleted file mode 100644
index f9202d9..0000000
--- a/third_party/build_gn/BUILDCONFIG.gn
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-if (target_os == "") {
-  target_os = host_os
-}
-if (target_cpu == "") {
-  target_cpu = host_cpu
-}
-if (current_cpu == "") {
-  current_cpu = target_cpu
-}
-if (current_os == "") {
-  current_os = target_os
-}
-
-set_default_toolchain("//third_party/build_gn/toolchain:gcc")
diff --git a/third_party/build_gn/README.md b/third_party/build_gn/README.md
deleted file mode 100644
index 0430d11..0000000
--- a/third_party/build_gn/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# build_gn
-
-## URL
-
-https://gn.googlesource.com/gn/+/refs/heads/master/examples/simple_build/build
-
-## License
-
-BSD 3-Clause
-
-## License File
-
-[LICENSE](https://gn.googlesource.com/gn/+/refs/heads/master/LICENSE)
-
-## Description
-
-gn is metabuild system that generates ninja files for further compilation 
-
-gn tool requires paths to all the toolchains to be used for compilation, for
-example compiler, linker etc. The toolchains in toolchain/BUILD.gn are from the
-examples repository for gn. BUILDCONFIG.gn is also trimmed down version from
-examples/simple_build/build/
diff --git a/third_party/build_gn/toolchain/BUILD.gn b/third_party/build_gn/toolchain/BUILD.gn
deleted file mode 100644
index 64df6a8..0000000
--- a/third_party/build_gn/toolchain/BUILD.gn
+++ /dev/null
@@ -1,74 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-toolchain("gcc") {
-  tool("cc") {
-    depfile = "{{output}}.d"
-    command = "gcc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
-    depsformat = "gcc"
-    description = "CC {{output}}"
-    outputs = [
-      "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
-    ]
-  }
-  tool("cxx") {
-    depfile = "{{output}}.d"
-    command = "g++ -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
-    depsformat = "gcc"
-    description = "CXX {{output}}"
-    outputs = [
-      "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
-    ]
-  }
-  tool("alink") {
-    rspfile = "{{output}}.rsp"
-    command = "rm -f {{output}} && ar rcs {{output}} @$rspfile"
-    description = "AR {{target_output_name}}{{output_extension}}"
-    rspfile_content = "{{inputs}}"
-    outputs = [
-      "{{target_out_dir}}/{{target_output_name}}{{output_extension}}",
-    ]
-    default_output_extension = ".a"
-    output_prefix = "lib"
-  }
-  tool("solink") {
-    soname = "{{target_output_name}}{{output_extension}}"  # e.g. "libfoo.so".
-    sofile = "{{output_dir}}/$soname"
-    rspfile = soname + ".rsp"
-    command = "g++ -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile"
-    rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}"
-    description = "SOLINK $soname"
-    # Use this for {{output_extension}} expansions unless a target manually
-    # overrides it (in which case {{output_extension}} will be what the target
-    # specifies).
-    default_output_extension = ".so"
-    # Use this for {{output_dir}} expansions unless a target manually overrides
-    # it (in which case {{output_dir}} will be what the target specifies).
-    default_output_dir = "{{root_out_dir}}"
-    outputs = [
-      sofile,
-    ]
-    link_output = sofile
-    depend_output = sofile
-    output_prefix = "lib"
-  }
-  tool("link") {
-    outfile = "{{target_output_name}}{{output_extension}}"
-    rspfile = "$outfile.rsp"
-    command = "g++ {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}"
-    description = "LINK $outfile"
-    default_output_dir = "{{root_out_dir}}"
-    rspfile_content = "{{inputs}}"
-    outputs = [
-      outfile,
-    ]
-  }
-  tool("stamp") {
-    command = "touch {{output}}"
-    description = "STAMP {{output}}"
-  }
-  tool("copy") {
-    command = "cp -af {{source}} {{output}}"
-    description = "COPY {{source}} {{output}}"
-  }
-}
diff --git a/third_party/jlink/CMakeLists.txt b/third_party/jlink/CMakeLists.txt
deleted file mode 100644
index 5160bbb..0000000
--- a/third_party/jlink/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-#  Copyright (c) 2020, The OpenThread Authors.
-#  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 the copyright holder nor the
-#     names of its contributors may be used to endorse or promote products
-#     derived from this software without specific prior written permission.
-#
-#  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 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; 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.
-#
-
-string(REPLACE "-Wundef" "" OT_CFLAGS "${OT_CFLAGS}")
-add_library(jlinkrtt
-    SEGGER_RTT_V640/RTT/SEGGER_RTT.c
-)
-
-target_include_directories(jlinkrtt PRIVATE
-    ${PROJECT_SOURCE_DIR}/include
-)
diff --git a/third_party/jlink/README.md b/third_party/jlink/README.md
deleted file mode 100644
index c247738..0000000
--- a/third_party/jlink/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# SEGGER RTT
-
-## URL
-
-https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/
-
-## Version
-
-6.40
-
-## License File
-
-[LICENSE](SEGGER_RTT_V640/License.txt)
-
-## Description
-
-With RTT it is possible to output information from the target microcontroller as
-well as sending input to the application at a very high speed without affecting
-the target's real time behavior. SEGGER RTT can be used with any J-Link model and
-any supported target processor which allows background memory access, which are
-Cortex-M and RX targets. 
diff --git a/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_InputEchoApp.c b/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_InputEchoApp.c
deleted file mode 100644
index 5b453bf..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_InputEchoApp.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*       Solutions for real time microcontroller applications         *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-
---------- END-OF-HEADER --------------------------------------------
-File    : Main_RTT_MenuApp.c
-Purpose : Sample application to demonstrate RTT bi-directional functionality
-*/
-
-#define MAIN_C
-
-#include <stdio.h>
-
-#include "SEGGER_RTT.h"
-
-volatile int _Cnt;
-volatile int _Delay;
-
-static char r;
-
-/*********************************************************************
-*
-*       main
-*/
-void main(void) {
-
-  SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n");
-  SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
-  do {
-    r = SEGGER_RTT_WaitKey();
-    SEGGER_RTT_Write(0, &r, 1);
-    r++;
-  } while (1);
-}
-
-/*************************** End of file ****************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_MenuApp.c b/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_MenuApp.c
deleted file mode 100644
index 4dbcc84..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_MenuApp.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*       Solutions for real time microcontroller applications         *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
---------- END-OF-HEADER --------------------------------------------
-File    : Main_RTT_MenuApp.c
-Purpose : Sample application to demonstrate RTT bi-directional functionality
-*/
-
-#define MAIN_C
-
-#include <stdio.h>
-
-#include "SEGGER_RTT.h"
-
-volatile int _Cnt;
-volatile int _Delay;
-
-/*********************************************************************
-*
-*       main
-*/
-void main(void) {
-  int r;
-  int CancelOp;
-
-  do {
-    _Cnt = 0;
-
-    SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n");
-    SEGGER_RTT_WriteString(0, "Press <1> to continue in blocking mode (Application waits if necessary, no data lost)\r\n");
-    SEGGER_RTT_WriteString(0, "Press <2> to continue in non-blocking mode (Application does not wait, data lost if fifo full)\r\n");
-    do {
-      r = SEGGER_RTT_WaitKey();
-    } while ((r != '1') && (r != '2'));
-    if (r == '1') {
-      SEGGER_RTT_WriteString(0, "\r\nSelected <1>. Configuring RTT and starting...\r\n");
-      SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
-    } else {
-      SEGGER_RTT_WriteString(0, "\r\nSelected <2>. Configuring RTT and starting...\r\n");
-      SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
-    }
-    CancelOp = 0;
-    do {
-      //for (_Delay = 0; _Delay < 10000; _Delay++);
-      SEGGER_RTT_printf(0, "Count: %d. Press <Space> to get back to menu.\r\n", _Cnt++);
-      r = SEGGER_RTT_HasKey();
-      if (r) {
-        CancelOp = (SEGGER_RTT_GetKey() == ' ') ? 1 : 0;
-      }
-      //
-      // Check if user selected to cancel the current operation
-      //
-      if (CancelOp) {
-        SEGGER_RTT_WriteString(0, "Operation cancelled, going back to menu...\r\n");
-        break;
-      }
-    } while (1);
-    SEGGER_RTT_GetKey();
-    SEGGER_RTT_WriteString(0, "\r\n");
-  } while (1);
-}
-
-/*************************** End of file ****************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_PrintfTest.c b/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_PrintfTest.c
deleted file mode 100644
index 2d90fff..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_PrintfTest.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*       Solutions for real time microcontroller applications         *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-
---------- END-OF-HEADER --------------------------------------------
-File    : Main_RTT_MenuApp.c
-Purpose : Sample application to demonstrate RTT bi-directional functionality
-*/
-
-#define MAIN_C
-
-#include <stdio.h>
-
-#include "SEGGER_RTT.h"
-
-volatile int _Cnt;
-
-/*********************************************************************
-*
-*       main
-*/
-void main(void) {
-
-  SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
-
-  SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n\r\n");
-  SEGGER_RTT_WriteString(0, "###### Testing SEGGER_printf() ######\r\n");
-
-  SEGGER_RTT_printf(0, "printf Test: %%c,         'S' : %c.\r\n", 'S');
-  SEGGER_RTT_printf(0, "printf Test: %%5c,        'E' : %5c.\r\n", 'E');
-  SEGGER_RTT_printf(0, "printf Test: %%-5c,       'G' : %-5c.\r\n", 'G');
-  SEGGER_RTT_printf(0, "printf Test: %%5.3c,      'G' : %-5c.\r\n", 'G');
-  SEGGER_RTT_printf(0, "printf Test: %%.3c,       'E' : %-5c.\r\n", 'E');
-  SEGGER_RTT_printf(0, "printf Test: %%c,         'R' : %c.\r\n", 'R');
-
-  SEGGER_RTT_printf(0, "printf Test: %%s,      \"RTT\" : %s.\r\n", "RTT");
-  SEGGER_RTT_printf(0, "printf Test: %%s, \"RTT\\r\\nRocks.\" : %s.\r\n", "RTT\r\nRocks.");
-
-  SEGGER_RTT_printf(0, "printf Test: %%u,       12345 : %u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%+u,      12345 : %+u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%.3u,     12345 : %.3u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%.6u,     12345 : %.6u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%6.3u,    12345 : %6.3u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%8.6u,    12345 : %8.6u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%08u,     12345 : %08u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%08.6u,   12345 : %08.6u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%0u,      12345 : %0u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-.6u,    12345 : %-.6u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-6.3u,   12345 : %-6.3u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-8.6u,   12345 : %-8.6u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-08u,    12345 : %-08u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-08.6u,  12345 : %-08.6u.\r\n", 12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-0u,     12345 : %-0u.\r\n", 12345);
-
-  SEGGER_RTT_printf(0, "printf Test: %%u,      -12345 : %u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%+u,     -12345 : %+u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%.3u,    -12345 : %.3u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%.6u,    -12345 : %.6u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%6.3u,   -12345 : %6.3u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%8.6u,   -12345 : %8.6u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%08u,    -12345 : %08u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%08.6u,  -12345 : %08.6u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%0u,     -12345 : %0u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-.6u,   -12345 : %-.6u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-6.3u,  -12345 : %-6.3u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-8.6u,  -12345 : %-8.6u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-08u,   -12345 : %-08u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-08.6u, -12345 : %-08.6u.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-0u,    -12345 : %-0u.\r\n", -12345);
-
-  SEGGER_RTT_printf(0, "printf Test: %%d,      -12345 : %d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%+d,     -12345 : %+d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%.3d,    -12345 : %.3d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%.6d,    -12345 : %.6d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%6.3d,   -12345 : %6.3d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%8.6d,   -12345 : %8.6d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%08d,    -12345 : %08d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%08.6d,  -12345 : %08.6d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%0d,     -12345 : %0d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-.6d,   -12345 : %-.6d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-6.3d,  -12345 : %-6.3d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-8.6d,  -12345 : %-8.6d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-08d,   -12345 : %-08d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-08.6d, -12345 : %-08.6d.\r\n", -12345);
-  SEGGER_RTT_printf(0, "printf Test: %%-0d,    -12345 : %-0d.\r\n", -12345);
-
-  SEGGER_RTT_printf(0, "printf Test: %%x,      0x1234ABC : %x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%+x,     0x1234ABC : %+x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%.3x,    0x1234ABC : %.3x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%.6x,    0x1234ABC : %.6x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%6.3x,   0x1234ABC : %6.3x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%8.6x,   0x1234ABC : %8.6x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%08x,    0x1234ABC : %08x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%08.6x,  0x1234ABC : %08.6x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%0x,     0x1234ABC : %0x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%-.6x,   0x1234ABC : %-.6x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%-6.3x,  0x1234ABC : %-6.3x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%-8.6x,  0x1234ABC : %-8.6x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%-08x,   0x1234ABC : %-08x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%-08.6x, 0x1234ABC : %-08.6x.\r\n", 0x1234ABC);
-  SEGGER_RTT_printf(0, "printf Test: %%-0x,    0x1234ABC : %-0x.\r\n", 0x1234ABC);
-
-  SEGGER_RTT_printf(0, "printf Test: %%p,      &_Cnt      : %p.\r\n", &_Cnt);
-
-  SEGGER_RTT_WriteString(0, "###### SEGGER_printf() Tests done. ######\r\n");
-  do {
-    _Cnt++;
-  } while (1);
-}
-
-/*************************** End of file ****************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_SpeedTestApp.c b/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_SpeedTestApp.c
deleted file mode 100644
index 0dc0c75..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/Examples/Main_RTT_SpeedTestApp.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*       Solutions for real time microcontroller applications         *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-
---------- END-OF-HEADER --------------------------------------------
-File    : Main_RTT_SpeedTestApp.c
-Purpose : Sample program for measuring RTT performance.
-*/
-
-#include "RTOS.h"
-#include "BSP.h"
-
-#include "SEGGER_RTT.h"
-#include <stdio.h>
-
-OS_STACKPTR int StackHP[128], StackLP[128];          /* Task stacks */
-OS_TASK TCBHP, TCBLP;                        /* Task-control-blocks */
-
-static void HPTask(void) {
-  while (1) {
-    //
-    // Measure time needed for RTT output
-    // Perform dummy write with 0 characters, so we know the overhead of toggling LEDs and RTT in general
-    //
-// Set BP here. Then start sampling on scope
-    BSP_ClrLED(0);
-    SEGGER_RTT_Write(0, 0, 0);
-    BSP_SetLED(0);
-    BSP_ClrLED(0);
-    SEGGER_RTT_Write(0, "01234567890123456789012345678901234567890123456789012345678901234567890123456789\r\n", 82);
-    BSP_SetLED(0);
-// Set BP here. Then stop sampling on scope
-    OS_Delay(200);
-  }
-}
-
-static void LPTask(void) {
-  while (1) {
-    BSP_ToggleLED(1);
-    OS_Delay (500);
-  }
-}
-
-/*********************************************************************
-*
-*       main
-*
-*********************************************************************/
-
-int main(void) {
-  OS_IncDI();                      /* Initially disable interrupts  */
-  OS_InitKern();                   /* Initialize OS                 */
-  OS_InitHW();                     /* Initialize Hardware for OS    */
-  BSP_Init();                      /* Initialize LED ports          */
-  BSP_SetLED(0);
-  /* You need to create at least one task before calling OS_Start() */
-  OS_CREATETASK(&TCBHP, "HP Task", HPTask, 100, StackHP);
-  OS_CREATETASK(&TCBLP, "LP Task", LPTask,  50, StackLP);
-  OS_Start();                      /* Start multitasking            */
-  return 0;
-}
-
diff --git a/third_party/jlink/SEGGER_RTT_V640/License.txt b/third_party/jlink/SEGGER_RTT_V640/License.txt
deleted file mode 100644
index bfe93b3..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/License.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-Important - Read carefully:
-
-SEGGER RTT - Real Time Transfer for embedded targets
-
-All rights reserved.
-
-SEGGER strongly recommends to not make any changes
-to or modify the source code of this software in order to stay
-compatible with the RTT protocol and J-Link.
-
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the following
-conditions are met:
-
-o Redistributions of source code must retain the above copyright
-  notice, this list of conditions and the following disclaimer.
-
-o 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.
-
-o Neither the name of SEGGER Microcontroller GmbH
-  nor the names of its contributors may be used to endorse or
-  promote products derived from this software without specific
-  prior written permission.
-
-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
-DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller 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.
-
-
-(c) 2014 - 2016  SEGGER Microcontroller GmbH
-www.segger.com
diff --git a/third_party/jlink/SEGGER_RTT_V640/README.txt b/third_party/jlink/SEGGER_RTT_V640/README.txt
deleted file mode 100644
index 49ec655..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/README.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-README.txt for the SEGGER RTT Implementation Pack.
-
-Included files:
-===============
-Root Directory
-  - Examples
-    - Main_RTT_InputEchoApp.c    - Sample application which echoes input on Channel 0.
-    - Main_RTT_MenuApp.c         - Sample application to demonstrate RTT bi-directional functionality.
-    - Main_RTT_PrintfTest.c      - Sample application to test RTT small printf implementation.
-    - Main_RTT_SpeedTestApp.c    - Sample application for measuring RTT performance. embOS needed.
-  - RTT
-    - SEGGER_RTT.c                - The RTT implementation.
-    - SEGGER_RTT.h                - Header for RTT implementation.
-    - SEGGER_RTT_Conf.h           - Pre-processor configuration for the RTT implementation.
-    - SEGGER_RTT_Printf.c         - Simple implementation of printf to write formatted strings via RTT.
-  - Syscalls
-    - RTT_Syscalls_GCC.c          - Low-level syscalls to retarget printf() to RTT with GCC / Newlib.
-    - RTT_Syscalls_IAR.c          - Low-level syscalls to retarget printf() to RTT with IAR compiler.
-    - RTT_Syscalls_KEIL.c         - Low-level syscalls to retarget printf() to RTT with KEIL/uVision compiler.
-    - RTT_Syscalls_SES.c          - Low-level syscalls to retarget printf() to RTT with SEGGER Embedded Studio.
diff --git a/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT.c b/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT.c
deleted file mode 100644
index 8fc0f6c..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT.c
+++ /dev/null
@@ -1,1761 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*                        The Embedded Experts                        *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-*       SEGGER RTT * Real Time Transfer for embedded targets         *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-* All rights reserved.                                               *
-*                                                                    *
-* SEGGER strongly recommends to not make any changes                 *
-* to or modify the source code of this software in order to stay     *
-* compatible with the RTT protocol and J-Link.                       *
-*                                                                    *
-* Redistribution and use in source and binary forms, with or         *
-* without modification, are permitted provided that the following    *
-* conditions are met:                                                *
-*                                                                    *
-* o Redistributions of source code must retain the above copyright   *
-*   notice, this list of conditions and the following disclaimer.    *
-*                                                                    *
-* o 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.                                           *
-*                                                                    *
-* o Neither the name of SEGGER Microcontroller GmbH                  *
-*   nor the names of its contributors may be used to endorse or      *
-*   promote products derived from this software without specific     *
-*   prior written permission.                                        *
-*                                                                    *
-* 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           *
-* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller 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.                                                            *
-*                                                                    *
-**********************************************************************
----------------------------END-OF-HEADER------------------------------
-File    : SEGGER_RTT.c
-Purpose : Implementation of SEGGER real-time transfer (RTT) which
-          allows real-time communication on targets which support
-          debugger memory accesses while the CPU is running.
-Revision: $Rev: 12804 $
-
-Additional information:
-          Type "int" is assumed to be 32-bits in size
-          H->T    Host to target communication
-          T->H    Target to host communication
-
-          RTT channel 0 is always present and reserved for Terminal usage.
-          Name is fixed to "Terminal"
-
-          Effective buffer size: SizeOfBuffer - 1
-
-          WrOff == RdOff:       Buffer is empty
-          WrOff == (RdOff - 1): Buffer is full
-          WrOff >  RdOff:       Free space includes wrap-around
-          WrOff <  RdOff:       Used space includes wrap-around
-          (WrOff == (SizeOfBuffer - 1)) && (RdOff == 0):  
-                                Buffer full and wrap-around after next byte
-
-
-----------------------------------------------------------------------
-*/
-
-#include "SEGGER_RTT.h"
-
-#include <string.h>                 // for memcpy
-
-/*********************************************************************
-*
-*       Configuration, default values
-*
-**********************************************************************
-*/
-
-#ifndef   BUFFER_SIZE_UP
-  #define BUFFER_SIZE_UP                                  1024  // Size of the buffer for terminal output of target, up to host
-#endif
-
-#ifndef   BUFFER_SIZE_DOWN
-  #define BUFFER_SIZE_DOWN                                16    // Size of the buffer for terminal input to target from host (Usually keyboard input)
-#endif
-
-#ifndef   SEGGER_RTT_MAX_NUM_UP_BUFFERS
-  #define SEGGER_RTT_MAX_NUM_UP_BUFFERS                    2    // Number of up-buffers (T->H) available on this target
-#endif
-
-#ifndef   SEGGER_RTT_MAX_NUM_DOWN_BUFFERS
-  #define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS                  2    // Number of down-buffers (H->T) available on this target
-#endif
-
-#ifndef SEGGER_RTT_BUFFER_SECTION
-  #if defined(SEGGER_RTT_SECTION)
-    #define SEGGER_RTT_BUFFER_SECTION SEGGER_RTT_SECTION
-  #endif
-#endif
-
-#ifndef   SEGGER_RTT_ALIGNMENT
-  #define SEGGER_RTT_ALIGNMENT                            0
-#endif
-
-#ifndef   SEGGER_RTT_BUFFER_ALIGNMENT
-  #define SEGGER_RTT_BUFFER_ALIGNMENT                     0
-#endif
-
-#ifndef   SEGGER_RTT_MODE_DEFAULT
-  #define SEGGER_RTT_MODE_DEFAULT                         SEGGER_RTT_MODE_NO_BLOCK_SKIP
-#endif
-
-#ifndef   SEGGER_RTT_LOCK
-  #define SEGGER_RTT_LOCK()
-#endif
-
-#ifndef   SEGGER_RTT_UNLOCK
-  #define SEGGER_RTT_UNLOCK()
-#endif
-
-#ifndef   STRLEN
-  #define STRLEN(a)                                       strlen((a))
-#endif
-
-#ifndef   SEGGER_RTT_MEMCPY_USE_BYTELOOP
-  #define SEGGER_RTT_MEMCPY_USE_BYTELOOP                  0
-#endif
-
-#ifndef   SEGGER_RTT_MEMCPY
-  #ifdef  MEMCPY
-    #define SEGGER_RTT_MEMCPY(pDest, pSrc, NumBytes)      MEMCPY((pDest), (pSrc), (NumBytes))
-  #else
-    #define SEGGER_RTT_MEMCPY(pDest, pSrc, NumBytes)      memcpy((pDest), (pSrc), (NumBytes))
-  #endif
-#endif
-
-#ifndef   MIN
-  #define MIN(a, b)         (((a) < (b)) ? (a) : (b))
-#endif
-
-#ifndef   MAX
-  #define MAX(a, b)         (((a) > (b)) ? (a) : (b))
-#endif
-//
-// For some environments, NULL may not be defined until certain headers are included
-//
-#ifndef NULL
-  #define NULL 0
-#endif
-
-/*********************************************************************
-*
-*       Defines, fixed
-*
-**********************************************************************
-*/
-#if (defined __ICCARM__) || (defined __ICCRX__)
-  #define RTT_PRAGMA(P) _Pragma(#P)
-#endif
-
-#if SEGGER_RTT_ALIGNMENT || SEGGER_RTT_BUFFER_ALIGNMENT
-  #if (defined __GNUC__)
-    #define SEGGER_RTT_ALIGN(Var, Alignment) Var __attribute__ ((aligned (Alignment)))
-  #elif (defined __ICCARM__) || (defined __ICCRX__)
-    #define PRAGMA(A) _Pragma(#A)
-#define SEGGER_RTT_ALIGN(Var, Alignment) RTT_PRAGMA(data_alignment=Alignment) \
-                                  Var
-  #elif (defined __CC_ARM)
-    #define SEGGER_RTT_ALIGN(Var, Alignment) Var __attribute__ ((aligned (Alignment)))
-  #else
-    #error "Alignment not supported for this compiler."
-  #endif
-#else
-  #define SEGGER_RTT_ALIGN(Var, Alignment) Var
-#endif
-
-#if defined(SEGGER_RTT_SECTION) || defined (SEGGER_RTT_BUFFER_SECTION)
-  #if (defined __GNUC__)
-    #define SEGGER_RTT_PUT_SECTION(Var, Section) __attribute__ ((section (Section))) Var
-  #elif (defined __ICCARM__) || (defined __ICCRX__)
-#define SEGGER_RTT_PUT_SECTION(Var, Section) RTT_PRAGMA(location=Section) \
-                                        Var
-  #elif (defined __CC_ARM)
-    #define SEGGER_RTT_PUT_SECTION(Var, Section) __attribute__ ((section (Section), zero_init))  Var
-  #else
-    #error "Section placement not supported for this compiler."
-  #endif
-#else
-  #define SEGGER_RTT_PUT_SECTION(Var, Section) Var
-#endif
-
-
-#if SEGGER_RTT_ALIGNMENT
-  #define SEGGER_RTT_CB_ALIGN(Var)  SEGGER_RTT_ALIGN(Var, SEGGER_RTT_ALIGNMENT)
-#else
-  #define SEGGER_RTT_CB_ALIGN(Var)  Var
-#endif
-
-#if SEGGER_RTT_BUFFER_ALIGNMENT
-  #define SEGGER_RTT_BUFFER_ALIGN(Var)  SEGGER_RTT_ALIGN(Var, SEGGER_RTT_BUFFER_ALIGNMENT)
-#else
-  #define SEGGER_RTT_BUFFER_ALIGN(Var)  Var
-#endif
-
-
-#if defined(SEGGER_RTT_SECTION)
-  #define SEGGER_RTT_PUT_CB_SECTION(Var) SEGGER_RTT_PUT_SECTION(Var, SEGGER_RTT_SECTION)
-#else
-  #define SEGGER_RTT_PUT_CB_SECTION(Var) Var
-#endif
-
-#if defined(SEGGER_RTT_BUFFER_SECTION)
-  #define SEGGER_RTT_PUT_BUFFER_SECTION(Var) SEGGER_RTT_PUT_SECTION(Var, SEGGER_RTT_BUFFER_SECTION)
-#else
-  #define SEGGER_RTT_PUT_BUFFER_SECTION(Var) Var
-#endif
-
-/*********************************************************************
-*
-*       Static const data
-*
-**********************************************************************
-*/
-
-static unsigned char _aTerminalId[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-
-/*********************************************************************
-*
-*       Static data
-*
-**********************************************************************
-*/
-//
-// RTT Control Block and allocate buffers for channel 0
-//
-SEGGER_RTT_PUT_CB_SECTION(SEGGER_RTT_CB_ALIGN(SEGGER_RTT_CB _SEGGER_RTT));
-
-SEGGER_RTT_PUT_BUFFER_SECTION(SEGGER_RTT_BUFFER_ALIGN(static char _acUpBuffer  [BUFFER_SIZE_UP]));
-SEGGER_RTT_PUT_BUFFER_SECTION(SEGGER_RTT_BUFFER_ALIGN(static char _acDownBuffer[BUFFER_SIZE_DOWN]));
-
-static char _ActiveTerminal;
-
-/*********************************************************************
-*
-*       Static functions
-*
-**********************************************************************
-*/
-
-/*********************************************************************
-*
-*       _DoInit()
-*
-*  Function description
-*    Initializes the control block an buffers.
-*    May only be called via INIT() to avoid overriding settings.
-*
-*/
-#define INIT()  do {                                            \
-                  if (_SEGGER_RTT.acID[0] == '\0') { _DoInit(); }  \
-                } while (0)
-static void _DoInit(void) {
-  SEGGER_RTT_CB* p;
-  //
-  // Initialize control block
-  //
-  p = &_SEGGER_RTT;
-  p->MaxNumUpBuffers    = SEGGER_RTT_MAX_NUM_UP_BUFFERS;
-  p->MaxNumDownBuffers  = SEGGER_RTT_MAX_NUM_DOWN_BUFFERS;
-  //
-  // Initialize up buffer 0
-  //
-  p->aUp[0].sName         = "Terminal";
-  p->aUp[0].pBuffer       = _acUpBuffer;
-  p->aUp[0].SizeOfBuffer  = sizeof(_acUpBuffer);
-  p->aUp[0].RdOff         = 0u;
-  p->aUp[0].WrOff         = 0u;
-  p->aUp[0].Flags         = SEGGER_RTT_MODE_DEFAULT;
-  //
-  // Initialize down buffer 0
-  //
-  p->aDown[0].sName         = "Terminal";
-  p->aDown[0].pBuffer       = _acDownBuffer;
-  p->aDown[0].SizeOfBuffer  = sizeof(_acDownBuffer);
-  p->aDown[0].RdOff         = 0u;
-  p->aDown[0].WrOff         = 0u;
-  p->aDown[0].Flags         = SEGGER_RTT_MODE_DEFAULT;
-  //
-  // Finish initialization of the control block.
-  // Copy Id string in three steps to make sure "SEGGER RTT" is not found
-  // in initializer memory (usually flash) by J-Link
-  //
-  strcpy(&p->acID[7], "RTT");
-  strcpy(&p->acID[0], "SEGGER");
-  p->acID[6] = ' ';
-}
-
-/*********************************************************************
-*
-*       _WriteBlocking()
-*
-*  Function description
-*    Stores a specified number of characters in SEGGER RTT ring buffer
-*    and updates the associated write pointer which is periodically
-*    read by the host.
-*    The caller is responsible for managing the write chunk sizes as
-*    _WriteBlocking() will block until all data has been posted successfully.
-*
-*  Parameters
-*    pRing        Ring buffer to post to.
-*    pBuffer      Pointer to character array. Does not need to point to a \0 terminated string.
-*    NumBytes     Number of bytes to be stored in the SEGGER RTT control block.
-*
-*  Return value
-*    >= 0 - Number of bytes written into buffer.
-*/
-static unsigned _WriteBlocking(SEGGER_RTT_BUFFER_UP* pRing, const char* pBuffer, unsigned NumBytes) {
-  unsigned NumBytesToWrite;
-  unsigned NumBytesWritten;
-  unsigned RdOff;
-  unsigned WrOff;
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-  char*    pDst;
-#endif
-  //
-  // Write data to buffer and handle wrap-around if necessary
-  //
-  NumBytesWritten = 0u;
-  WrOff = pRing->WrOff;
-  do {
-    RdOff = pRing->RdOff;                         // May be changed by host (debug probe) in the meantime
-    if (RdOff > WrOff) {
-      NumBytesToWrite = RdOff - WrOff - 1u;
-    } else {
-      NumBytesToWrite = pRing->SizeOfBuffer - (WrOff - RdOff + 1u);
-    }
-    NumBytesToWrite = MIN(NumBytesToWrite, (pRing->SizeOfBuffer - WrOff));      // Number of bytes that can be written until buffer wrap-around
-    NumBytesToWrite = MIN(NumBytesToWrite, NumBytes);
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-    pDst = pRing->pBuffer + WrOff;
-    NumBytesWritten += NumBytesToWrite;
-    NumBytes        -= NumBytesToWrite;
-    WrOff           += NumBytesToWrite;
-    while (NumBytesToWrite--) {
-      *pDst++ = *pBuffer++;
-    };
-#else
-    SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pBuffer, NumBytesToWrite);
-    NumBytesWritten += NumBytesToWrite;
-    pBuffer         += NumBytesToWrite;
-    NumBytes        -= NumBytesToWrite;
-    WrOff           += NumBytesToWrite;
-#endif
-    if (WrOff == pRing->SizeOfBuffer) {
-      WrOff = 0u;
-    }
-    pRing->WrOff = WrOff;
-  } while (NumBytes);
-  //
-  return NumBytesWritten;
-}
-
-/*********************************************************************
-*
-*       _WriteNoCheck()
-*
-*  Function description
-*    Stores a specified number of characters in SEGGER RTT ring buffer
-*    and updates the associated write pointer which is periodically
-*    read by the host.
-*    It is callers responsibility to make sure data actually fits in buffer.
-*
-*  Parameters
-*    pRing        Ring buffer to post to.
-*    pBuffer      Pointer to character array. Does not need to point to a \0 terminated string.
-*    NumBytes     Number of bytes to be stored in the SEGGER RTT control block.
-*
-*  Notes
-*    (1) If there might not be enough space in the "Up"-buffer, call _WriteBlocking
-*/
-static void _WriteNoCheck(SEGGER_RTT_BUFFER_UP* pRing, const char* pData, unsigned NumBytes) {
-  unsigned NumBytesAtOnce;
-  unsigned WrOff;
-  unsigned Rem;
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-  char*    pDst;
-#endif
-
-  WrOff = pRing->WrOff;
-  Rem = pRing->SizeOfBuffer - WrOff;
-  if (Rem > NumBytes) {
-    //
-    // All data fits before wrap around
-    //
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-    pDst = pRing->pBuffer + WrOff;
-    WrOff += NumBytes;
-    while (NumBytes--) {
-      *pDst++ = *pData++;
-    };
-    pRing->WrOff = WrOff;
-#else
-    SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytes);
-    pRing->WrOff = WrOff + NumBytes;
-#endif
-  } else {
-    //
-    // We reach the end of the buffer, so need to wrap around
-    //
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-    pDst = pRing->pBuffer + WrOff;
-    NumBytesAtOnce = Rem;
-    while (NumBytesAtOnce--) {
-      *pDst++ = *pData++;
-    };
-    pDst = pRing->pBuffer;
-    NumBytesAtOnce = NumBytes - Rem;
-    while (NumBytesAtOnce--) {
-      *pDst++ = *pData++;
-    };
-    pRing->WrOff = NumBytes - Rem;
-#else
-    NumBytesAtOnce = Rem;
-    SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytesAtOnce);
-    NumBytesAtOnce = NumBytes - Rem;
-    SEGGER_RTT_MEMCPY(pRing->pBuffer, pData + Rem, NumBytesAtOnce);
-    pRing->WrOff = NumBytesAtOnce;
-#endif
-  }
-}
-
-/*********************************************************************
-*
-*       _PostTerminalSwitch()
-*
-*  Function description
-*    Switch terminal to the given terminal ID.  It is the caller's
-*    responsibility to ensure the terminal ID is correct and there is
-*    enough space in the buffer for this to complete successfully.
-*
-*  Parameters
-*    pRing        Ring buffer to post to.
-*    TerminalId   Terminal ID to switch to.
-*/
-static void _PostTerminalSwitch(SEGGER_RTT_BUFFER_UP* pRing, unsigned char TerminalId) {
-  unsigned char ac[2];
-
-  ac[0] = 0xFFu;
-  ac[1] = _aTerminalId[TerminalId];  // Caller made already sure that TerminalId does not exceed our terminal limit
-  _WriteBlocking(pRing, (const char*)ac, 2u);
-}
-
-/*********************************************************************
-*
-*       _GetAvailWriteSpace()
-*
-*  Function description
-*    Returns the number of bytes that can be written to the ring
-*    buffer without blocking.
-*
-*  Parameters
-*    pRing        Ring buffer to check.
-*
-*  Return value
-*    Number of bytes that are free in the buffer.
-*/
-static unsigned _GetAvailWriteSpace(SEGGER_RTT_BUFFER_UP* pRing) {
-  unsigned RdOff;
-  unsigned WrOff;
-  unsigned r;
-  //
-  // Avoid warnings regarding volatile access order.  It's not a problem
-  // in this case, but dampen compiler enthusiasm.
-  //
-  RdOff = pRing->RdOff;
-  WrOff = pRing->WrOff;
-  if (RdOff <= WrOff) {
-    r = pRing->SizeOfBuffer - 1u - WrOff + RdOff;
-  } else {
-    r = RdOff - WrOff - 1u;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       Public code
-*
-**********************************************************************
-*/
-/*********************************************************************
-*
-*       SEGGER_RTT_ReadNoLock()
-*
-*  Function description
-*    Reads characters from SEGGER real-time-terminal control block
-*    which have been previously stored by the host.
-*    Do not lock against interrupts and multiple access.
-*
-*  Parameters
-*    BufferIndex  Index of Down-buffer to be used (e.g. 0 for "Terminal").
-*    pBuffer      Pointer to buffer provided by target application, to copy characters from RTT-down-buffer to.
-*    BufferSize   Size of the target application buffer.
-*
-*  Return value
-*    Number of bytes that have been read.
-*/
-unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned BufferSize) {
-  unsigned                NumBytesRem;
-  unsigned                NumBytesRead;
-  unsigned                RdOff;
-  unsigned                WrOff;
-  unsigned char*          pBuffer;
-  SEGGER_RTT_BUFFER_DOWN* pRing;
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-  const char*             pSrc;
-#endif
-  //
-  INIT();
-  pRing = &_SEGGER_RTT.aDown[BufferIndex];
-  pBuffer = (unsigned char*)pData;
-  RdOff = pRing->RdOff;
-  WrOff = pRing->WrOff;
-  NumBytesRead = 0u;
-  //
-  // Read from current read position to wrap-around of buffer, first
-  //
-  if (RdOff > WrOff) {
-    NumBytesRem = pRing->SizeOfBuffer - RdOff;
-    NumBytesRem = MIN(NumBytesRem, BufferSize);
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-    pSrc = pRing->pBuffer + RdOff;
-    NumBytesRead += NumBytesRem;
-    BufferSize   -= NumBytesRem;
-    RdOff        += NumBytesRem;
-    while (NumBytesRem--) {
-      *pBuffer++ = *pSrc++;
-    };
-#else
-    SEGGER_RTT_MEMCPY(pBuffer, pRing->pBuffer + RdOff, NumBytesRem);
-    NumBytesRead += NumBytesRem;
-    pBuffer      += NumBytesRem;
-    BufferSize   -= NumBytesRem;
-    RdOff        += NumBytesRem;
-#endif
-    //
-    // Handle wrap-around of buffer
-    //
-    if (RdOff == pRing->SizeOfBuffer) {
-      RdOff = 0u;
-    }
-  }
-  //
-  // Read remaining items of buffer
-  //
-  NumBytesRem = WrOff - RdOff;
-  NumBytesRem = MIN(NumBytesRem, BufferSize);
-  if (NumBytesRem > 0u) {
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-    pSrc = pRing->pBuffer + RdOff;
-    NumBytesRead += NumBytesRem;
-    BufferSize   -= NumBytesRem;
-    RdOff        += NumBytesRem;
-    while (NumBytesRem--) {
-      *pBuffer++ = *pSrc++;
-    };
-#else
-    SEGGER_RTT_MEMCPY(pBuffer, pRing->pBuffer + RdOff, NumBytesRem);
-    NumBytesRead += NumBytesRem;
-    pBuffer      += NumBytesRem;
-    BufferSize   -= NumBytesRem;
-    RdOff        += NumBytesRem;
-#endif
-  }
-  if (NumBytesRead) {
-    pRing->RdOff = RdOff;
-  }
-  //
-  return NumBytesRead;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_Read
-*
-*  Function description
-*    Reads characters from SEGGER real-time-terminal control block
-*    which have been previously stored by the host.
-*
-*  Parameters
-*    BufferIndex  Index of Down-buffer to be used (e.g. 0 for "Terminal").
-*    pBuffer      Pointer to buffer provided by target application, to copy characters from RTT-down-buffer to.
-*    BufferSize   Size of the target application buffer.
-*
-*  Return value
-*    Number of bytes that have been read.
-*/
-unsigned SEGGER_RTT_Read(unsigned BufferIndex, void* pBuffer, unsigned BufferSize) {
-  unsigned NumBytesRead;
-  //
-  SEGGER_RTT_LOCK();
-  //
-  // Call the non-locking read function
-  //
-  NumBytesRead = SEGGER_RTT_ReadNoLock(BufferIndex, pBuffer, BufferSize);
-  //
-  // Finish up.
-  //
-  SEGGER_RTT_UNLOCK();
-  //
-  return NumBytesRead;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_WriteWithOverwriteNoLock
-*
-*  Function description
-*    Stores a specified number of characters in SEGGER RTT
-*    control block.
-*    SEGGER_RTT_WriteWithOverwriteNoLock does not lock the application 
-*    and overwrites data if the data does not fit into the buffer.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
-*    pBuffer      Pointer to character array. Does not need to point to a \0 terminated string.
-*    NumBytes     Number of bytes to be stored in the SEGGER RTT control block.
-*
-*  Notes
-*    (1) If there is not enough space in the "Up"-buffer, data is overwritten.
-*    (2) For performance reasons this function does not call Init()
-*        and may only be called after RTT has been initialized.
-*        Either by calling SEGGER_RTT_Init() or calling another RTT API function first.
-*    (3) Do not use SEGGER_RTT_WriteWithOverwriteNoLock if a J-Link 
-*        connection reads RTT data.
-*/
-void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) {
-  const char*           pData;
-  SEGGER_RTT_BUFFER_UP* pRing;
-  unsigned              Avail;
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-  char*                 pDst;
-#endif
-
-  pData = (const char *)pBuffer;
-  //
-  // Get "to-host" ring buffer and copy some elements into local variables.
-  //
-  pRing = &_SEGGER_RTT.aUp[BufferIndex];
-  //
-  // Check if we will overwrite data and need to adjust the RdOff.
-  //
-  if (pRing->WrOff == pRing->RdOff) {
-    Avail = pRing->SizeOfBuffer - 1u;
-  } else if ( pRing->WrOff < pRing->RdOff) {
-    Avail = pRing->RdOff - pRing->WrOff - 1u;
-  } else {
-    Avail = pRing->RdOff - pRing->WrOff - 1u + pRing->SizeOfBuffer;
-  }
-  if (NumBytes > Avail) {
-    pRing->RdOff += (NumBytes - Avail);
-    while (pRing->RdOff >= pRing->SizeOfBuffer) {
-      pRing->RdOff -= pRing->SizeOfBuffer;
-    }
-  }
-  //
-  // Write all data, no need to check the RdOff, but possibly handle multiple wrap-arounds
-  //
-  Avail = pRing->SizeOfBuffer - pRing->WrOff;
-  do {
-    if (Avail > NumBytes) {
-      //
-      // Last round
-      //
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-      pDst = pRing->pBuffer + pRing->WrOff;
-      Avail = NumBytes;
-      while (NumBytes--) {
-        *pDst++ = *pData++;
-      };
-      pRing->WrOff += Avail;
-#else
-      SEGGER_RTT_MEMCPY(pRing->pBuffer + pRing->WrOff, pData, NumBytes);
-      pRing->WrOff += NumBytes;
-#endif
-      break;
-    } else {
-      //
-      //  Wrap-around necessary, write until wrap-around and reset WrOff
-      //
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-      pDst = pRing->pBuffer + pRing->WrOff;
-      NumBytes -= Avail;
-      while (Avail--) {
-        *pDst++ = *pData++;
-      };
-      pRing->WrOff = 0;
-#else
-      SEGGER_RTT_MEMCPY(pRing->pBuffer + pRing->WrOff, pData, Avail);
-      pData += Avail;
-      pRing->WrOff = 0;
-      NumBytes -= Avail;
-#endif
-      Avail = (pRing->SizeOfBuffer - 1);
-    }
-  } while (NumBytes);
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_WriteSkipNoLock
-*
-*  Function description
-*    Stores a specified number of characters in SEGGER RTT
-*    control block which is then read by the host.
-*    SEGGER_RTT_WriteSkipNoLock does not lock the application and
-*    skips all data, if the data does not fit into the buffer.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
-*    pBuffer      Pointer to character array. Does not need to point to a \0 terminated string.
-*    NumBytes     Number of bytes to be stored in the SEGGER RTT control block.
-*
-*  Return value
-*    Number of bytes which have been stored in the "Up"-buffer.
-*
-*  Notes
-*    (1) If there is not enough space in the "Up"-buffer, all data is dropped.
-*    (2) For performance reasons this function does not call Init()
-*        and may only be called after RTT has been initialized.
-*        Either by calling SEGGER_RTT_Init() or calling another RTT API function first.
-*/
-unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) {
-  const char*           pData;
-  SEGGER_RTT_BUFFER_UP* pRing;
-  unsigned              Avail;
-  unsigned              RdOff;
-  unsigned              WrOff;
-  unsigned              Rem;
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-  char*                 pDst;
-#endif
-
-  pData = (const char *)pBuffer;
-  //
-  // Get "to-host" ring buffer and copy some elements into local variables.
-  //
-  pRing = &_SEGGER_RTT.aUp[BufferIndex];
-  RdOff = pRing->RdOff;
-  WrOff = pRing->WrOff;
-  //
-  // Handle the most common cases fastest.
-  // Which is:
-  //    RdOff <= WrOff -> Space until wrap around is free.
-  //  AND
-  //    WrOff + NumBytes < SizeOfBuffer -> No Wrap around necessary.
-  //
-  //  OR
-  //
-  //    RdOff > WrOff -> Space until RdOff - 1 is free.
-  //  AND
-  //    WrOff + NumBytes < RdOff -> Data fits into buffer
-  //
-  if (RdOff <= WrOff) {
-    //
-    // Get space until WrOff will be at wrap around.
-    //
-    Avail = pRing->SizeOfBuffer - 1u - WrOff ;
-    if (Avail >= NumBytes) {
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-      pDst = pRing->pBuffer + WrOff;
-      WrOff += NumBytes;
-      while (NumBytes--) {
-        *pDst++ = *pData++;
-      };
-      pRing->WrOff = WrOff;
-#else
-      SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytes);
-      pRing->WrOff = WrOff + NumBytes;
-#endif
-      return 1;
-    }
-    //
-    // If data did not fit into space until wrap around calculate complete space in buffer.
-    //
-    Avail += RdOff;
-    //
-    // If there is still no space for the whole of this output, don't bother.
-    //
-    if (Avail >= NumBytes) {
-      //
-      //  OK, we have enough space in buffer. Copy in one or 2 chunks
-      //
-      Rem = pRing->SizeOfBuffer - WrOff;      // Space until end of buffer
-      if (Rem > NumBytes) {
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-        pDst = pRing->pBuffer + WrOff;
-        WrOff += NumBytes;
-        while (NumBytes--) {
-          *pDst++ = *pData++;
-        };
-        pRing->WrOff = WrOff;
-#else
-        SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytes);
-        pRing->WrOff = WrOff + NumBytes;
-#endif
-      } else {
-        //
-        // We reach the end of the buffer, so need to wrap around
-        //
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-        pDst = pRing->pBuffer + WrOff;
-        NumBytes -= Rem;
-        WrOff = NumBytes;
-        do {
-          *pDst++ = *pData++;
-        } while (--Rem);
-        pDst = pRing->pBuffer;
-        while (NumBytes--) {
-          *pDst++ = *pData++;
-        };
-        pRing->WrOff = WrOff;
-#else
-        SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, Rem);
-        SEGGER_RTT_MEMCPY(pRing->pBuffer, pData + Rem, NumBytes - Rem);
-        pRing->WrOff = NumBytes - Rem;
-#endif
-      }
-      return 1;
-    }
-  } else {
-    Avail = RdOff - WrOff - 1u;
-    if (Avail >= NumBytes) {
-#if SEGGER_RTT_MEMCPY_USE_BYTELOOP
-      pDst = pRing->pBuffer + WrOff;
-      WrOff += NumBytes;
-      while (NumBytes--) {
-        *pDst++ = *pData++;
-      };
-      pRing->WrOff = WrOff;
-#else
-      SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytes);
-      pRing->WrOff = WrOff + NumBytes;
-#endif
-      return 1;
-    }
-  }
-  //
-  // If we reach this point no data has been written
-  //
-  return 0;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_WriteNoLock
-*
-*  Function description
-*    Stores a specified number of characters in SEGGER RTT
-*    control block which is then read by the host.
-*    SEGGER_RTT_WriteNoLock does not lock the application.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
-*    pBuffer      Pointer to character array. Does not need to point to a \0 terminated string.
-*    NumBytes     Number of bytes to be stored in the SEGGER RTT control block.
-*
-*  Return value
-*    Number of bytes which have been stored in the "Up"-buffer.
-*
-*  Notes
-*    (1) Data is stored according to buffer flags.
-*    (2) For performance reasons this function does not call Init()
-*        and may only be called after RTT has been initialized.
-*        Either by calling SEGGER_RTT_Init() or calling another RTT API function first.
-*/
-unsigned SEGGER_RTT_WriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) {
-  unsigned              Status;
-  unsigned              Avail;
-  const char*           pData;
-  SEGGER_RTT_BUFFER_UP* pRing;
-
-  pData = (const char *)pBuffer;
-  //
-  // Get "to-host" ring buffer.
-  //
-  pRing = &_SEGGER_RTT.aUp[BufferIndex];
-  //
-  // How we output depends upon the mode...
-  //
-  switch (pRing->Flags) {
-  case SEGGER_RTT_MODE_NO_BLOCK_SKIP:
-    //
-    // If we are in skip mode and there is no space for the whole
-    // of this output, don't bother.
-    //
-    Avail = _GetAvailWriteSpace(pRing);
-    if (Avail < NumBytes) {
-      Status = 0u;
-    } else {
-      Status = NumBytes;
-      _WriteNoCheck(pRing, pData, NumBytes);
-    }
-    break;
-  case SEGGER_RTT_MODE_NO_BLOCK_TRIM:
-    //
-    // If we are in trim mode, trim to what we can output without blocking.
-    //
-    Avail = _GetAvailWriteSpace(pRing);
-    Status = Avail < NumBytes ? Avail : NumBytes;
-    _WriteNoCheck(pRing, pData, Status);
-    break;
-  case SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL:
-    //
-    // If we are in blocking mode, output everything.
-    //
-    Status = _WriteBlocking(pRing, pData, NumBytes);
-    break;
-  default:
-    Status = 0u;
-    break;
-  }
-  //
-  // Finish up.
-  //
-  return Status;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_Write
-*
-*  Function description
-*    Stores a specified number of characters in SEGGER RTT
-*    control block which is then read by the host.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
-*    pBuffer      Pointer to character array. Does not need to point to a \0 terminated string.
-*    NumBytes     Number of bytes to be stored in the SEGGER RTT control block.
-*
-*  Return value
-*    Number of bytes which have been stored in the "Up"-buffer.
-*
-*  Notes
-*    (1) Data is stored according to buffer flags.
-*/
-unsigned SEGGER_RTT_Write(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) {
-  unsigned Status;
-  //
-  INIT();
-  SEGGER_RTT_LOCK();
-  //
-  // Call the non-locking write function
-  //
-  Status = SEGGER_RTT_WriteNoLock(BufferIndex, pBuffer, NumBytes);
-  //
-  // Finish up.
-  //
-  SEGGER_RTT_UNLOCK();
-  //
-  return Status;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_WriteString
-*
-*  Function description
-*    Stores string in SEGGER RTT control block.
-*    This data is read by the host.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
-*    s            Pointer to string.
-*
-*  Return value
-*    Number of bytes which have been stored in the "Up"-buffer.
-*
-*  Notes
-*    (1) Data is stored according to buffer flags.
-*    (2) String passed to this function has to be \0 terminated
-*    (3) \0 termination character is *not* stored in RTT buffer
-*/
-unsigned SEGGER_RTT_WriteString(unsigned BufferIndex, const char* s) {
-  unsigned Len;
-
-  Len = STRLEN(s);
-  return SEGGER_RTT_Write(BufferIndex, s, Len);
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_PutCharSkipNoLock
-*
-*  Function description
-*    Stores a single character/byte in SEGGER RTT buffer.
-*    SEGGER_RTT_PutCharSkipNoLock does not lock the application and
-*    skips the byte, if it does not fit into the buffer.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
-*    c            Byte to be stored.
-*
-*  Return value
-*    Number of bytes which have been stored in the "Up"-buffer.
-*
-*  Notes
-*    (1) If there is not enough space in the "Up"-buffer, the character is dropped.
-*    (2) For performance reasons this function does not call Init()
-*        and may only be called after RTT has been initialized.
-*        Either by calling SEGGER_RTT_Init() or calling another RTT API function first.
-*/
-
-unsigned SEGGER_RTT_PutCharSkipNoLock(unsigned BufferIndex, char c) {
-  SEGGER_RTT_BUFFER_UP* pRing;
-  unsigned              WrOff;
-  unsigned              Status;
-  //
-  // Get "to-host" ring buffer.
-  //
-  pRing = &_SEGGER_RTT.aUp[BufferIndex];
-  //
-  // Get write position and handle wrap-around if necessary
-  //
-  WrOff = pRing->WrOff + 1;
-  if (WrOff == pRing->SizeOfBuffer) {
-    WrOff = 0;
-  }
-  //
-  // Output byte if free space is available
-  //
-  if (WrOff != pRing->RdOff) {
-    pRing->pBuffer[pRing->WrOff] = c;
-    pRing->WrOff = WrOff;
-    Status = 1;
-  } else {
-    Status = 0;
-  }
-  //
-  return Status;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_PutCharSkip
-*
-*  Function description
-*    Stores a single character/byte in SEGGER RTT buffer.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
-*    c            Byte to be stored.
-*
-*  Return value
-*    Number of bytes which have been stored in the "Up"-buffer.
-*
-*  Notes
-*    (1) If there is not enough space in the "Up"-buffer, the character is dropped.
-*/
-
-unsigned SEGGER_RTT_PutCharSkip(unsigned BufferIndex, char c) {
-  SEGGER_RTT_BUFFER_UP* pRing;
-  unsigned              WrOff;
-  unsigned              Status;
-  //
-  // Prepare
-  //
-  INIT();
-  SEGGER_RTT_LOCK();
-  //
-  // Get "to-host" ring buffer.
-  //
-  pRing = &_SEGGER_RTT.aUp[BufferIndex];
-  //
-  // Get write position and handle wrap-around if necessary
-  //
-  WrOff = pRing->WrOff + 1;
-  if (WrOff == pRing->SizeOfBuffer) {
-    WrOff = 0;
-  }
-  //
-  // Output byte if free space is available
-  //
-  if (WrOff != pRing->RdOff) {
-    pRing->pBuffer[pRing->WrOff] = c;
-    pRing->WrOff = WrOff;
-    Status = 1;
-  } else {
-    Status = 0;
-  }
-  //
-  // Finish up.
-  //
-  SEGGER_RTT_UNLOCK();
-  //
-  return Status;
-}
-
- /*********************************************************************
-*
-*       SEGGER_RTT_PutChar
-*
-*  Function description
-*    Stores a single character/byte in SEGGER RTT buffer.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
-*    c            Byte to be stored.
-*
-*  Return value
-*    Number of bytes which have been stored in the "Up"-buffer.
-*
-*  Notes
-*    (1) Data is stored according to buffer flags.
-*/
-
-unsigned SEGGER_RTT_PutChar(unsigned BufferIndex, char c) {
-  SEGGER_RTT_BUFFER_UP* pRing;
-  unsigned              WrOff;
-  unsigned              Status;
-  //
-  // Prepare
-  //
-  INIT();
-  SEGGER_RTT_LOCK();
-  //
-  // Get "to-host" ring buffer.
-  //
-  pRing = &_SEGGER_RTT.aUp[BufferIndex];
-  //
-  // Get write position and handle wrap-around if necessary
-  //
-  WrOff = pRing->WrOff + 1;
-  if (WrOff == pRing->SizeOfBuffer) {
-    WrOff = 0;
-  }
-  //
-  // Wait for free space if mode is set to blocking
-  //
-  if (pRing->Flags == SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) {
-    while (WrOff == pRing->RdOff) {
-      ;
-    }
-  }
-  //
-  // Output byte if free space is available
-  //
-  if (WrOff != pRing->RdOff) {
-    pRing->pBuffer[pRing->WrOff] = c;
-    pRing->WrOff = WrOff;
-    Status = 1;
-  } else {
-    Status = 0;
-  }
-  //
-  // Finish up.
-  //
-  SEGGER_RTT_UNLOCK();
-  //
-  return Status;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_GetKey
-*
-*  Function description
-*    Reads one character from the SEGGER RTT buffer.
-*    Host has previously stored data there.
-*
-*  Return value
-*    <  0 -   No character available (buffer empty).
-*    >= 0 -   Character which has been read. (Possible values: 0 - 255)
-*
-*  Notes
-*    (1) This function is only specified for accesses to RTT buffer 0.
-*/
-int SEGGER_RTT_GetKey(void) {
-  char c;
-  int r;
-
-  r = (int)SEGGER_RTT_Read(0u, &c, 1u);
-  if (r == 1) {
-    r = (int)(unsigned char)c;
-  } else {
-    r = -1;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_WaitKey
-*
-*  Function description
-*    Waits until at least one character is avaible in the SEGGER RTT buffer.
-*    Once a character is available, it is read and this function returns.
-*
-*  Return value
-*    >=0 -   Character which has been read.
-*
-*  Notes
-*    (1) This function is only specified for accesses to RTT buffer 0
-*    (2) This function is blocking if no character is present in RTT buffer
-*/
-int SEGGER_RTT_WaitKey(void) {
-  int r;
-
-  do {
-    r = SEGGER_RTT_GetKey();
-  } while (r < 0);
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_HasKey
-*
-*  Function description
-*    Checks if at least one character for reading is available in the SEGGER RTT buffer.
-*
-*  Return value
-*    == 0 -     No characters are available to read.
-*    == 1 -     At least one character is available.
-*
-*  Notes
-*    (1) This function is only specified for accesses to RTT buffer 0
-*/
-int SEGGER_RTT_HasKey(void) {
-  unsigned RdOff;
-  int r;
-
-  INIT();
-  RdOff = _SEGGER_RTT.aDown[0].RdOff;
-  if (RdOff != _SEGGER_RTT.aDown[0].WrOff) {
-    r = 1;
-  } else {
-    r = 0;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_HasData
-*
-*  Function description
-*    Check if there is data from the host in the given buffer.
-*
-*  Return value:
-*  ==0:  No data
-*  !=0:  Data in buffer
-*
-*/
-unsigned SEGGER_RTT_HasData(unsigned BufferIndex) {
-  SEGGER_RTT_BUFFER_DOWN* pRing;
-  unsigned                v;
-
-  pRing = &_SEGGER_RTT.aDown[BufferIndex];
-  v = pRing->WrOff;
-  return v - pRing->RdOff;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_HasDataUp
-*
-*  Function description
-*    Check if there is data remaining to be sent in the given buffer.
-*
-*  Return value:
-*  ==0:  No data
-*  !=0:  Data in buffer
-*
-*/
-unsigned SEGGER_RTT_HasDataUp(unsigned BufferIndex) {
-  SEGGER_RTT_BUFFER_UP* pRing;
-  unsigned                v;
-
-  pRing = &_SEGGER_RTT.aUp[BufferIndex];
-  v = pRing->RdOff;
-  return pRing->WrOff - v;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_AllocDownBuffer
-*
-*  Function description
-*    Run-time configuration of the next down-buffer (H->T).
-*    The next buffer, which is not used yet is configured.
-*    This includes: Buffer address, size, name, flags, ...
-*
-*  Parameters
-*    sName        Pointer to a constant name string.
-*    pBuffer      Pointer to a buffer to be used.
-*    BufferSize   Size of the buffer.
-*    Flags        Operating modes. Define behavior if buffer is full (not enough space for entire message).
-*
-*  Return value
-*    >= 0 - O.K. Buffer Index
-*     < 0 - Error
-*/
-int SEGGER_RTT_AllocDownBuffer(const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) {
-  int BufferIndex;
-
-  INIT();
-  SEGGER_RTT_LOCK();
-  BufferIndex = 0;
-  do {
-    if (_SEGGER_RTT.aDown[BufferIndex].pBuffer == NULL) {
-      break;
-    }
-    BufferIndex++;
-  } while (BufferIndex < _SEGGER_RTT.MaxNumDownBuffers);
-  if (BufferIndex < _SEGGER_RTT.MaxNumDownBuffers) {
-    _SEGGER_RTT.aDown[BufferIndex].sName        = sName;
-    _SEGGER_RTT.aDown[BufferIndex].pBuffer      = (char*)pBuffer;
-    _SEGGER_RTT.aDown[BufferIndex].SizeOfBuffer = BufferSize;
-    _SEGGER_RTT.aDown[BufferIndex].RdOff        = 0u;
-    _SEGGER_RTT.aDown[BufferIndex].WrOff        = 0u;
-    _SEGGER_RTT.aDown[BufferIndex].Flags        = Flags;
-  } else {
-    BufferIndex = -1;
-  }
-  SEGGER_RTT_UNLOCK();
-  return BufferIndex;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_AllocUpBuffer
-*
-*  Function description
-*    Run-time configuration of the next up-buffer (T->H).
-*    The next buffer, which is not used yet is configured.
-*    This includes: Buffer address, size, name, flags, ...
-*
-*  Parameters
-*    sName        Pointer to a constant name string.
-*    pBuffer      Pointer to a buffer to be used.
-*    BufferSize   Size of the buffer.
-*    Flags        Operating modes. Define behavior if buffer is full (not enough space for entire message).
-*
-*  Return value
-*    >= 0 - O.K. Buffer Index
-*     < 0 - Error
-*/
-int SEGGER_RTT_AllocUpBuffer(const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) {
-  int BufferIndex;
-
-  INIT();
-  SEGGER_RTT_LOCK();
-  BufferIndex = 0;
-  do {
-    if (_SEGGER_RTT.aUp[BufferIndex].pBuffer == NULL) {
-      break;
-    }
-    BufferIndex++;
-  } while (BufferIndex < _SEGGER_RTT.MaxNumUpBuffers);
-  if (BufferIndex < _SEGGER_RTT.MaxNumUpBuffers) {
-    _SEGGER_RTT.aUp[BufferIndex].sName        = sName;
-    _SEGGER_RTT.aUp[BufferIndex].pBuffer      = (char*)pBuffer;
-    _SEGGER_RTT.aUp[BufferIndex].SizeOfBuffer = BufferSize;
-    _SEGGER_RTT.aUp[BufferIndex].RdOff        = 0u;
-    _SEGGER_RTT.aUp[BufferIndex].WrOff        = 0u;
-    _SEGGER_RTT.aUp[BufferIndex].Flags        = Flags;
-  } else {
-    BufferIndex = -1;
-  }
-  SEGGER_RTT_UNLOCK();
-  return BufferIndex;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_ConfigUpBuffer
-*
-*  Function description
-*    Run-time configuration of a specific up-buffer (T->H).
-*    Buffer to be configured is specified by index.
-*    This includes: Buffer address, size, name, flags, ...
-*
-*  Parameters
-*    BufferIndex  Index of the buffer to configure.
-*    sName        Pointer to a constant name string.
-*    pBuffer      Pointer to a buffer to be used.
-*    BufferSize   Size of the buffer.
-*    Flags        Operating modes. Define behavior if buffer is full (not enough space for entire message).
-*
-*  Return value
-*    >= 0 - O.K.
-*     < 0 - Error
-*
-*  Additional information
-*    Buffer 0 is configured on compile-time.
-*    May only be called once per buffer.
-*    Buffer name and flags can be reconfigured using the appropriate functions.
-*/
-int SEGGER_RTT_ConfigUpBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) {
-  int r;
-
-  INIT();
-  if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) {
-    SEGGER_RTT_LOCK();
-    if (BufferIndex > 0u) {
-      _SEGGER_RTT.aUp[BufferIndex].sName        = sName;
-      _SEGGER_RTT.aUp[BufferIndex].pBuffer      = (char*)pBuffer;
-      _SEGGER_RTT.aUp[BufferIndex].SizeOfBuffer = BufferSize;
-      _SEGGER_RTT.aUp[BufferIndex].RdOff        = 0u;
-      _SEGGER_RTT.aUp[BufferIndex].WrOff        = 0u;
-    }
-    _SEGGER_RTT.aUp[BufferIndex].Flags          = Flags;
-    SEGGER_RTT_UNLOCK();
-    r =  0;
-  } else {
-    r = -1;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_ConfigDownBuffer
-*
-*  Function description
-*    Run-time configuration of a specific down-buffer (H->T).
-*    Buffer to be configured is specified by index.
-*    This includes: Buffer address, size, name, flags, ...
-*
-*  Parameters
-*    BufferIndex  Index of the buffer to configure.
-*    sName        Pointer to a constant name string.
-*    pBuffer      Pointer to a buffer to be used.
-*    BufferSize   Size of the buffer.
-*    Flags        Operating modes. Define behavior if buffer is full (not enough space for entire message).
-*
-*  Return value
-*    >= 0  O.K.
-*     < 0  Error
-*
-*  Additional information
-*    Buffer 0 is configured on compile-time.
-*    May only be called once per buffer.
-*    Buffer name and flags can be reconfigured using the appropriate functions.
-*/
-int SEGGER_RTT_ConfigDownBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) {
-  int r;
-
-  INIT();
-  if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) {
-    SEGGER_RTT_LOCK();
-    if (BufferIndex > 0u) {
-      _SEGGER_RTT.aDown[BufferIndex].sName        = sName;
-      _SEGGER_RTT.aDown[BufferIndex].pBuffer      = (char*)pBuffer;
-      _SEGGER_RTT.aDown[BufferIndex].SizeOfBuffer = BufferSize;
-      _SEGGER_RTT.aDown[BufferIndex].RdOff        = 0u;
-      _SEGGER_RTT.aDown[BufferIndex].WrOff        = 0u;
-    }
-    _SEGGER_RTT.aDown[BufferIndex].Flags          = Flags;
-    SEGGER_RTT_UNLOCK();
-    r =  0;
-  } else {
-    r = -1;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_SetNameUpBuffer
-*
-*  Function description
-*    Run-time configuration of a specific up-buffer name (T->H).
-*    Buffer to be configured is specified by index.
-*
-*  Parameters
-*    BufferIndex  Index of the buffer to renamed.
-*    sName        Pointer to a constant name string.
-*
-*  Return value
-*    >= 0  O.K.
-*     < 0  Error
-*/
-int SEGGER_RTT_SetNameUpBuffer(unsigned BufferIndex, const char* sName) {
-  int r;
-
-  INIT();
-  if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) {
-    SEGGER_RTT_LOCK();
-    _SEGGER_RTT.aUp[BufferIndex].sName = sName;
-    SEGGER_RTT_UNLOCK();
-    r =  0;
-  } else {
-    r = -1;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_SetNameDownBuffer
-*
-*  Function description
-*    Run-time configuration of a specific Down-buffer name (T->H).
-*    Buffer to be configured is specified by index.
-*
-*  Parameters
-*    BufferIndex  Index of the buffer to renamed.
-*    sName        Pointer to a constant name string.
-*
-*  Return value
-*    >= 0  O.K.
-*     < 0  Error
-*/
-int SEGGER_RTT_SetNameDownBuffer(unsigned BufferIndex, const char* sName) {
-  int r;
-
-  INIT();
-  if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) {
-    SEGGER_RTT_LOCK();
-    _SEGGER_RTT.aDown[BufferIndex].sName = sName;
-    SEGGER_RTT_UNLOCK();
-    r =  0;
-  } else {
-    r = -1;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_SetFlagsUpBuffer
-*
-*  Function description
-*    Run-time configuration of specific up-buffer flags (T->H).
-*    Buffer to be configured is specified by index.
-*
-*  Parameters
-*    BufferIndex  Index of the buffer.
-*    Flags        Flags to set for the buffer.
-*
-*  Return value
-*    >= 0  O.K.
-*     < 0  Error
-*/
-int SEGGER_RTT_SetFlagsUpBuffer(unsigned BufferIndex, unsigned Flags) {
-  int r;
-
-  INIT();
-  if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) {
-    SEGGER_RTT_LOCK();
-    _SEGGER_RTT.aUp[BufferIndex].Flags = Flags;
-    SEGGER_RTT_UNLOCK();
-    r =  0;
-  } else {
-    r = -1;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_SetFlagsDownBuffer
-*
-*  Function description
-*    Run-time configuration of specific Down-buffer flags (T->H).
-*    Buffer to be configured is specified by index.
-*
-*  Parameters
-*    BufferIndex  Index of the buffer to renamed.
-*    Flags        Flags to set for the buffer.
-*
-*  Return value
-*    >= 0  O.K.
-*     < 0  Error
-*/
-int SEGGER_RTT_SetFlagsDownBuffer(unsigned BufferIndex, unsigned Flags) {
-  int r;
-
-  INIT();
-  if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) {
-    SEGGER_RTT_LOCK();
-    _SEGGER_RTT.aDown[BufferIndex].Flags = Flags;
-    SEGGER_RTT_UNLOCK();
-    r =  0;
-  } else {
-    r = -1;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_Init
-*
-*  Function description
-*    Initializes the RTT Control Block.
-*    Should be used in RAM targets, at start of the application.
-*
-*/
-void SEGGER_RTT_Init (void) {
-  _DoInit();
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_SetTerminal
-*
-*  Function description
-*    Sets the terminal to be used for output on channel 0.
-*
-*  Parameters
-*    TerminalId  Index of the terminal.
-*
-*  Return value
-*    >= 0  O.K.
-*     < 0  Error (e.g. if RTT is configured for non-blocking mode and there was no space in the buffer to set the new terminal Id)
-*/
-int SEGGER_RTT_SetTerminal (char TerminalId) {
-  unsigned char         ac[2];
-  SEGGER_RTT_BUFFER_UP* pRing;
-  unsigned Avail;
-  int r;
-  //
-  INIT();
-  //
-  r = 0;
-  ac[0] = 0xFFu;
-  if ((unsigned char)TerminalId < (unsigned char)sizeof(_aTerminalId)) { // We only support a certain number of channels
-    ac[1] = _aTerminalId[(unsigned char)TerminalId];
-    pRing = &_SEGGER_RTT.aUp[0];    // Buffer 0 is always reserved for terminal I/O, so we can use index 0 here, fixed
-    SEGGER_RTT_LOCK();    // Lock to make sure that no other task is writing into buffer, while we are and number of free bytes in buffer does not change downwards after checking and before writing
-    if ((pRing->Flags & SEGGER_RTT_MODE_MASK) == SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) {
-      _ActiveTerminal = TerminalId;
-      _WriteBlocking(pRing, (const char*)ac, 2u);
-    } else {                                                                            // Skipping mode or trim mode? => We cannot trim this command so handling is the same for both modes
-      Avail = _GetAvailWriteSpace(pRing);
-      if (Avail >= 2) {
-        _ActiveTerminal = TerminalId;    // Only change active terminal in case of success
-        _WriteNoCheck(pRing, (const char*)ac, 2u);
-      } else {
-        r = -1;
-      }
-    }
-    SEGGER_RTT_UNLOCK();
-  } else {
-    r = -1;
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_TerminalOut
-*
-*  Function description
-*    Writes a string to the given terminal
-*     without changing the terminal for channel 0.
-*
-*  Parameters
-*    TerminalId   Index of the terminal.
-*    s            String to be printed on the terminal.
-*
-*  Return value
-*    >= 0 - Number of bytes written.
-*     < 0 - Error.
-*
-*/
-int SEGGER_RTT_TerminalOut (char TerminalId, const char* s) {
-  int                   Status;
-  unsigned              FragLen;
-  unsigned              Avail;
-  SEGGER_RTT_BUFFER_UP* pRing;
-  //
-  INIT();
-  //
-  // Validate terminal ID.
-  //
-  if (TerminalId < (char)sizeof(_aTerminalId)) { // We only support a certain number of channels
-    //
-    // Get "to-host" ring buffer.
-    //
-    pRing = &_SEGGER_RTT.aUp[0];
-    //
-    // Need to be able to change terminal, write data, change back.
-    // Compute the fixed and variable sizes.
-    //
-    FragLen = STRLEN(s);
-    //
-    // How we output depends upon the mode...
-    //
-    SEGGER_RTT_LOCK();
-    Avail = _GetAvailWriteSpace(pRing);
-    switch (pRing->Flags & SEGGER_RTT_MODE_MASK) {
-    case SEGGER_RTT_MODE_NO_BLOCK_SKIP:
-      //
-      // If we are in skip mode and there is no space for the whole
-      // of this output, don't bother switching terminals at all.
-      //
-      if (Avail < (FragLen + 4u)) {
-        Status = 0;
-      } else {
-        _PostTerminalSwitch(pRing, TerminalId);
-        Status = (int)_WriteBlocking(pRing, s, FragLen);
-        _PostTerminalSwitch(pRing, _ActiveTerminal);
-      }
-      break;
-    case SEGGER_RTT_MODE_NO_BLOCK_TRIM:
-      //
-      // If we are in trim mode and there is not enough space for everything,
-      // trim the output but always include the terminal switch.  If no room
-      // for terminal switch, skip that totally.
-      //
-      if (Avail < 4u) {
-        Status = -1;
-      } else {
-        _PostTerminalSwitch(pRing, TerminalId);
-        Status = (int)_WriteBlocking(pRing, s, (FragLen < (Avail - 4u)) ? FragLen : (Avail - 4u));
-        _PostTerminalSwitch(pRing, _ActiveTerminal);
-      }
-      break;
-    case SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL:
-      //
-      // If we are in blocking mode, output everything.
-      //
-      _PostTerminalSwitch(pRing, TerminalId);
-      Status = (int)_WriteBlocking(pRing, s, FragLen);
-      _PostTerminalSwitch(pRing, _ActiveTerminal);
-      break;
-    default:
-      Status = -1;
-      break;
-    }
-    //
-    // Finish up.
-    //
-    SEGGER_RTT_UNLOCK();
-  } else {
-    Status = -1;
-  }
-  return Status;
-}
-
-
-/*************************** End of file ****************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT.h b/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT.h
deleted file mode 100644
index 7c6a0a9..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*                        The Embedded Experts                        *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-*       SEGGER RTT * Real Time Transfer for embedded targets         *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-* All rights reserved.                                               *
-*                                                                    *
-* SEGGER strongly recommends to not make any changes                 *
-* to or modify the source code of this software in order to stay     *
-* compatible with the RTT protocol and J-Link.                       *
-*                                                                    *
-* Redistribution and use in source and binary forms, with or         *
-* without modification, are permitted provided that the following    *
-* conditions are met:                                                *
-*                                                                    *
-* o Redistributions of source code must retain the above copyright   *
-*   notice, this list of conditions and the following disclaimer.    *
-*                                                                    *
-* o 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.                                           *
-*                                                                    *
-* o Neither the name of SEGGER Microcontroller GmbH                  *
-*   nor the names of its contributors may be used to endorse or      *
-*   promote products derived from this software without specific     *
-*   prior written permission.                                        *
-*                                                                    *
-* 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           *
-* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller 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.                                                            *
-*                                                                    *
-**********************************************************************
----------------------------END-OF-HEADER------------------------------
-File    : SEGGER_RTT.h
-Purpose : Implementation of SEGGER real-time transfer which allows
-          real-time communication on targets which support debugger 
-          memory accesses while the CPU is running.
-Revision: $Rev: 12826 $
-----------------------------------------------------------------------
-*/
-
-#ifndef SEGGER_RTT_H
-#define SEGGER_RTT_H
-
-#ifdef SEGGER_RTT_CONFIG_H
-#include SEGGER_RTT_CONFIG_H
-#else
-#include "SEGGER_RTT_Conf.h"
-#endif
-
-#ifndef SEGGER_RTT_ASM  // defined when SEGGER_RTT.h is included from assembly file
-#include <stdlib.h>
-#include <stdarg.h>
-
-/*********************************************************************
-*
-*       Defines, fixed
-*
-**********************************************************************
-*/
-
-/*********************************************************************
-*
-*       Types
-*
-**********************************************************************
-*/
-
-//
-// Description for a circular buffer (also called "ring buffer")
-// which is used as up-buffer (T->H)
-//
-typedef struct {
-  const     char*    sName;         // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4"
-            char*    pBuffer;       // Pointer to start of buffer
-            unsigned SizeOfBuffer;  // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty.
-            unsigned WrOff;         // Position of next item to be written by either target.
-  volatile  unsigned RdOff;         // Position of next item to be read by host. Must be volatile since it may be modified by host.
-            unsigned Flags;         // Contains configuration flags
-} SEGGER_RTT_BUFFER_UP;
-
-//
-// Description for a circular buffer (also called "ring buffer")
-// which is used as down-buffer (H->T)
-//
-typedef struct {
-  const     char*    sName;         // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4"
-            char*    pBuffer;       // Pointer to start of buffer
-            unsigned SizeOfBuffer;  // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty.
-  volatile  unsigned WrOff;         // Position of next item to be written by host. Must be volatile since it may be modified by host.
-            unsigned RdOff;         // Position of next item to be read by target (down-buffer).
-            unsigned Flags;         // Contains configuration flags
-} SEGGER_RTT_BUFFER_DOWN;
-
-//
-// RTT control block which describes the number of buffers available
-// as well as the configuration for each buffer
-//
-//
-typedef struct {
-  char                    acID[16];                                 // Initialized to "SEGGER RTT"
-  int                     MaxNumUpBuffers;                          // Initialized to SEGGER_RTT_MAX_NUM_UP_BUFFERS (type. 2)
-  int                     MaxNumDownBuffers;                        // Initialized to SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (type. 2)
-  SEGGER_RTT_BUFFER_UP    aUp[SEGGER_RTT_MAX_NUM_UP_BUFFERS];       // Up buffers, transferring information up from target via debug probe to host
-  SEGGER_RTT_BUFFER_DOWN  aDown[SEGGER_RTT_MAX_NUM_DOWN_BUFFERS];   // Down buffers, transferring information down from host via debug probe to target
-} SEGGER_RTT_CB;
-
-/*********************************************************************
-*
-*       Global data
-*
-**********************************************************************
-*/
-extern SEGGER_RTT_CB _SEGGER_RTT;
-
-/*********************************************************************
-*
-*       RTT API functions
-*
-**********************************************************************
-*/
-#ifdef __cplusplus
-  extern "C" {
-#endif
-int          SEGGER_RTT_AllocDownBuffer         (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
-int          SEGGER_RTT_AllocUpBuffer           (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
-int          SEGGER_RTT_ConfigUpBuffer          (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
-int          SEGGER_RTT_ConfigDownBuffer        (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
-int          SEGGER_RTT_GetKey                  (void);
-unsigned     SEGGER_RTT_HasData                 (unsigned BufferIndex);
-int          SEGGER_RTT_HasKey                  (void);
-unsigned     SEGGER_RTT_HasDataUp               (unsigned BufferIndex);
-void         SEGGER_RTT_Init                    (void);
-unsigned     SEGGER_RTT_Read                    (unsigned BufferIndex,       void* pBuffer, unsigned BufferSize);
-unsigned     SEGGER_RTT_ReadNoLock              (unsigned BufferIndex,       void* pData,   unsigned BufferSize);
-int          SEGGER_RTT_SetNameDownBuffer       (unsigned BufferIndex, const char* sName);
-int          SEGGER_RTT_SetNameUpBuffer         (unsigned BufferIndex, const char* sName);
-int          SEGGER_RTT_SetFlagsDownBuffer      (unsigned BufferIndex, unsigned Flags);
-int          SEGGER_RTT_SetFlagsUpBuffer        (unsigned BufferIndex, unsigned Flags);
-int          SEGGER_RTT_WaitKey                 (void);
-unsigned     SEGGER_RTT_Write                   (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
-unsigned     SEGGER_RTT_WriteNoLock             (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
-unsigned     SEGGER_RTT_WriteSkipNoLock         (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
-unsigned     SEGGER_RTT_WriteString             (unsigned BufferIndex, const char* s);
-void         SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
-unsigned     SEGGER_RTT_PutChar                 (unsigned BufferIndex, char c);
-unsigned     SEGGER_RTT_PutCharSkip             (unsigned BufferIndex, char c);
-unsigned     SEGGER_RTT_PutCharSkipNoLock       (unsigned BufferIndex, char c);
-//
-// Function macro for performance optimization
-//
-#define      SEGGER_RTT_HASDATA(n)       (_SEGGER_RTT.aDown[n].WrOff - _SEGGER_RTT.aDown[n].RdOff)
-
-/*********************************************************************
-*
-*       RTT "Terminal" API functions
-*
-**********************************************************************
-*/
-int     SEGGER_RTT_SetTerminal        (char TerminalId);
-int     SEGGER_RTT_TerminalOut        (char TerminalId, const char* s);
-
-/*********************************************************************
-*
-*       RTT printf functions (require SEGGER_RTT_printf.c)
-*
-**********************************************************************
-*/
-int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...);
-int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList);
-
-#ifdef __cplusplus
-  }
-#endif
-
-#endif // SEGGER_RTT_ASM
-
-/*********************************************************************
-*
-*       Defines
-*
-**********************************************************************
-*/
-
-//
-// Operating modes. Define behavior if buffer is full (not enough space for entire message)
-//
-#define SEGGER_RTT_MODE_NO_BLOCK_SKIP         (0)     // Skip. Do not block, output nothing. (Default)
-#define SEGGER_RTT_MODE_NO_BLOCK_TRIM         (1)     // Trim: Do not block, output as much as fits.
-#define SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL    (2)     // Block: Wait until there is space in the buffer.
-#define SEGGER_RTT_MODE_MASK                  (3)
-
-//
-// Control sequences, based on ANSI.
-// Can be used to control color, and clear the screen
-//
-#define RTT_CTRL_RESET                "\x1B[0m"         // Reset to default colors
-#define RTT_CTRL_CLEAR                "\x1B[2J"         // Clear screen, reposition cursor to top left
-
-#define RTT_CTRL_TEXT_BLACK           "\x1B[2;30m"
-#define RTT_CTRL_TEXT_RED             "\x1B[2;31m"
-#define RTT_CTRL_TEXT_GREEN           "\x1B[2;32m"
-#define RTT_CTRL_TEXT_YELLOW          "\x1B[2;33m"
-#define RTT_CTRL_TEXT_BLUE            "\x1B[2;34m"
-#define RTT_CTRL_TEXT_MAGENTA         "\x1B[2;35m"
-#define RTT_CTRL_TEXT_CYAN            "\x1B[2;36m"
-#define RTT_CTRL_TEXT_WHITE           "\x1B[2;37m"
-
-#define RTT_CTRL_TEXT_BRIGHT_BLACK    "\x1B[1;30m"
-#define RTT_CTRL_TEXT_BRIGHT_RED      "\x1B[1;31m"
-#define RTT_CTRL_TEXT_BRIGHT_GREEN    "\x1B[1;32m"
-#define RTT_CTRL_TEXT_BRIGHT_YELLOW   "\x1B[1;33m"
-#define RTT_CTRL_TEXT_BRIGHT_BLUE     "\x1B[1;34m"
-#define RTT_CTRL_TEXT_BRIGHT_MAGENTA  "\x1B[1;35m"
-#define RTT_CTRL_TEXT_BRIGHT_CYAN     "\x1B[1;36m"
-#define RTT_CTRL_TEXT_BRIGHT_WHITE    "\x1B[1;37m"
-
-#define RTT_CTRL_BG_BLACK             "\x1B[24;40m"
-#define RTT_CTRL_BG_RED               "\x1B[24;41m"
-#define RTT_CTRL_BG_GREEN             "\x1B[24;42m"
-#define RTT_CTRL_BG_YELLOW            "\x1B[24;43m"
-#define RTT_CTRL_BG_BLUE              "\x1B[24;44m"
-#define RTT_CTRL_BG_MAGENTA           "\x1B[24;45m"
-#define RTT_CTRL_BG_CYAN              "\x1B[24;46m"
-#define RTT_CTRL_BG_WHITE             "\x1B[24;47m"
-
-#define RTT_CTRL_BG_BRIGHT_BLACK      "\x1B[4;40m"
-#define RTT_CTRL_BG_BRIGHT_RED        "\x1B[4;41m"
-#define RTT_CTRL_BG_BRIGHT_GREEN      "\x1B[4;42m"
-#define RTT_CTRL_BG_BRIGHT_YELLOW     "\x1B[4;43m"
-#define RTT_CTRL_BG_BRIGHT_BLUE       "\x1B[4;44m"
-#define RTT_CTRL_BG_BRIGHT_MAGENTA    "\x1B[4;45m"
-#define RTT_CTRL_BG_BRIGHT_CYAN       "\x1B[4;46m"
-#define RTT_CTRL_BG_BRIGHT_WHITE      "\x1B[4;47m"
-
-
-#endif
-
-/*************************** End of file ****************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT_Conf.h b/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT_Conf.h
deleted file mode 100644
index d1ccfdd..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT_Conf.h
+++ /dev/null
@@ -1,340 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*                        The Embedded Experts                        *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-*       SEGGER RTT * Real Time Transfer for embedded targets         *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-* All rights reserved.                                               *
-*                                                                    *
-* SEGGER strongly recommends to not make any changes                 *
-* to or modify the source code of this software in order to stay     *
-* compatible with the RTT protocol and J-Link.                       *
-*                                                                    *
-* Redistribution and use in source and binary forms, with or         *
-* without modification, are permitted provided that the following    *
-* conditions are met:                                                *
-*                                                                    *
-* o Redistributions of source code must retain the above copyright   *
-*   notice, this list of conditions and the following disclaimer.    *
-*                                                                    *
-* o 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.                                           *
-*                                                                    *
-* o Neither the name of SEGGER Microcontroller GmbH                  *
-*   nor the names of its contributors may be used to endorse or      *
-*   promote products derived from this software without specific     *
-*   prior written permission.                                        *
-*                                                                    *
-* 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           *
-* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller 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.                                                            *
-*                                                                    *
-**********************************************************************
----------------------------END-OF-HEADER------------------------------
-File    : SEGGER_RTT_Conf.h
-Purpose : Implementation of SEGGER real-time transfer (RTT) which
-          allows real-time communication on targets which support
-          debugger memory accesses while the CPU is running.
-Revision: $Rev: 12847 $
-
-*/
-
-#ifndef SEGGER_RTT_CONF_H
-#define SEGGER_RTT_CONF_H
-
-#ifdef __IAR_SYSTEMS_ICC__
-  #include <intrinsics.h>
-#endif
-
-/*********************************************************************
-*
-*       Defines, configurable
-*
-**********************************************************************
-*/
-
-#define SEGGER_RTT_MAX_NUM_UP_BUFFERS             (3)     // Max. number of up-buffers (T->H) available on this target    (Default: 3)
-#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS           (3)     // Max. number of down-buffers (H->T) available on this target  (Default: 3)
-
-#define BUFFER_SIZE_UP                            (1024)  // Size of the buffer for terminal output of target, up to host (Default: 1k)
-#define BUFFER_SIZE_DOWN                          (16)    // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16)
-
-#define SEGGER_RTT_PRINTF_BUFFER_SIZE             (64u)    // Size of buffer for RTT printf to bulk-send chars via RTT     (Default: 64)
-
-#define SEGGER_RTT_MODE_DEFAULT                   SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0)
-
-#define USE_RTT_ASM                               (0)     // Use assembler version of SEGGER_RTT.c when 1 
-
-/*********************************************************************
-*
-*       RTT memcpy configuration
-*
-*       memcpy() is good for large amounts of data, 
-*       but the overhead is big for small amounts, which are usually stored via RTT.
-*       With SEGGER_RTT_MEMCPY_USE_BYTELOOP a simple byte loop can be used instead.
-*
-*       SEGGER_RTT_MEMCPY() can be used to replace standard memcpy() in RTT functions.
-*       This is may be required with memory access restrictions, 
-*       such as on Cortex-A devices with MMU.
-*/
-#define SEGGER_RTT_MEMCPY_USE_BYTELOOP              0 // 0: Use memcpy/SEGGER_RTT_MEMCPY, 1: Use a simple byte-loop
-//
-// Example definition of SEGGER_RTT_MEMCPY to external memcpy with GCC toolchains and Cortex-A targets
-//
-//#if ((defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__)) && (defined (__ARM_ARCH_7A__))  
-//  #define SEGGER_RTT_MEMCPY(pDest, pSrc, NumBytes)      SEGGER_memcpy((pDest), (pSrc), (NumBytes))
-//#endif
-
-//
-// Target is not allowed to perform other RTT operations while string still has not been stored completely.
-// Otherwise we would probably end up with a mixed string in the buffer.
-// If using  RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here.
-//
-// SEGGER_RTT_MAX_INTERRUPT_PRIORITY can be used in the sample lock routines on Cortex-M3/4.
-// Make sure to mask all interrupts which can send RTT data, i.e. generate SystemView events, or cause task switches.
-// When high-priority interrupts must not be masked while sending RTT data, SEGGER_RTT_MAX_INTERRUPT_PRIORITY needs to be adjusted accordingly.
-// (Higher priority = lower priority number)
-// Default value for embOS: 128u
-// Default configuration in FreeRTOS: configMAX_SYSCALL_INTERRUPT_PRIORITY: ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
-// In case of doubt mask all interrupts: 1 << (8 - BASEPRI_PRIO_BITS) i.e. 1 << 5 when 3 bits are implemented in NVIC
-// or define SEGGER_RTT_LOCK() to completely disable interrupts.
-//
-
-#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY         (0x20)   // Interrupt priority to lock on SEGGER_RTT_LOCK on Cortex-M3/4 (Default: 0x20)
-
-/*********************************************************************
-*
-*       RTT lock configuration for SEGGER Embedded Studio,
-*       Rowley CrossStudio and GCC
-*/
-#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__) || (defined __clang__)
-  #if (defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_8M_BASE__))
-    #define SEGGER_RTT_LOCK()   {                                                                   \
-                                    unsigned int LockState;                                         \
-                                  __asm volatile ("mrs   %0, primask  \n\t"                         \
-                                                  "movs  r1, $1       \n\t"                         \
-                                                  "msr   primask, r1  \n\t"                         \
-                                                  : "=r" (LockState)                                \
-                                                  :                                                 \
-                                                  : "r1"                                            \
-                                                  );
-
-    #define SEGGER_RTT_UNLOCK()   __asm volatile ("msr   primask, %0  \n\t"                         \
-                                                  :                                                 \
-                                                  : "r" (LockState)                                 \
-                                                  :                                                 \
-                                                  );                                                \
-                                }
-  #elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_8M_MAIN__))
-    #ifndef   SEGGER_RTT_MAX_INTERRUPT_PRIORITY
-      #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY   (0x20)
-    #endif
-    #define SEGGER_RTT_LOCK()   {                                                                   \
-                                    unsigned int LockState;                                         \
-                                  __asm volatile ("mrs   %0, basepri  \n\t"                         \
-                                                  "mov   r1, %1       \n\t"                         \
-                                                  "msr   basepri, r1  \n\t"                         \
-                                                  : "=r" (LockState)                                \
-                                                  : "i"(SEGGER_RTT_MAX_INTERRUPT_PRIORITY)          \
-                                                  : "r1"                                            \
-                                                  );
-
-    #define SEGGER_RTT_UNLOCK()   __asm volatile ("msr   basepri, %0  \n\t"                         \
-                                                  :                                                 \
-                                                  : "r" (LockState)                                 \
-                                                  :                                                 \
-                                                  );                                                \
-                                }
-
-  #elif defined(__ARM_ARCH_7A__)
-    #define SEGGER_RTT_LOCK() {                                                \
-                                 unsigned int LockState;                       \
-                                 __asm volatile ("mrs r1, CPSR \n\t"           \
-                                                 "mov %0, r1 \n\t"             \
-                                                 "orr r1, r1, #0xC0 \n\t"      \
-                                                 "msr CPSR_c, r1 \n\t"         \
-                                                 : "=r" (LockState)            \
-                                                 :                             \
-                                                 : "r1"                        \
-                                                 );
-
-    #define SEGGER_RTT_UNLOCK() __asm volatile ("mov r0, %0 \n\t"              \
-                                                "mrs r1, CPSR \n\t"            \
-                                                "bic r1, r1, #0xC0 \n\t"       \
-                                                "and r0, r0, #0xC0 \n\t"       \
-                                                "orr r1, r1, r0 \n\t"          \
-                                                "msr CPSR_c, r1 \n\t"          \
-                                                :                              \
-                                                : "r" (LockState)              \
-                                                : "r0", "r1"                   \
-                                                );                             \
-                            }
-#else
-    #define SEGGER_RTT_LOCK()
-    #define SEGGER_RTT_UNLOCK()
-  #endif
-#endif
-
-/*********************************************************************
-*
-*       RTT lock configuration for IAR EWARM
-*/
-#ifdef __ICCARM__
-  #if (defined (__ARM6M__) && (__CORE__ == __ARM6M__))
-    #define SEGGER_RTT_LOCK()   {                                                                   \
-                                  unsigned int LockState;                                           \
-                                  LockState = __get_PRIMASK();                                      \
-                                  __set_PRIMASK(1);
-
-    #define SEGGER_RTT_UNLOCK()   __set_PRIMASK(LockState);                                         \
-                                }
-  #elif ((defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) || (defined (__ARM7M__) && (__CORE__ == __ARM7M__)))
-    #ifndef   SEGGER_RTT_MAX_INTERRUPT_PRIORITY
-      #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY   (0x20)
-    #endif
-    #define SEGGER_RTT_LOCK()   {                                                                   \
-                                  unsigned int LockState;                                           \
-                                  LockState = __get_BASEPRI();                                      \
-                                  __set_BASEPRI(SEGGER_RTT_MAX_INTERRUPT_PRIORITY);
-
-    #define SEGGER_RTT_UNLOCK()   __set_BASEPRI(LockState);                                         \
-                                }
-  #endif
-#endif
-
-/*********************************************************************
-*
-*       RTT lock configuration for IAR RX
-*/
-#ifdef __ICCRX__
-  #define SEGGER_RTT_LOCK()   {                                                                     \
-                                unsigned long LockState;                                            \
-                                LockState = __get_interrupt_state();                                \
-                                __disable_interrupt();
-
-  #define SEGGER_RTT_UNLOCK()   __set_interrupt_state(LockState);                                   \
-                              }
-#endif
-
-/*********************************************************************
-*
-*       RTT lock configuration for IAR RL78
-*/
-#ifdef __ICCRL78__
-  #define SEGGER_RTT_LOCK()   {                                                                     \
-                                __istate_t LockState;                                               \
-                                LockState = __get_interrupt_state();                                \
-                                __disable_interrupt();
-
-  #define SEGGER_RTT_UNLOCK()   __set_interrupt_state(LockState);                                   \
-                              }
-#endif
-
-/*********************************************************************
-*
-*       RTT lock configuration for KEIL ARM
-*/
-#ifdef __CC_ARM
-  #if (defined __TARGET_ARCH_6S_M)
-    #define SEGGER_RTT_LOCK()   {                                                                   \
-                                  unsigned int LockState;                                           \
-                                  register unsigned char PRIMASK __asm( "primask");                 \
-                                  LockState = PRIMASK;                                              \
-                                  PRIMASK = 1u;                                                     \
-                                  __schedule_barrier();
-
-    #define SEGGER_RTT_UNLOCK()   PRIMASK = LockState;                                              \
-                                  __schedule_barrier();                                             \
-                                }
-  #elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
-    #ifndef   SEGGER_RTT_MAX_INTERRUPT_PRIORITY
-      #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY   (0x20)
-    #endif
-    #define SEGGER_RTT_LOCK()   {                                                                   \
-                                  unsigned int LockState;                                           \
-                                  register unsigned char BASEPRI __asm( "basepri");                 \
-                                  LockState = BASEPRI;                                              \
-                                  BASEPRI = SEGGER_RTT_MAX_INTERRUPT_PRIORITY;                      \
-                                  __schedule_barrier();
-
-    #define SEGGER_RTT_UNLOCK()   BASEPRI = LockState;                                              \
-                                  __schedule_barrier();                                             \
-                                }
-  #endif
-#endif
-
-/*********************************************************************
-*
-*       RTT lock configuration for TI ARM
-*/
-#ifdef __TI_ARM__
-  #if defined (__TI_ARM_V6M0__)
-    #define SEGGER_RTT_LOCK()   {                                                                   \
-                                  unsigned int LockState;                                           \
-                                  LockState = __get_PRIMASK();                                      \
-                                  __set_PRIMASK(1);
-
-    #define SEGGER_RTT_UNLOCK()   __set_PRIMASK(LockState);                                         \
-                                }
-  #elif (defined (__TI_ARM_V7M3__) || defined (__TI_ARM_V7M4__))
-    #ifndef   SEGGER_RTT_MAX_INTERRUPT_PRIORITY
-      #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY   (0x20)
-    #endif
-    #define SEGGER_RTT_LOCK()   {                                                                   \
-                                  unsigned int LockState;                                           \
-                                  LockState = _set_interrupt_priority(SEGGER_RTT_MAX_INTERRUPT_PRIORITY);
-
-    #define SEGGER_RTT_UNLOCK()   _set_interrupt_priority(LockState);                               \
-                                }
-  #endif
-#endif
-
-/*********************************************************************
-*
-*       RTT lock configuration for CCRX
-*/
-#ifdef __RX
-  #define SEGGER_RTT_LOCK()   {                                                                     \
-                                unsigned long LockState;                                            \
-                                LockState = get_psw() & 0x010000;                                   \
-                                clrpsw_i();                           
-                                    
-  #define SEGGER_RTT_UNLOCK()   set_psw(get_psw() | LockState);                                     \
-                              }
-#endif
-
-/*********************************************************************
-*
-*       RTT lock configuration fallback
-*/
-#ifndef   SEGGER_RTT_LOCK
-  #define SEGGER_RTT_LOCK()                // Lock RTT (nestable)   (i.e. disable interrupts)
-#endif
-
-#ifndef   SEGGER_RTT_UNLOCK
-  #define SEGGER_RTT_UNLOCK()              // Unlock RTT (nestable) (i.e. enable previous interrupt lock state)
-#endif
-
-#endif
-/*************************** End of file ****************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT_printf.c b/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT_printf.c
deleted file mode 100644
index 75082f0..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/RTT/SEGGER_RTT_printf.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*       Solutions for real time microcontroller applications         *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-*       SEGGER RTT * Real Time Transfer for embedded targets         *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-* All rights reserved.                                               *
-*                                                                    *
-* SEGGER strongly recommends to not make any changes                 *
-* to or modify the source code of this software in order to stay     *
-* compatible with the RTT protocol and J-Link.                       *
-*                                                                    *
-* Redistribution and use in source and binary forms, with or         *
-* without modification, are permitted provided that the following    *
-* conditions are met:                                                *
-*                                                                    *
-* o Redistributions of source code must retain the above copyright   *
-*   notice, this list of conditions and the following disclaimer.    *
-*                                                                    *
-* o 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.                                           *
-*                                                                    *
-* o Neither the name of SEGGER Microcontroller GmbH         *
-*   nor the names of its contributors may be used to endorse or      *
-*   promote products derived from this software without specific     *
-*   prior written permission.                                        *
-*                                                                    *
-* 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           *
-* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller 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.                                                            *
-*                                                                    *
-**********************************************************************
----------------------------END-OF-HEADER------------------------------
-File    : SEGGER_RTT_printf.c
-Purpose : Replacement for printf to write formatted data via RTT
-Revision: $Rev: 12360 $
-----------------------------------------------------------------------
-*/
-#include "SEGGER_RTT.h"
-#include "SEGGER_RTT_Conf.h"
-
-/*********************************************************************
-*
-*       Defines, configurable
-*
-**********************************************************************
-*/
-
-#ifndef SEGGER_RTT_PRINTF_BUFFER_SIZE
-  #define SEGGER_RTT_PRINTF_BUFFER_SIZE (64)
-#endif
-
-#include <stdlib.h>
-#include <stdarg.h>
-
-
-#define FORMAT_FLAG_LEFT_JUSTIFY   (1u << 0)
-#define FORMAT_FLAG_PAD_ZERO       (1u << 1)
-#define FORMAT_FLAG_PRINT_SIGN     (1u << 2)
-#define FORMAT_FLAG_ALTERNATE      (1u << 3)
-
-/*********************************************************************
-*
-*       Types
-*
-**********************************************************************
-*/
-
-typedef struct {
-  char*     pBuffer;
-  unsigned  BufferSize;
-  unsigned  Cnt;
-
-  int   ReturnValue;
-
-  unsigned RTTBufferIndex;
-} SEGGER_RTT_PRINTF_DESC;
-
-/*********************************************************************
-*
-*       Function prototypes
-*
-**********************************************************************
-*/
-
-/*********************************************************************
-*
-*       Static code
-*
-**********************************************************************
-*/
-/*********************************************************************
-*
-*       _StoreChar
-*/
-static void _StoreChar(SEGGER_RTT_PRINTF_DESC * p, char c) {
-  unsigned Cnt;
-
-  Cnt = p->Cnt;
-  if ((Cnt + 1u) <= p->BufferSize) {
-    *(p->pBuffer + Cnt) = c;
-    p->Cnt = Cnt + 1u;
-    p->ReturnValue++;
-  }
-  //
-  // Write part of string, when the buffer is full
-  //
-  if (p->Cnt == p->BufferSize) {
-    if (SEGGER_RTT_Write(p->RTTBufferIndex, p->pBuffer, p->Cnt) != p->Cnt) {
-      p->ReturnValue = -1;
-    } else {
-      p->Cnt = 0u;
-    }
-  }
-}
-
-/*********************************************************************
-*
-*       _PrintUnsigned
-*/
-static void _PrintUnsigned(SEGGER_RTT_PRINTF_DESC * pBufferDesc, unsigned v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {
-  static const char _aV2C[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-  unsigned Div;
-  unsigned Digit;
-  unsigned Number;
-  unsigned Width;
-  char c;
-
-  Number = v;
-  Digit = 1u;
-  //
-  // Get actual field width
-  //
-  Width = 1u;
-  while (Number >= Base) {
-    Number = (Number / Base);
-    Width++;
-  }
-  if (NumDigits > Width) {
-    Width = NumDigits;
-  }
-  //
-  // Print leading chars if necessary
-  //
-  if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) {
-    if (FieldWidth != 0u) {
-      if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && (NumDigits == 0u)) {
-        c = '0';
-      } else {
-        c = ' ';
-      }
-      while ((FieldWidth != 0u) && (Width < FieldWidth)) {
-        FieldWidth--;
-        _StoreChar(pBufferDesc, c);
-        if (pBufferDesc->ReturnValue < 0) {
-          break;
-        }
-      }
-    }
-  }
-  if (pBufferDesc->ReturnValue >= 0) {
-    //
-    // Compute Digit.
-    // Loop until Digit has the value of the highest digit required.
-    // Example: If the output is 345 (Base 10), loop 2 times until Digit is 100.
-    //
-    while (1) {
-      if (NumDigits > 1u) {       // User specified a min number of digits to print? => Make sure we loop at least that often, before checking anything else (> 1 check avoids problems with NumDigits being signed / unsigned)
-        NumDigits--;
-      } else {
-        Div = v / Digit;
-        if (Div < Base) {        // Is our divider big enough to extract the highest digit from value? => Done
-          break;
-        }
-      }
-      Digit *= Base;
-    }
-    //
-    // Output digits
-    //
-    do {
-      Div = v / Digit;
-      v -= Div * Digit;
-      _StoreChar(pBufferDesc, _aV2C[Div]);
-      if (pBufferDesc->ReturnValue < 0) {
-        break;
-      }
-      Digit /= Base;
-    } while (Digit);
-    //
-    // Print trailing spaces if necessary
-    //
-    if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == FORMAT_FLAG_LEFT_JUSTIFY) {
-      if (FieldWidth != 0u) {
-        while ((FieldWidth != 0u) && (Width < FieldWidth)) {
-          FieldWidth--;
-          _StoreChar(pBufferDesc, ' ');
-          if (pBufferDesc->ReturnValue < 0) {
-            break;
-          }
-        }
-      }
-    }
-  }
-}
-
-/*********************************************************************
-*
-*       _PrintInt
-*/
-static void _PrintInt(SEGGER_RTT_PRINTF_DESC * pBufferDesc, int v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {
-  unsigned Width;
-  int Number;
-
-  Number = (v < 0) ? -v : v;
-
-  //
-  // Get actual field width
-  //
-  Width = 1u;
-  while (Number >= (int)Base) {
-    Number = (Number / (int)Base);
-    Width++;
-  }
-  if (NumDigits > Width) {
-    Width = NumDigits;
-  }
-  if ((FieldWidth > 0u) && ((v < 0) || ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN))) {
-    FieldWidth--;
-  }
-
-  //
-  // Print leading spaces if necessary
-  //
-  if ((((FormatFlags & FORMAT_FLAG_PAD_ZERO) == 0u) || (NumDigits != 0u)) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u)) {
-    if (FieldWidth != 0u) {
-      while ((FieldWidth != 0u) && (Width < FieldWidth)) {
-        FieldWidth--;
-        _StoreChar(pBufferDesc, ' ');
-        if (pBufferDesc->ReturnValue < 0) {
-          break;
-        }
-      }
-    }
-  }
-  //
-  // Print sign if necessary
-  //
-  if (pBufferDesc->ReturnValue >= 0) {
-    if (v < 0) {
-      v = -v;
-      _StoreChar(pBufferDesc, '-');
-    } else if ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN) {
-      _StoreChar(pBufferDesc, '+');
-    } else {
-
-    }
-    if (pBufferDesc->ReturnValue >= 0) {
-      //
-      // Print leading zeros if necessary
-      //
-      if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) && (NumDigits == 0u)) {
-        if (FieldWidth != 0u) {
-          while ((FieldWidth != 0u) && (Width < FieldWidth)) {
-            FieldWidth--;
-            _StoreChar(pBufferDesc, '0');
-            if (pBufferDesc->ReturnValue < 0) {
-              break;
-            }
-          }
-        }
-      }
-      if (pBufferDesc->ReturnValue >= 0) {
-        //
-        // Print number without sign
-        //
-        _PrintUnsigned(pBufferDesc, (unsigned)v, Base, NumDigits, FieldWidth, FormatFlags);
-      }
-    }
-  }
-}
-
-/*********************************************************************
-*
-*       Public code
-*
-**********************************************************************
-*/
-/*********************************************************************
-*
-*       SEGGER_RTT_vprintf
-*
-*  Function description
-*    Stores a formatted string in SEGGER RTT control block.
-*    This data is read by the host.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used. (e.g. 0 for "Terminal")
-*    sFormat      Pointer to format string
-*    pParamList   Pointer to the list of arguments for the format string
-*
-*  Return values
-*    >= 0:  Number of bytes which have been stored in the "Up"-buffer.
-*     < 0:  Error
-*/
-int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList) {
-  char c;
-  SEGGER_RTT_PRINTF_DESC BufferDesc;
-  int v;
-  unsigned NumDigits;
-  unsigned FormatFlags;
-  unsigned FieldWidth;
-  char acBuffer[SEGGER_RTT_PRINTF_BUFFER_SIZE];
-
-  BufferDesc.pBuffer        = acBuffer;
-  BufferDesc.BufferSize     = SEGGER_RTT_PRINTF_BUFFER_SIZE;
-  BufferDesc.Cnt            = 0u;
-  BufferDesc.RTTBufferIndex = BufferIndex;
-  BufferDesc.ReturnValue    = 0;
-
-  do {
-    c = *sFormat;
-    sFormat++;
-    if (c == 0u) {
-      break;
-    }
-    if (c == '%') {
-      //
-      // Filter out flags
-      //
-      FormatFlags = 0u;
-      v = 1;
-      do {
-        c = *sFormat;
-        switch (c) {
-        case '-': FormatFlags |= FORMAT_FLAG_LEFT_JUSTIFY; sFormat++; break;
-        case '0': FormatFlags |= FORMAT_FLAG_PAD_ZERO;     sFormat++; break;
-        case '+': FormatFlags |= FORMAT_FLAG_PRINT_SIGN;   sFormat++; break;
-        case '#': FormatFlags |= FORMAT_FLAG_ALTERNATE;    sFormat++; break;
-        default:  v = 0; break;
-        }
-      } while (v);
-      //
-      // filter out field with
-      //
-      FieldWidth = 0u;
-      do {
-        c = *sFormat;
-        if ((c < '0') || (c > '9')) {
-          break;
-        }
-        sFormat++;
-        FieldWidth = (FieldWidth * 10u) + ((unsigned)c - '0');
-      } while (1);
-
-      //
-      // Filter out precision (number of digits to display)
-      //
-      NumDigits = 0u;
-      c = *sFormat;
-      if (c == '.') {
-        sFormat++;
-        do {
-          c = *sFormat;
-          if ((c < '0') || (c > '9')) {
-            break;
-          }
-          sFormat++;
-          NumDigits = NumDigits * 10u + ((unsigned)c - '0');
-        } while (1);
-      }
-      //
-      // Filter out length modifier
-      //
-      c = *sFormat;
-      do {
-        if ((c == 'l') || (c == 'h')) {
-          sFormat++;
-          c = *sFormat;
-        } else {
-          break;
-        }
-      } while (1);
-      //
-      // Handle specifiers
-      //
-      switch (c) {
-      case 'c': {
-        char c0;
-        v = va_arg(*pParamList, int);
-        c0 = (char)v;
-        _StoreChar(&BufferDesc, c0);
-        break;
-      }
-      case 'd':
-        v = va_arg(*pParamList, int);
-        _PrintInt(&BufferDesc, v, 10u, NumDigits, FieldWidth, FormatFlags);
-        break;
-      case 'u':
-        v = va_arg(*pParamList, int);
-        _PrintUnsigned(&BufferDesc, (unsigned)v, 10u, NumDigits, FieldWidth, FormatFlags);
-        break;
-      case 'x':
-      case 'X':
-        v = va_arg(*pParamList, int);
-        _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, NumDigits, FieldWidth, FormatFlags);
-        break;
-      case 's':
-        {
-          const char * s = va_arg(*pParamList, const char *);
-          do {
-            c = *s;
-            s++;
-            if (c == '\0') {
-              break;
-            }
-           _StoreChar(&BufferDesc, c);
-          } while (BufferDesc.ReturnValue >= 0);
-        }
-        break;
-      case 'p':
-        v = va_arg(*pParamList, int);
-        _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, 8u, 8u, 0u);
-        break;
-      case '%':
-        _StoreChar(&BufferDesc, '%');
-        break;
-      default:
-        break;
-      }
-      sFormat++;
-    } else {
-      _StoreChar(&BufferDesc, c);
-    }
-  } while (BufferDesc.ReturnValue >= 0);
-
-  if (BufferDesc.ReturnValue > 0) {
-    //
-    // Write remaining data, if any
-    //
-    if (BufferDesc.Cnt != 0u) {
-      SEGGER_RTT_Write(BufferIndex, acBuffer, BufferDesc.Cnt);
-    }
-    BufferDesc.ReturnValue += (int)BufferDesc.Cnt;
-  }
-  return BufferDesc.ReturnValue;
-}
-
-/*********************************************************************
-*
-*       SEGGER_RTT_printf
-*
-*  Function description
-*    Stores a formatted string in SEGGER RTT control block.
-*    This data is read by the host.
-*
-*  Parameters
-*    BufferIndex  Index of "Up"-buffer to be used. (e.g. 0 for "Terminal")
-*    sFormat      Pointer to format string, followed by the arguments for conversion
-*
-*  Return values
-*    >= 0:  Number of bytes which have been stored in the "Up"-buffer.
-*     < 0:  Error
-*
-*  Notes
-*    (1) Conversion specifications have following syntax:
-*          %[flags][FieldWidth][.Precision]ConversionSpecifier
-*    (2) Supported flags:
-*          -: Left justify within the field width
-*          +: Always print sign extension for signed conversions
-*          0: Pad with 0 instead of spaces. Ignored when using '-'-flag or precision
-*        Supported conversion specifiers:
-*          c: Print the argument as one char
-*          d: Print the argument as a signed integer
-*          u: Print the argument as an unsigned integer
-*          x: Print the argument as an hexadecimal integer
-*          s: Print the string pointed to by the argument
-*          p: Print the argument as an 8-digit hexadecimal integer. (Argument shall be a pointer to void.)
-*/
-int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...) {
-  int r;
-  va_list ParamList;
-
-  va_start(ParamList, sFormat);
-  r = SEGGER_RTT_vprintf(BufferIndex, sFormat, &ParamList);
-  va_end(ParamList);
-  return r;
-}
-/*************************** End of file ****************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_GCC.c b/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_GCC.c
deleted file mode 100644
index b0b6ca3..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_GCC.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*       Solutions for real time microcontroller applications         *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-*       SEGGER RTT * Real Time Transfer for embedded targets         *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-* All rights reserved.                                               *
-*                                                                    *
-* SEGGER strongly recommends to not make any changes                 *
-* to or modify the source code of this software in order to stay     *
-* compatible with the RTT protocol and J-Link.                       *
-*                                                                    *
-* Redistribution and use in source and binary forms, with or         *
-* without modification, are permitted provided that the following    *
-* conditions are met:                                                *
-*                                                                    *
-* o Redistributions of source code must retain the above copyright   *
-*   notice, this list of conditions and the following disclaimer.    *
-*                                                                    *
-* o 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.                                           *
-*                                                                    *
-* o Neither the name of SEGGER Microcontroller GmbH         *
-*   nor the names of its contributors may be used to endorse or      *
-*   promote products derived from this software without specific     *
-*   prior written permission.                                        *
-*                                                                    *
-* 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           *
-* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller 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.                                                            *
-*                                                                    *
-**********************************************************************
----------------------------END-OF-HEADER------------------------------
-File    : SEGGER_RTT_Syscalls_GCC.c
-Purpose : Low-level functions for using printf() via RTT in GCC.
-          To use RTT for printf output, include this file in your 
-          application.
-Revision: $Rev: 9599 $
-----------------------------------------------------------------------
-*/
-#if (defined __GNUC__) && !(defined __SES_ARM) && !(defined __CROSSWORKS_ARM)
-
-#include <reent.h>  // required for _write_r
-#include "SEGGER_RTT.h"
-
-
-/*********************************************************************
-*
-*       Types
-*
-**********************************************************************
-*/
-//
-// If necessary define the _reent struct 
-// to match the one passed by the used standard library.
-//
-struct _reent;
-
-/*********************************************************************
-*
-*       Function prototypes
-*
-**********************************************************************
-*/
-int _write(int file, char *ptr, int len);
-int _write_r(struct _reent *r, int file, const void *ptr, int len);
-
-/*********************************************************************
-*
-*       Global functions
-*
-**********************************************************************
-*/
-
-/*********************************************************************
-*
-*       _write()
-*
-* Function description
-*   Low-level write function.
-*   libc subroutines will use this system routine for output to all files,
-*   including stdout.
-*   Write data via RTT.
-*/
-int _write(int file, char *ptr, int len) {
-  (void) file;  /* Not used, avoid warning */
-  SEGGER_RTT_Write(0, ptr, len);
-  return len;
-}
-
-/*********************************************************************
-*
-*       _write_r()
-*
-* Function description
-*   Low-level reentrant write function.
-*   libc subroutines will use this system routine for output to all files,
-*   including stdout.
-*   Write data via RTT.
-*/
-int _write_r(struct _reent *r, int file, const void *ptr, int len) {
-  (void) file;  /* Not used, avoid warning */
-  (void) r;     /* Not used, avoid warning */
-  SEGGER_RTT_Write(0, ptr, len);
-  return len;
-}
-
-#endif
-/****** End Of File *************************************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_IAR.c b/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_IAR.c
deleted file mode 100644
index f8baf69..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_IAR.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*       Solutions for real time microcontroller applications         *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-*       SEGGER RTT * Real Time Transfer for embedded targets         *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-* All rights reserved.                                               *
-*                                                                    *
-* SEGGER strongly recommends to not make any changes                 *
-* to or modify the source code of this software in order to stay     *
-* compatible with the RTT protocol and J-Link.                       *
-*                                                                    *
-* Redistribution and use in source and binary forms, with or         *
-* without modification, are permitted provided that the following    *
-* conditions are met:                                                *
-*                                                                    *
-* o Redistributions of source code must retain the above copyright   *
-*   notice, this list of conditions and the following disclaimer.    *
-*                                                                    *
-* o 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.                                           *
-*                                                                    *
-* o Neither the name of SEGGER Microcontroller GmbH         *
-*   nor the names of its contributors may be used to endorse or      *
-*   promote products derived from this software without specific     *
-*   prior written permission.                                        *
-*                                                                    *
-* 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           *
-* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller 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.                                                            *
-*                                                                    *
-**********************************************************************
----------------------------END-OF-HEADER------------------------------
-File    : SEGGER_RTT_Syscalls_IAR.c
-Purpose : Low-level functions for using printf() via RTT in IAR.
-          To use RTT for printf output, include this file in your 
-          application and set the Library Configuration to Normal.
-Revision: $Rev: 12303 $
-----------------------------------------------------------------------
-*/
-#ifdef __IAR_SYSTEMS_ICC__
-
-//
-// Since IAR EWARM V8 yfuns.h is considered as deprecated and LowLevelIOInterface.h shall be used instead
-// To not break any compatibility with older compiler versions, we have a version check in here
-//
-#if __VER__ >= 8000000
-  #include <LowLevelIOInterface.h>
-#else
-  #include <yfuns.h>
-#endif
-
-#include "SEGGER_RTT.h"
-#pragma module_name = "?__write"
-
-/*********************************************************************
-*
-*       Function prototypes
-*
-**********************************************************************
-*/
-size_t __write(int handle, const unsigned char * buffer, size_t size);
-
-/*********************************************************************
-*
-*       Global functions
-*
-**********************************************************************
-*/
-/*********************************************************************
-*
-*       __write()
-*
-* Function description
-*   Low-level write function.
-*   Standard library subroutines will use this system routine
-*   for output to all files, including stdout.
-*   Write data via RTT.
-*/
-size_t __write(int handle, const unsigned char * buffer, size_t size) {
-  (void) handle;  /* Not used, avoid warning */
-  SEGGER_RTT_Write(0, (const char*)buffer, size);
-  return size;
-}
-
-/*********************************************************************
-*
-*       __write_buffered()
-*
-* Function description
-*   Low-level write function.
-*   Standard library subroutines will use this system routine
-*   for output to all files, including stdout.
-*   Write data via RTT.
-*/
-size_t __write_buffered(int handle, const unsigned char * buffer, size_t size) {
-  (void) handle;  /* Not used, avoid warning */
-  SEGGER_RTT_Write(0, (const char*)buffer, size);
-  return size;
-}
-
-#endif
-/****** End Of File *************************************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_KEIL.c b/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_KEIL.c
deleted file mode 100644
index 50d38c1..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_KEIL.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*       Solutions for real time microcontroller applications         *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-*       SEGGER RTT * Real Time Transfer for embedded targets         *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-* All rights reserved.                                               *
-*                                                                    *
-* SEGGER strongly recommends to not make any changes                 *
-* to or modify the source code of this software in order to stay     *
-* compatible with the RTT protocol and J-Link.                       *
-*                                                                    *
-* Redistribution and use in source and binary forms, with or         *
-* without modification, are permitted provided that the following    *
-* conditions are met:                                                *
-*                                                                    *
-* o Redistributions of source code must retain the above copyright   *
-*   notice, this list of conditions and the following disclaimer.    *
-*                                                                    *
-* o 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.                                           *
-*                                                                    *
-* o Neither the name of SEGGER Microcontroller GmbH         *
-*   nor the names of its contributors may be used to endorse or      *
-*   promote products derived from this software without specific     *
-*   prior written permission.                                        *
-*                                                                    *
-* 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           *
-* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller 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.                                                            *
-*                                                                    *
-**********************************************************************
----------------------------END-OF-HEADER------------------------------
-File    : RTT_Syscalls_KEIL.c
-Purpose : Retargeting module for KEIL MDK-CM3.
-          Low-level functions for using printf() via RTT
-Revision: $Rev: 9599 $
-----------------------------------------------------------------------
-*/
-#ifdef __CC_ARM
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rt_sys.h>
-#include <rt_misc.h>
-
-#include "SEGGER_RTT.h"
-/*********************************************************************
-*
-*       #pragmas
-*
-**********************************************************************
-*/
-#pragma import(__use_no_semihosting)
-
-#ifdef _MICROLIB
-  #pragma import(__use_full_stdio)
-#endif
-
-/*********************************************************************
-*
-*       Defines non-configurable
-*
-**********************************************************************
-*/
-
-/* Standard IO device handles - arbitrary, but any real file system handles must be
-   less than 0x8000. */
-#define STDIN             0x8001    // Standard Input Stream
-#define STDOUT            0x8002    // Standard Output Stream
-#define STDERR            0x8003    // Standard Error Stream
-
-/*********************************************************************
-*
-*       Public const
-*
-**********************************************************************
-*/
-//const char __stdin_name[]  = "STDIN";
-const char __stdout_name[] = "STDOUT";
-const char __stderr_name[] = "STDERR";
-
-/*********************************************************************
-*
-*       Public code
-*
-**********************************************************************
-*/
-
-/*********************************************************************
-*
-*       _ttywrch
-*
-*  Function description:
-*    Outputs a character to the console
-*
-*  Parameters:
-*    c    - character to output
-*  
-*/
-void _ttywrch(int c) {
-  fputc(c, stdout); // stdout
-  fflush(stdout);
-}
-
-/*********************************************************************
-*
-*       _sys_open
-*
-*  Function description:
-*    Opens the device/file in order to do read/write operations
-*
-*  Parameters:
-*    sName        - sName of the device/file to open
-*    OpenMode    - This parameter is currently ignored
-*  
-*  Return value:
-*    != 0     - Handle to the object to open, otherwise 
-*    == 0     -"device" is not handled by this module
-*
-*/
-FILEHANDLE _sys_open(const char * sName, int OpenMode) {
-  (void)OpenMode;
-  // Register standard Input Output devices.
-  if (strcmp(sName, __stdout_name) == 0) {
-    return (STDOUT);
-  } else if (strcmp(sName, __stderr_name) == 0) {
-    return (STDERR);
-  } else
-  return (0);  // Not implemented
-}
-
-/*********************************************************************
-*
-*       _sys_close
-*
-*  Function description:
-*    Closes the handle to the open device/file
-*
-*  Parameters:
-*    hFile    - Handle to a file opened via _sys_open
-*  
-*  Return value:
-*    0     - device/file closed
-*
-*/
-int _sys_close(FILEHANDLE hFile) {
-  (void)hFile;
-  return 0;  // Not implemented
-}
-
-/*********************************************************************
-*
-*       _sys_write
-*
-*  Function description:
-*    Writes the data to an open handle.
-*    Currently this function only outputs data to the console
-*
-*  Parameters:
-*    hFile    - Handle to a file opened via _sys_open
-*    pBuffer  - Pointer to the data that shall be written
-*    NumBytes      - Number of bytes to write
-*    Mode     - The Mode that shall be used
-*  
-*  Return value:
-*    Number of bytes *not* written to the file/device
-*
-*/
-int _sys_write(FILEHANDLE hFile, const unsigned char * pBuffer, unsigned NumBytes, int Mode) {
-  int r = 0;
-
-  (void)Mode;
-  if (hFile == STDOUT) {
-    return NumBytes - SEGGER_RTT_Write(0, (const char*)pBuffer, NumBytes);
-  }
-  return r;
-}
-
-/*********************************************************************
-*
-*       _sys_read
-*
-*  Function description:
-*    Reads data from an open handle.
-*    Currently this modules does nothing.
-*
-*  Parameters:
-*    hFile    - Handle to a file opened via _sys_open
-*    pBuffer  - Pointer to buffer to store the read data
-*    NumBytes      - Number of bytes to read
-*    Mode     - The Mode that shall be used
-*  
-*  Return value:
-*    Number of bytes read from the file/device
-*
-*/
-int _sys_read(FILEHANDLE hFile, unsigned char * pBuffer, unsigned NumBytes, int Mode) {
-  (void)hFile;
-  (void)pBuffer;
-  (void)NumBytes;
-  (void)Mode;
-  return (0);  // Not implemented
-}
-
-/*********************************************************************
-*
-*       _sys_istty
-*
-*  Function description:
-*    This function shall return whether the opened file 
-*    is a console device or not.
-*
-*  Parameters:
-*    hFile    - Handle to a file opened via _sys_open
-*  
-*  Return value:
-*    1       - Device is     a console
-*    0       - Device is not a console
-*
-*/
-int _sys_istty(FILEHANDLE hFile) {
-  if (hFile > 0x8000) {
-    return (1);
-  }
-  return (0);  // Not implemented
-}
-
-/*********************************************************************
-*
-*       _sys_seek
-*
-*  Function description:
-*    Seeks via the file to a specific position
-*
-*  Parameters:
-*    hFile  - Handle to a file opened via _sys_open
-*    Pos    - 
-*  
-*  Return value:
-*    int       - 
-*
-*/
-int _sys_seek(FILEHANDLE hFile, long Pos) {
-  (void)hFile;
-  (void)Pos;
-  return (0);  // Not implemented
-}
-
-/*********************************************************************
-*
-*       _sys_ensure
-*
-*  Function description:
-*    
-*
-*  Parameters:
-*    hFile    - Handle to a file opened via _sys_open
-*  
-*  Return value:
-*    int       - 
-*
-*/
-int _sys_ensure(FILEHANDLE hFile) {
-  (void)hFile;
-  return (-1);  // Not implemented
-}
-
-/*********************************************************************
-*
-*       _sys_flen
-*
-*  Function description:
-*    Returns the length of the opened file handle
-*
-*  Parameters:
-*    hFile    - Handle to a file opened via _sys_open
-*  
-*  Return value:
-*    Length of the file
-*
-*/
-long _sys_flen(FILEHANDLE hFile) {
-  (void)hFile;
-  return (0);  // Not implemented
-}
-
-/*********************************************************************
-*
-*       _sys_tmpnam
-*
-*  Function description:
-*    This function converts the file number fileno for a temporary 
-*    file to a unique filename, for example, tmp0001.
-*
-*  Parameters:
-*    pBuffer    - Pointer to a buffer to store the name
-*    FileNum    - file number to convert
-*    MaxLen     - Size of the buffer
-*  
-*  Return value:
-*     1 - Error
-*     0 - Success  
-*
-*/
-int _sys_tmpnam(char * pBuffer, int FileNum, unsigned MaxLen) {
-  (void)pBuffer;
-  (void)FileNum;
-  (void)MaxLen;
-  return (1);  // Not implemented
-}
-
-/*********************************************************************
-*
-*       _sys_command_string
-*
-*  Function description:
-*    This function shall execute a system command.
-*
-*  Parameters:
-*    cmd    - Pointer to the command string
-*    len    - Length of the string
-*  
-*  Return value:
-*    == NULL - Command was not successfully executed
-*    == sCmd - Command was passed successfully
-*
-*/
-char * _sys_command_string(char * cmd, int len) {
-  (void)len;
-  return cmd;  // Not implemented
-}
-
-/*********************************************************************
-*
-*       _sys_exit
-*
-*  Function description:
-*    This function is called when the application returns from main
-*
-*  Parameters:
-*    ReturnCode    - Return code from the main function
-*  
-*
-*/
-void _sys_exit(int ReturnCode) {
-  (void)ReturnCode;
-  while (1);  // Not implemented
-}
-
-#endif
-/*************************** End of file ****************************/
diff --git a/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_SES.c b/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_SES.c
deleted file mode 100644
index 48609e4..0000000
--- a/third_party/jlink/SEGGER_RTT_V640/Syscalls/SEGGER_RTT_Syscalls_SES.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*********************************************************************
-*                    SEGGER Microcontroller GmbH                     *
-*                        The Embedded Experts                        *
-**********************************************************************
-*                                                                    *
-*            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
-*                                                                    *
-*       www.segger.com     Support: support@segger.com               *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-*       SEGGER RTT * Real Time Transfer for embedded targets         *
-*                                                                    *
-**********************************************************************
-*                                                                    *
-* All rights reserved.                                               *
-*                                                                    *
-* SEGGER strongly recommends to not make any changes                 *
-* to or modify the source code of this software in order to stay     *
-* compatible with the RTT protocol and J-Link.                       *
-*                                                                    *
-* Redistribution and use in source and binary forms, with or         *
-* without modification, are permitted provided that the following    *
-* conditions are met:                                                *
-*                                                                    *
-* o Redistributions of source code must retain the above copyright   *
-*   notice, this list of conditions and the following disclaimer.    *
-*                                                                    *
-* o 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.                                           *
-*                                                                    *
-* o Neither the name of SEGGER Microcontroller GmbH                  *
-*   nor the names of its contributors may be used to endorse or      *
-*   promote products derived from this software without specific     *
-*   prior written permission.                                        *
-*                                                                    *
-* 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           *
-* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller 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.                                                            *
-*                                                                    *
-**********************************************************************
----------------------------END-OF-HEADER------------------------------
-File    : SEGGER_RTT_Syscalls_SES.c
-Purpose : Reimplementation of printf, puts and __getchar using RTT
-          in SEGGER Embedded Studio.
-          To use RTT for printf output, include this file in your
-          application.
-Revision: $Rev: 12804 $
-----------------------------------------------------------------------
-*/
-#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM)
-
-#include "SEGGER_RTT.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include "limits.h"
-#include "__libc.h"
-#include "__vfprintf.h"
-
-/*********************************************************************
-*
-*       Defines, configurable
-*
-**********************************************************************
-*/
-//
-// Select string formatting implementation.
-//
-// RTT printf formatting
-//  - Configurable stack usage. (SEGGER_RTT_PRINTF_BUFFER_SIZE in SEGGER_RTT_Conf.h)
-//  - No maximum string length.
-//  - Limited conversion specifiers and flags. (See SEGGER_RTT_printf.c)
-// Standard library printf formatting
-//  - Configurable formatting capabilities.
-//  - Full conversion specifier and flag support.
-//  - Maximum string length has to be known or (slightly) slower character-wise output.
-//
-// #define PRINTF_USE_SEGGER_RTT_FORMATTING    0 // Use standard library formatting
-// #define PRINTF_USE_SEGGER_RTT_FORMATTING    1 // Use RTT formatting
-//
-#ifndef   PRINTF_USE_SEGGER_RTT_FORMATTING
-  #define PRINTF_USE_SEGGER_RTT_FORMATTING    0
-#endif
-//
-// If using standard library formatting,
-// select maximum output string buffer size or character-wise output.
-//
-// #define PRINTF_BUFFER_SIZE                  0 // Use character-wise output
-// #define PRINTF_BUFFER_SIZE                128 // Default maximum string length
-//
-#ifndef   PRINTF_BUFFER_SIZE
-  #define PRINTF_BUFFER_SIZE                128
-#endif
-
-#if PRINTF_USE_SEGGER_RTT_FORMATTING  // Use SEGGER RTT formatting implementation
-/*********************************************************************
-*
-*       Function prototypes
-*
-**********************************************************************
-*/
-int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList);
-
-/*********************************************************************
-*
-*       Global functions, printf
-*
-**********************************************************************
-*/
-/*********************************************************************
-*
-*       printf()
-*
-*  Function description
-*    print a formatted string using RTT and SEGGER RTT formatting.
-*/
-int printf(const char *fmt,...) {
-  int     n;
-  va_list args;
-
-  va_start (args, fmt);
-  n = SEGGER_RTT_vprintf(0, fmt, &args);
-  va_end(args);
-  return n;
-}
-
-#elif PRINTF_BUFFER_SIZE == 0 // Use standard library formatting with character-wise output
-
-/*********************************************************************
-*
-*       Static functions
-*
-**********************************************************************
-*/
-static int _putchar(int x, __printf_tag_ptr ctx) {
-  (void)ctx;
-  SEGGER_RTT_Write(0, (char *)&x, 1);
-  return x;
-}
-
-/*********************************************************************
-*
-*       Global functions, printf
-*
-**********************************************************************
-*/
-/*********************************************************************
-*
-*       printf()
-*
-*  Function description
-*    print a formatted string character-wise, using RTT and standard
-*    library formatting.
-*/
-int printf(const char *fmt, ...) {
-  int         n;
-  va_list     args;
-  __printf_t  iod;
-
-  va_start(args, fmt);
-  iod.string    = 0;
-  iod.maxchars  = INT_MAX;
-  iod.output_fn = _putchar;
-  SEGGER_RTT_LOCK();
-  n = __vfprintf(&iod, fmt, args);
-  SEGGER_RTT_UNLOCK();
-  va_end(args);
-  return n;
-}
-
-#else // Use standard library formatting with static buffer
-
-/*********************************************************************
-*
-*       Global functions, printf
-*
-**********************************************************************
-*/
-/*********************************************************************
-*
-*       printf()
-*
-*  Function description
-*    print a formatted string using RTT and standard library formatting.
-*/
-int printf(const char *fmt,...) {
-  int     n;
-  char    aBuffer[PRINTF_BUFFER_SIZE];
-  va_list args;
-
-  va_start (args, fmt);
-  n = vsnprintf(aBuffer, sizeof(aBuffer), fmt, args);
-  if (n > (int)sizeof(aBuffer)) {
-    SEGGER_RTT_Write(0, aBuffer, sizeof(aBuffer));
-  } else if (n > 0) {
-    SEGGER_RTT_Write(0, aBuffer, n);
-  }
-  va_end(args);
-  return n;
-}
-#endif
-
-/*********************************************************************
-*
-*       Global functions
-*
-**********************************************************************
-*/
-/*********************************************************************
-*
-*       puts()
-*
-*  Function description
-*    print a string using RTT.
-*/
-int puts(const char *s) {
-  return SEGGER_RTT_WriteString(0, s);
-}
-
-/*********************************************************************
-*
-*       __putchar()
-*
-*  Function description
-*    Write one character via RTT.
-*/
-int __putchar(int x, __printf_tag_ptr ctx) {
-  (void)ctx;
-  SEGGER_RTT_Write(0, (char *)&x, 1);
-  return x;
-}
-
-/*********************************************************************
-*
-*       __getchar()
-*
-*  Function description
-*    Wait for and get a character via RTT.
-*/
-int __getchar() {
-  return SEGGER_RTT_WaitKey();
-}
-
-#endif
-/****** End Of File *************************************************/
diff --git a/third_party/mbedtls/BUILD.gn b/third_party/mbedtls/BUILD.gn
index 66cac5d..e2a041a 100644
--- a/third_party/mbedtls/BUILD.gn
+++ b/third_party/mbedtls/BUILD.gn
@@ -28,9 +28,6 @@
 declare_args() {
   # Configuration file for MbedTLS.
   mbedtls_config_file = "mbedtls-config.h"
-
-  # Extra dependencies for MbedTLS
-  mbedtls_deps = [ "../../src/core:libopenthread_core_config" ]
 }
 
 config("mbedtls_config") {
@@ -44,176 +41,184 @@
   cflags = [ "-Wno-conversion" ]
 }
 
+mbedtls_sources = [
+  "repo/include/mbedtls/aes.h",
+  "repo/include/mbedtls/aesni.h",
+  "repo/include/mbedtls/arc4.h",
+  "repo/include/mbedtls/aria.h",
+  "repo/include/mbedtls/asn1.h",
+  "repo/include/mbedtls/asn1write.h",
+  "repo/include/mbedtls/base64.h",
+  "repo/include/mbedtls/bignum.h",
+  "repo/include/mbedtls/blowfish.h",
+  "repo/include/mbedtls/bn_mul.h",
+  "repo/include/mbedtls/camellia.h",
+  "repo/include/mbedtls/ccm.h",
+  "repo/include/mbedtls/certs.h",
+  "repo/include/mbedtls/chacha20.h",
+  "repo/include/mbedtls/chachapoly.h",
+  "repo/include/mbedtls/check_config.h",
+  "repo/include/mbedtls/cipher.h",
+  "repo/include/mbedtls/cipher_internal.h",
+  "repo/include/mbedtls/cmac.h",
+  "repo/include/mbedtls/compat-1.3.h",
+  "repo/include/mbedtls/config.h",
+  "repo/include/mbedtls/config_psa.h",
+  "repo/include/mbedtls/ctr_drbg.h",
+  "repo/include/mbedtls/debug.h",
+  "repo/include/mbedtls/des.h",
+  "repo/include/mbedtls/dhm.h",
+  "repo/include/mbedtls/ecdh.h",
+  "repo/include/mbedtls/ecdsa.h",
+  "repo/include/mbedtls/ecjpake.h",
+  "repo/include/mbedtls/ecp.h",
+  "repo/include/mbedtls/ecp_internal.h",
+  "repo/include/mbedtls/entropy.h",
+  "repo/include/mbedtls/entropy_poll.h",
+  "repo/include/mbedtls/error.h",
+  "repo/include/mbedtls/gcm.h",
+  "repo/include/mbedtls/havege.h",
+  "repo/include/mbedtls/hkdf.h",
+  "repo/include/mbedtls/hmac_drbg.h",
+  "repo/include/mbedtls/md.h",
+  "repo/include/mbedtls/md2.h",
+  "repo/include/mbedtls/md4.h",
+  "repo/include/mbedtls/md5.h",
+  "repo/include/mbedtls/md_internal.h",
+  "repo/include/mbedtls/memory_buffer_alloc.h",
+  "repo/include/mbedtls/net.h",
+  "repo/include/mbedtls/net_sockets.h",
+  "repo/include/mbedtls/nist_kw.h",
+  "repo/include/mbedtls/oid.h",
+  "repo/include/mbedtls/padlock.h",
+  "repo/include/mbedtls/pem.h",
+  "repo/include/mbedtls/pk.h",
+  "repo/include/mbedtls/pk_internal.h",
+  "repo/include/mbedtls/pkcs11.h",
+  "repo/include/mbedtls/pkcs12.h",
+  "repo/include/mbedtls/pkcs5.h",
+  "repo/include/mbedtls/platform.h",
+  "repo/include/mbedtls/platform_time.h",
+  "repo/include/mbedtls/platform_util.h",
+  "repo/include/mbedtls/poly1305.h",
+  "repo/include/mbedtls/ripemd160.h",
+  "repo/include/mbedtls/rsa.h",
+  "repo/include/mbedtls/rsa_internal.h",
+  "repo/include/mbedtls/sha1.h",
+  "repo/include/mbedtls/sha256.h",
+  "repo/include/mbedtls/sha512.h",
+  "repo/include/mbedtls/ssl.h",
+  "repo/include/mbedtls/ssl_cache.h",
+  "repo/include/mbedtls/ssl_ciphersuites.h",
+  "repo/include/mbedtls/ssl_cookie.h",
+  "repo/include/mbedtls/ssl_internal.h",
+  "repo/include/mbedtls/ssl_ticket.h",
+  "repo/include/mbedtls/threading.h",
+  "repo/include/mbedtls/timing.h",
+  "repo/include/mbedtls/version.h",
+  "repo/include/mbedtls/x509.h",
+  "repo/include/mbedtls/x509_crl.h",
+  "repo/include/mbedtls/x509_crt.h",
+  "repo/include/mbedtls/x509_csr.h",
+  "repo/include/mbedtls/xtea.h",
+  "repo/library/aes.c",
+  "repo/library/aesni.c",
+  "repo/library/arc4.c",
+  "repo/library/aria.c",
+  "repo/library/asn1parse.c",
+  "repo/library/asn1write.c",
+  "repo/library/base64.c",
+  "repo/library/bignum.c",
+  "repo/library/blowfish.c",
+  "repo/library/camellia.c",
+  "repo/library/ccm.c",
+  "repo/library/certs.c",
+  "repo/library/constant_time.c",
+  "repo/library/chacha20.c",
+  "repo/library/chachapoly.c",
+  "repo/library/cipher.c",
+  "repo/library/cipher_wrap.c",
+  "repo/library/cmac.c",
+  "repo/library/ctr_drbg.c",
+  "repo/library/debug.c",
+  "repo/library/des.c",
+  "repo/library/dhm.c",
+  "repo/library/ecdh.c",
+  "repo/library/ecdsa.c",
+  "repo/library/ecjpake.c",
+  "repo/library/ecp.c",
+  "repo/library/ecp_curves.c",
+  "repo/library/entropy.c",
+  "repo/library/entropy_poll.c",
+  "repo/library/error.c",
+  "repo/library/gcm.c",
+  "repo/library/havege.c",
+  "repo/library/hkdf.c",
+  "repo/library/hmac_drbg.c",
+  "repo/library/md.c",
+  "repo/library/md2.c",
+  "repo/library/md4.c",
+  "repo/library/md5.c",
+  "repo/library/memory_buffer_alloc.c",
+  "repo/library/net_sockets.c",
+  "repo/library/nist_kw.c",
+  "repo/library/oid.c",
+  "repo/library/padlock.c",
+  "repo/library/pem.c",
+  "repo/library/pk.c",
+  "repo/library/pk_wrap.c",
+  "repo/library/pkcs11.c",
+  "repo/library/pkcs12.c",
+  "repo/library/pkcs5.c",
+  "repo/library/pkparse.c",
+  "repo/library/pkwrite.c",
+  "repo/library/platform.c",
+  "repo/library/platform_util.c",
+  "repo/library/poly1305.c",
+  "repo/library/psa_crypto.c",
+  "repo/library/psa_crypto_driver_wrappers.c",
+  "repo/library/psa_crypto_se.c",
+  "repo/library/psa_crypto_slot_management.c",
+  "repo/library/psa_crypto_storage.c",
+  "repo/library/psa_its_file.c",
+  "repo/library/ripemd160.c",
+  "repo/library/rsa.c",
+  "repo/library/rsa_internal.c",
+  "repo/library/sha1.c",
+  "repo/library/sha256.c",
+  "repo/library/sha512.c",
+  "repo/library/ssl_cache.c",
+  "repo/library/ssl_ciphersuites.c",
+  "repo/library/ssl_cli.c",
+  "repo/library/ssl_cookie.c",
+  "repo/library/ssl_msg.c",
+  "repo/library/ssl_srv.c",
+  "repo/library/ssl_ticket.c",
+  "repo/library/ssl_tls.c",
+  "repo/library/ssl_tls13_keys.c",
+  "repo/library/threading.c",
+  "repo/library/timing.c",
+  "repo/library/version.c",
+  "repo/library/version_features.c",
+  "repo/library/x509.c",
+  "repo/library/x509_create.c",
+  "repo/library/x509_crl.c",
+  "repo/library/x509_crt.c",
+  "repo/library/x509_csr.c",
+  "repo/library/x509write_crt.c",
+  "repo/library/x509write_csr.c",
+  "repo/library/xtea.c",
+]
+
 static_library("mbedtls") {
-  sources = [
-    "repo/include/mbedtls/aes.h",
-    "repo/include/mbedtls/aesni.h",
-    "repo/include/mbedtls/arc4.h",
-    "repo/include/mbedtls/aria.h",
-    "repo/include/mbedtls/asn1.h",
-    "repo/include/mbedtls/asn1write.h",
-    "repo/include/mbedtls/base64.h",
-    "repo/include/mbedtls/bignum.h",
-    "repo/include/mbedtls/blowfish.h",
-    "repo/include/mbedtls/bn_mul.h",
-    "repo/include/mbedtls/camellia.h",
-    "repo/include/mbedtls/ccm.h",
-    "repo/include/mbedtls/certs.h",
-    "repo/include/mbedtls/chacha20.h",
-    "repo/include/mbedtls/chachapoly.h",
-    "repo/include/mbedtls/check_config.h",
-    "repo/include/mbedtls/cipher.h",
-    "repo/include/mbedtls/cipher_internal.h",
-    "repo/include/mbedtls/cmac.h",
-    "repo/include/mbedtls/compat-1.3.h",
-    "repo/include/mbedtls/config.h",
-    "repo/include/mbedtls/config_psa.h",
-    "repo/include/mbedtls/ctr_drbg.h",
-    "repo/include/mbedtls/debug.h",
-    "repo/include/mbedtls/des.h",
-    "repo/include/mbedtls/dhm.h",
-    "repo/include/mbedtls/ecdh.h",
-    "repo/include/mbedtls/ecdsa.h",
-    "repo/include/mbedtls/ecjpake.h",
-    "repo/include/mbedtls/ecp.h",
-    "repo/include/mbedtls/ecp_internal.h",
-    "repo/include/mbedtls/entropy.h",
-    "repo/include/mbedtls/entropy_poll.h",
-    "repo/include/mbedtls/error.h",
-    "repo/include/mbedtls/gcm.h",
-    "repo/include/mbedtls/havege.h",
-    "repo/include/mbedtls/hkdf.h",
-    "repo/include/mbedtls/hmac_drbg.h",
-    "repo/include/mbedtls/md.h",
-    "repo/include/mbedtls/md2.h",
-    "repo/include/mbedtls/md4.h",
-    "repo/include/mbedtls/md5.h",
-    "repo/include/mbedtls/md_internal.h",
-    "repo/include/mbedtls/memory_buffer_alloc.h",
-    "repo/include/mbedtls/net.h",
-    "repo/include/mbedtls/net_sockets.h",
-    "repo/include/mbedtls/nist_kw.h",
-    "repo/include/mbedtls/oid.h",
-    "repo/include/mbedtls/padlock.h",
-    "repo/include/mbedtls/pem.h",
-    "repo/include/mbedtls/pk.h",
-    "repo/include/mbedtls/pk_internal.h",
-    "repo/include/mbedtls/pkcs11.h",
-    "repo/include/mbedtls/pkcs12.h",
-    "repo/include/mbedtls/pkcs5.h",
-    "repo/include/mbedtls/platform.h",
-    "repo/include/mbedtls/platform_time.h",
-    "repo/include/mbedtls/platform_util.h",
-    "repo/include/mbedtls/poly1305.h",
-    "repo/include/mbedtls/ripemd160.h",
-    "repo/include/mbedtls/rsa.h",
-    "repo/include/mbedtls/rsa_internal.h",
-    "repo/include/mbedtls/sha1.h",
-    "repo/include/mbedtls/sha256.h",
-    "repo/include/mbedtls/sha512.h",
-    "repo/include/mbedtls/ssl.h",
-    "repo/include/mbedtls/ssl_cache.h",
-    "repo/include/mbedtls/ssl_ciphersuites.h",
-    "repo/include/mbedtls/ssl_cookie.h",
-    "repo/include/mbedtls/ssl_internal.h",
-    "repo/include/mbedtls/ssl_ticket.h",
-    "repo/include/mbedtls/threading.h",
-    "repo/include/mbedtls/timing.h",
-    "repo/include/mbedtls/version.h",
-    "repo/include/mbedtls/x509.h",
-    "repo/include/mbedtls/x509_crl.h",
-    "repo/include/mbedtls/x509_crt.h",
-    "repo/include/mbedtls/x509_csr.h",
-    "repo/include/mbedtls/xtea.h",
-    "repo/library/aes.c",
-    "repo/library/aesni.c",
-    "repo/library/arc4.c",
-    "repo/library/aria.c",
-    "repo/library/asn1parse.c",
-    "repo/library/asn1write.c",
-    "repo/library/base64.c",
-    "repo/library/bignum.c",
-    "repo/library/blowfish.c",
-    "repo/library/camellia.c",
-    "repo/library/ccm.c",
-    "repo/library/certs.c",
-    "repo/library/chacha20.c",
-    "repo/library/chachapoly.c",
-    "repo/library/cipher.c",
-    "repo/library/cipher_wrap.c",
-    "repo/library/cmac.c",
-    "repo/library/ctr_drbg.c",
-    "repo/library/debug.c",
-    "repo/library/des.c",
-    "repo/library/dhm.c",
-    "repo/library/ecdh.c",
-    "repo/library/ecdsa.c",
-    "repo/library/ecjpake.c",
-    "repo/library/ecp.c",
-    "repo/library/ecp_curves.c",
-    "repo/library/entropy.c",
-    "repo/library/entropy_poll.c",
-    "repo/library/error.c",
-    "repo/library/gcm.c",
-    "repo/library/havege.c",
-    "repo/library/hkdf.c",
-    "repo/library/hmac_drbg.c",
-    "repo/library/md.c",
-    "repo/library/md2.c",
-    "repo/library/md4.c",
-    "repo/library/md5.c",
-    "repo/library/memory_buffer_alloc.c",
-    "repo/library/net_sockets.c",
-    "repo/library/nist_kw.c",
-    "repo/library/oid.c",
-    "repo/library/padlock.c",
-    "repo/library/pem.c",
-    "repo/library/pk.c",
-    "repo/library/pk_wrap.c",
-    "repo/library/pkcs11.c",
-    "repo/library/pkcs12.c",
-    "repo/library/pkcs5.c",
-    "repo/library/pkparse.c",
-    "repo/library/pkwrite.c",
-    "repo/library/platform.c",
-    "repo/library/platform_util.c",
-    "repo/library/poly1305.c",
-    "repo/library/psa_crypto.c",
-    "repo/library/psa_crypto_driver_wrappers.c",
-    "repo/library/psa_crypto_se.c",
-    "repo/library/psa_crypto_slot_management.c",
-    "repo/library/psa_crypto_storage.c",
-    "repo/library/psa_its_file.c",
-    "repo/library/ripemd160.c",
-    "repo/library/rsa.c",
-    "repo/library/rsa_internal.c",
-    "repo/library/sha1.c",
-    "repo/library/sha256.c",
-    "repo/library/sha512.c",
-    "repo/library/ssl_cache.c",
-    "repo/library/ssl_ciphersuites.c",
-    "repo/library/ssl_cli.c",
-    "repo/library/ssl_cookie.c",
-    "repo/library/ssl_msg.c",
-    "repo/library/ssl_srv.c",
-    "repo/library/ssl_ticket.c",
-    "repo/library/ssl_tls.c",
-    "repo/library/ssl_tls13_keys.c",
-    "repo/library/threading.c",
-    "repo/library/timing.c",
-    "repo/library/version.c",
-    "repo/library/version_features.c",
-    "repo/library/x509.c",
-    "repo/library/x509_create.c",
-    "repo/library/x509_crl.c",
-    "repo/library/x509_crt.c",
-    "repo/library/x509_csr.c",
-    "repo/library/x509write_crt.c",
-    "repo/library/x509write_csr.c",
-    "repo/library/xtea.c",
-  ]
+  sources = mbedtls_sources
+  public_deps = [ "../../src/core:libopenthread_core_config" ]
+  public_configs = [ ":mbedtls_config" ]
+}
 
-  public_deps = mbedtls_deps
 
+static_library("mbedtls_legacy_extensions") {
+  sources = mbedtls_sources
+  public_deps = [ "../../src/core:libopenthread_core_config_legacy_extensions" ]
   public_configs = [ ":mbedtls_config" ]
 }