Skip to content

Commit

Permalink
Add support for RTT UART
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingRays committed Jun 14, 2023
1 parent 5ac716f commit fb3d654
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
14 changes: 13 additions & 1 deletion script/build
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET:-}
NRF_PLATFORMS=(nrf52811 nrf52833 nrf52840)
readonly NRF_PLATFORMS

NRF_BUILD_TYPES=(UART_trans USB_trans SPI_trans_NCP soft_crypto soft_crypto_threading)
NRF_BUILD_TYPES=(UART_trans USB_trans SPI_trans_NCP RTT_trans soft_crypto soft_crypto_threading)
readonly NRF_BUILD_TYPES

OT_SRCDIR="$(pwd)"
Expand Down Expand Up @@ -107,6 +107,10 @@ main()
OT_CMAKE_NINJA_TARGET=("ot-ncp-mtd" "ot-rcp")
options+=("${local_options[@]}" "-DOT_NCP_SPI=ON")
;;
RTT_trans)
OT_CMAKE_NINJA_TARGET=("ot-cli-mtd" "ot-rcp")
options+=("${local_options[@]}" "-DOT_RTT_UART=ON")
;;
esac
;;
nrf52833)
Expand All @@ -122,6 +126,10 @@ main()
OT_CMAKE_NINJA_TARGET=("ot-ncp-ftd" "ot-ncp-mtd" "ot-rcp")
options+=("${local_options[@]}" "-DOT_NCP_SPI=ON")
;;
RTT_trans)
OT_CMAKE_NINJA_TARGET=("ot-cli-ftd" "ot-cli-mtd" "ot-rcp")
options+=("${local_options[@]}" "-DOT_RTT_UART=ON")
;;
esac
;;
nrf52840)
Expand All @@ -137,6 +145,10 @@ main()
OT_CMAKE_NINJA_TARGET=("ot-ncp-ftd" "ot-ncp-mtd" "ot-rcp")
options+=("${local_options[@]}" "-DOT_NCP_SPI=ON" "-DOT_EXTERNAL_MBEDTLS=nordicsemi-mbedtls")
;;
RTT_trans)
OT_CMAKE_NINJA_TARGET=("ot-cli-ftd" "ot-cli-mtd" "ot-rcp")
options+=("${local_options[@]}" "-DOT_RTT_UART=ON" "-DOT_EXTERNAL_MBEDTLS=nordicsemi-mbedtls")
;;
soft_crypto)
options+=("${local_options[@]}")
;;
Expand Down
9 changes: 9 additions & 0 deletions script/test
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ main()
rm -rf "$OT_BUILDDIR"
"$(dirname "$0")"/build nrf52840 SPI_trans_NCP "${OT_OPTIONS[@]}"

rm -rf "$OT_BUILDDIR"
"$(dirname "$0")"/build nrf52811 RTT_trans "${OT_OPTIONS[@]}"

rm -rf "$OT_BUILDDIR"
"$(dirname "$0")"/build nrf52833 RTT_trans "${OT_OPTIONS[@]}"

rm -rf "$OT_BUILDDIR"
"$(dirname "$0")"/build nrf52840 RTT_trans "${OT_OPTIONS[@]}"

rm -rf "$OT_BUILDDIR"
"$(dirname "$0")"/build nrf52840 soft_crypto "${OT_OPTIONS[@]}"

Expand Down
16 changes: 10 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@
# POSSIBILITY OF SUCH DAMAGE.
#

if(OT_NCP_SPI)
list(APPEND OT_PLATFORM_DEFINES "SPIS_AS_SERIAL_TRANSPORT=1")
if(OT_RTT_UART)
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_UART_RTT_ENABLE=1")
else()
option(OT_USB "enable nrf USB as serial transport support")
if(OT_USB)
list(APPEND OT_PLATFORM_DEFINES "USB_CDC_AS_SERIAL_TRANSPORT=1")
if(OT_NCP_SPI)
list(APPEND OT_PLATFORM_DEFINES "SPIS_AS_SERIAL_TRANSPORT=1")
else()
list(APPEND OT_PLATFORM_DEFINES "UART_AS_SERIAL_TRANSPORT=1")
option(OT_USB "enable nrf USB as serial transport support")
if(OT_USB)
list(APPEND OT_PLATFORM_DEFINES "USB_CDC_AS_SERIAL_TRANSPORT=1")
else()
list(APPEND OT_PLATFORM_DEFINES "UART_AS_SERIAL_TRANSPORT=1")
endif()
endif()
endif()

Expand Down
5 changes: 5 additions & 0 deletions src/src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

#include <openthread/config.h>

#include <utils/uart_rtt.h>

#if !OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT && PLATFORM_OPENTHREAD_VANILLA

#include <mbedtls/platform.h>
Expand Down Expand Up @@ -139,6 +141,9 @@ bool otSysPseudoResetWasRequested(void)

void otSysProcessDrivers(otInstance *aInstance)
{
#if OPENTHREAD_UART_RTT_ENABLE
utilsUartRttUpdate();
#endif
nrf5RadioProcess(aInstance);
nrf5TransportProcess();
nrf5TempProcess();
Expand Down

0 comments on commit fb3d654

Please sign in to comment.