Skip to content

Commit

Permalink
boards: add thingy91x board
Browse files Browse the repository at this point in the history
This patch adds board files for the Thingy:91 X.

Signed-off-by: Bernt Johan Damslora <[email protected]>
Signed-off-by: Maximilian Deubel <[email protected]>
  • Loading branch information
maxd-nordic committed Feb 8, 2024
1 parent 1f86aea commit 9741f56
Show file tree
Hide file tree
Showing 42 changed files with 1,730 additions and 0 deletions.
8 changes: 8 additions & 0 deletions boards/arm/thingy91x_nrf5340/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2024 Nordic Semiconductor
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

if (CONFIG_BOARD_THINGY91X_NRF5340_CPUAPP OR CONFIG_BOARD_THINGY91X_NRF5340_CPUAPP_NS)
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_BOARD_ENABLE_CPUNET nrf5340_cpunet_reset.c)
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_LIST_DIR}/thingy91x_nrf5340_pm_static.yml CACHE INTERNAL "")
endif()
62 changes: 62 additions & 0 deletions boards/arm/thingy91x_nrf5340/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright (c) 2024 Nordic Semiconductor
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS

config BOARD_ENABLE_DCDC_APP
bool "Application MCU DCDC converter"
select SOC_DCDC_NRF53X_APP
default y

config BOARD_ENABLE_DCDC_NET
bool "Network MCU DCDC converter"
select SOC_DCDC_NRF53X_NET
default y

config BOARD_ENABLE_CPUNET
bool "Enable nRF53 Network MCU"
select SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 if \
$(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GPIO_FORWARDER))
help
This option enables releasing the Network 'force off' signal, which
as a consequence will power up the Network MCU during system boot.
Additionally, the option allocates GPIO pins that will be used by UARTE
of the Network MCU.
Note: GPIO pin allocation can only be configured by the secure Application
MCU firmware, so when this option is used with the non-secure version of
the board, the application needs to take into consideration, that the
secure firmware image must already have configured GPIO allocation for the
Network MCU.
default y

config DOMAIN_CPUNET_BOARD
string
default "thingy91x_nrf5340_cpunet" if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS
depends on BOARD_ENABLE_CPUNET
help
The board which will be used for CPUNET domain when creating a multi
image application where one or more images should be located on
another board. For example hci_rpmsg on the nRF5340_cpunet for
Bluetooth applications.

endif

if BOARD_THINGY91X_NRF5340_CPUNET

# BT_CTLR depends on BT. When BT is enabled we should default to also
# enabling the controller.
config BT_CTLR
default y if BT

config BT_ECC
default y if BT

config DOMAIN_CPUAPP_BOARD
string
default "thingy91x_nrf5340_cpuapp" if BOARD_THINGY91X_NRF5340_CPUNET
help
The board which will be used for CPUAPP domain when creating a multi
image application where one or more images should be located on
another board.

endif # BOARD_THINGY91X_NRF5340_CPUNET
14 changes: 14 additions & 0 deletions boards/arm/thingy91x_nrf5340/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2024 Nordic Semiconductor
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

config BOARD_THINGY91X_NRF5340_CPUAPP
bool "nRF5340_APP THINGY91X"
depends on SOC_NRF5340_CPUAPP_QKAA

config BOARD_THINGY91X_NRF5340_CPUAPP_NS
bool "nRF5340_APP THINGY91X"
depends on SOC_NRF5340_CPUAPP_QKAA

config BOARD_THINGY91X_NRF5340_CPUNET
bool "nRF5340_NET THINGY91X"
depends on SOC_NRF5340_CPUNET_QKAA
118 changes: 118 additions & 0 deletions boards/arm/thingy91x_nrf5340/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Thingy:91 X nRF5340 board configuration

# Copyright (c) 2024 Nordic Semiconductor
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS

config BOARD
default "thingy91x_nrf5340_cpuapp" if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS

# By default, if we build for a Non-Secure version of the board,
# enable building with TF-M as the Secure Execution Environment.
config BUILD_WITH_TFM
default y if BOARD_THINGY91X_NRF5340_CPUAPP_NS

if BUILD_WITH_TFM

# By default, if we build with TF-M, instruct build system to
# flash the combined TF-M (Secure) & Zephyr (Non Secure) image
config TFM_FLASH_MERGED_BINARY
bool
default y

endif # BUILD_WITH_TFM

# Code Partition:
#
# For the secure version of the board the firmware is linked at the beginning
# of the flash, or into the code-partition defined in DT if it is intended to
# be loaded by MCUboot. If the secure firmware is to be combined with a non-
# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always
# be restricted to the size of its code partition.
#
# For the non-secure version of the board, the firmware
# must be linked into the code-partition (non-secure) defined in DT, regardless.
# Apply this configuration below by setting the Kconfig symbols used by
# the linker according to the information extracted from DT partitions.

# SRAM Partition:
#
# If the secure firmware is to be combined with a non-secure image
# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always
# be restricted to the secure image SRAM partition (sram-secure-partition).
# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram
# may be used by the image.
#
# For the non-secure version of the board, the firmware image SRAM is
# always restricted to the allocated non-secure SRAM partition.
#
# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition

if BOARD_THINGY91X_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE

config FLASH_LOAD_SIZE
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))

config SRAM_SIZE
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K)

endif # BOARD_THINGY91X_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE

config FLASH_LOAD_OFFSET
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))

config FLASH_LOAD_SIZE
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))

choice BT_HCI_BUS_TYPE
default BT_RPMSG if BT
endchoice

config HEAP_MEM_POOL_SIZE
default 4096 if BT_RPMSG

endif # BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS

config BOARD
default "thingy91x_nrf5340_cpunet" if BOARD_THINGY91X_NRF5340_CPUNET

config MBOX_NRFX_IPC
default MBOX

if BOARD_THINGY91X_NRF5340_CPUNET

config BT_CTLR
default y if BT

endif # BOARD_THINGY91X_NRF5340_CPUNET

config USE_SEGGER_RTT
default y if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS || BOARD_THINGY91X_NRF5340_CPUNET

config RTT_CONSOLE
default y if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS || BOARD_THINGY91X_NRF5340_CPUNET

if !IS_BOOTLOADER_IMG

config SECURE_BOOT
default y if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS || BOARD_THINGY91X_NRF5340_CPUNET

config BOOTLOADER_MCUBOOT
default y if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS

config ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS
default y if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS

config NRF53_UPGRADE_NETWORK_CORE
default y if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS

config UPDATEABLE_IMAGE_NUMBER
default 2 if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS

config SB_SIGNING_KEY_FILE
default "$(ZEPHYR_NRF_MODULE_DIR)/boards/arm/thingy91x_nrf5340/nsib_signing_key.pem" if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS || BOARD_THINGY91X_NRF5340_CPUNET

endif # !IS_BOOTLOADER_IMG
16 changes: 16 additions & 0 deletions boards/arm/thingy91x_nrf5340/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2024 Nordic Semiconductor
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

if(BOARD_THINGY91X_NRF5340_CPUAPP OR BOARD_THINGY91X_NRF5340_CPUAPP_NS)
board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000")
board_runner_args(nrfjprog "--nrf-family=NRF53")
endif()

if(BOARD_THINGY91X_NRF5340_CPUNET)
board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000")
board_runner_args(nrfjprog "--nrf-family=NRF53")
endif()

include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
58 changes: 58 additions & 0 deletions boards/arm/thingy91x_nrf5340/nrf5340_cpunet_reset.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#include <zephyr/sys/util_macro.h>
#include <zephyr/init.h>
#include <zephyr/logging/log.h>

#include <soc.h>

LOG_MODULE_REGISTER(thingy91x_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL);

#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP)
#include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/debug.h>
#endif

static void remoteproc_mgr_config(void)
{
#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) && \
(!defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM))
/* Route Bluetooth Controller Debug Pins */
DEBUG_SETUP();
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */

#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
/* Retain nRF5340 Network MCU in Secure domain (bus
* accesses by Network MCU will have Secure attribute set).
*/
NRF_SPU->EXTDOMAIN[0].PERM = BIT(4);
#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */
}

static int remoteproc_mgr_boot(void)
{

/* Secure domain may configure permissions for the Network MCU. */
remoteproc_mgr_config();

#if !defined(CONFIG_TRUSTED_EXECUTION_SECURE)
/*
* Building Zephyr with CONFIG_TRUSTED_EXECUTION_SECURE=y implies
* building also a Non-Secure image. The Non-Secure image will, in
* this case do the remainder of actions to properly configure and
* boot the Network MCU.
*/

/* Release the Network MCU, 'Release force off signal' */
NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release;

LOG_DBG("Network MCU released.");
#endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */

return 0;
}

SYS_INIT(remoteproc_mgr_boot, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
30 changes: 30 additions & 0 deletions boards/arm/thingy91x_nrf5340/nrf5340_shared_sram_planning_conf.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/* Default shared SRAM planning when building for nRF5340.
* This file is included by both nRF5340 CPUAPP (Application MCU)
* and nRF5340 CPUNET (Network MCU).
* - 64 kB SRAM allocated as Shared memory (sram0_shared)
* - Region defined after the image SRAM of Application MCU
*/

/ {
chosen {
/* shared memory reserved for the inter-processor communication */
zephyr,ipc_shm = &sram0_shared;
};

reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;

sram0_shared: memory@20070000 {
/* SRAM allocated to shared memory */
reg = <0x20070000 0x10000>;
};
};
};
5 changes: 5 additions & 0 deletions boards/arm/thingy91x_nrf5340/nsib_signing_key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIG5ZF2/vbga3GvMiYkclanR+w/h1V2Pk5bvkAnMdP54roAoGCCqGSM49
AwEHoUQDQgAEGdLHchVpe7i/FOajzN1oHfp4sJNI7zuT/KiUEzNhkkiCvePMmH6h
Xc5BTWno2CjcVkHTM6s7zHFVoB9YEI9ZnA==
-----END EC PRIVATE KEY-----
4 changes: 4 additions & 0 deletions boards/arm/thingy91x_nrf5340/pre_dt_board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 Nordic Semiconductor
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")
21 changes: 21 additions & 0 deletions boards/arm/thingy91x_nrf5340/thingy91x_nrf5340_cpuapp.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/dts-v1/;
#include <nordic/nrf5340_cpuapp_qkaa.dtsi>
#include "thingy91x_nrf5340_cpuapp_common.dts"

/ {
model = "Nordic Thingy:91 X NRF5340 Application";
compatible = "nordic,thingy91x-nrf5340-cpuapp";

chosen {
zephyr,sram = &sram0_image;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,sram-secure-partition = &sram0_s;
zephyr,sram-non-secure-partition = &sram0_ns;
};
};
20 changes: 20 additions & 0 deletions boards/arm/thingy91x_nrf5340/thingy91x_nrf5340_cpuapp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
identifier: thingy91x_nrf5340_cpuapp
name: Thingy91X-NRF5340-application-MCU
type: mcu
arch: arm
toolchain:
- gnuarmemb
- xtools
- zephyr
ram: 448
flash: 1024
supported:
- gpio
- i2c
- i2s
- pwm
- watchdog
- usb_cdc
- usb_device
- netif:openthread
- gpio
Loading

0 comments on commit 9741f56

Please sign in to comment.