Skip to content

Commit 6dd98ef

Browse files
author
Johan Kopra
committed
boards: added the Sensoan SGW-2 board
Added the sensoan/sgw2 board Signed-off-by: Johan Kopra <[email protected]>
1 parent 1ebb2af commit 6dd98ef

39 files changed

+1760
-0
lines changed

boards/sensoan/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. _boards-sensoan:
2+
3+
Sensoan
4+
#######
5+
6+
.. toctree::
7+
:maxdepth: 1
8+
:glob:
9+
10+
**/*

boards/sensoan/sgw2/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Kconfig - SGW-2 board configuration
2+
#
3+
# Copyright (c) 2019 Nordic Semiconductor ASA
4+
# Copyright (c) 2024 Sensoan Oy
5+
#
6+
# SPDX-License-Identifier: Apache-2.0
7+
8+
if((CONFIG_BOARD_SGW2_NRF9160 OR CONFIG_BOARD_SGW2_NRF9160_NS) AND CONFIG_BT_HCI)
9+
zephyr_library()
10+
zephyr_library_sources(nrf5340_reset.c)
11+
endif()

boards/sensoan/sgw2/Kconfig

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SGW-2 board configuration
2+
#
3+
# Copyright (c) 2019 Nordic Semiconductor ASA
4+
# Copyright (c) 2024 Sensoan Oy
5+
#
6+
# SPDX-License-Identifier: Apache-2.0
7+
8+
config BOARD_SGW2
9+
# The GPIO driver is forced here to be enabled whenever nrf5340_reset.c
10+
# is included. This is the case for sgw2/nrf9160 and sgw2/nrf9160/ns builds
11+
# whenever BT_HCI is enabled.
12+
select GPIO if (BOARD_SGW2_NRF9160 || BOARD_SGW2_NRF9160_NS) && BT_HCI
13+
14+
if BOARD_SGW2_NRF5340_CPUAPP || BOARD_SGW2_NRF5340_CPUAPP_NS || BOARD_SGW2_NRF5340_CPUNET
15+
16+
if BOARD_SGW2_NRF5340_CPUAPP || BOARD_SGW2_NRF5340_CPUAPP_NS
17+
18+
config DOMAIN_CPUNET_BOARD
19+
string
20+
default "sgw2/nrf5340/cpunet"
21+
help
22+
The board which will be used for CPUNET domain when creating a multi
23+
image application where one or more images should be located on
24+
another board. For example hci_rpmsg on the nRF5340_cpunet for
25+
Bluetooth applications.
26+
27+
endif # BOARD_SGW2_NRF5340_CPUAPP || BOARD_SGW2_NRF5340_CPUAPP_NS
28+
29+
config DOMAIN_CPUAPP_BOARD
30+
string
31+
default "sgw2/nrf5340/cpuapp"
32+
depends on BOARD_SGW2_NRF5340_CPUNET
33+
help
34+
The board which will be used for CPUAPP domain when creating a multi
35+
image application where one or more images should be located on
36+
another board.
37+
38+
endif # BOARD_SGW2_NRF5340_CPUAPP || BOARD_SGW2_NRF5340_CPUAPP_NS || BOARD_SGW2_NRF5340_CPUNET
39+
40+
module=BOARD
41+
module-dep=LOG
42+
module-str=Log level for board
43+
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# SGW2 board configuration
2+
#
3+
# Copyright (c) 2018 Nordic Semiconductor ASA
4+
# Copyright (c) 2024 Sensoan Oy
5+
#
6+
# SPDX-License-Identifier: Apache-2.0
7+
8+
if BOARD_SGW2_NRF9160 || BOARD_SGW2_NRF9160_NS
9+
10+
# For the secure version of the board the firmware is linked at the beginning
11+
# of the flash, or into the code-partition defined in DT if it is intended to
12+
# be loaded by MCUboot. If the secure firmware is to be combined with a non-
13+
# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always
14+
# be restricted to the size of its code partition.
15+
# For the non-secure version of the board, the firmware
16+
# must be linked into the code-partition (non-secure) defined in DT, regardless.
17+
# Apply this configuration below by setting the Kconfig symbols used by
18+
# the linker according to the information extracted from DT partitions.
19+
20+
# Workaround for not being able to have commas in macro arguments
21+
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
22+
23+
config FLASH_LOAD_SIZE
24+
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
25+
depends on BOARD_SGW2_NRF9160 && TRUSTED_EXECUTION_SECURE
26+
27+
if BOARD_SGW2_NRF9160_NS
28+
29+
config FLASH_LOAD_OFFSET
30+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
31+
32+
config FLASH_LOAD_SIZE
33+
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
34+
35+
endif # BOARD_SGW2_NRF9160_NS
36+
37+
config BT_HCI_VS
38+
default y if BT
39+
40+
config I2C
41+
default $(dt_compat_on_bus,$(DT_COMPAT_NXP_PCAL6408A),i2c)
42+
43+
endif # BOARD_SGW2_NRF9160 || BOARD_SGW2_NRF9160_NS
44+
45+
if BOARD_SGW2_NRF5340_CPUAPP || BOARD_SGW2_NRF5340_CPUAPP_NS
46+
47+
# Code Partition:
48+
#
49+
# For the secure version of the board the firmware is linked at the beginning
50+
# of the flash, or into the code-partition defined in DT if it is intended to
51+
# be loaded by MCUboot. If the secure firmware is to be combined with a non-
52+
# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always
53+
# be restricted to the size of its code partition.
54+
#
55+
# For the non-secure version of the board, the firmware
56+
# must be linked into the code-partition (non-secure) defined in DT, regardless.
57+
# Apply this configuration below by setting the Kconfig symbols used by
58+
# the linker according to the information extracted from DT partitions.
59+
60+
# SRAM Partition:
61+
#
62+
# If the secure firmware is to be combined with a non-secure image
63+
# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always
64+
# be restricted to the secure image SRAM partition (sram-secure-partition).
65+
# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram
66+
# may be used by the image.
67+
#
68+
# For the non-secure version of the board, the firmware image SRAM is
69+
# always restricted to the allocated non-secure SRAM partition.
70+
#
71+
# Workaround for not being able to have commas in macro arguments
72+
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
73+
DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition
74+
75+
if BOARD_SGW2_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE
76+
77+
config FLASH_LOAD_SIZE
78+
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
79+
80+
config SRAM_SIZE
81+
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K)
82+
83+
endif # BOARD_SGW2_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE
84+
85+
if BOARD_SGW2_NRF5340_CPUAPP_NS
86+
87+
config FLASH_LOAD_OFFSET
88+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
89+
90+
config FLASH_LOAD_SIZE
91+
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
92+
93+
endif # BOARD_SGW2_NRF5340_CPUAPP_NS
94+
95+
config BT_HCI_IPC
96+
default y if BT
97+
98+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
99+
int
100+
default 4096 if BT_HCI_IPC
101+
102+
endif # BOARD_SGW2_NRF5340_CPUAPP || BOARD_SGW2_NRF5340_CPUAPP_NS
103+
104+
if BOARD_SGW2_NRF5340_CPUNET
105+
106+
config BT_CTLR
107+
default y if BT
108+
109+
endif # BOARD_SGW2_NRF5340_CPUNET

boards/sensoan/sgw2/Kconfig.sgw2

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SGW-2 board configuration
2+
#
3+
# Copyright (c) 2019 Nordic Semiconductor ASA
4+
# Copyright (c) 2024 Sensoan Oy
5+
#
6+
# SPDX-License-Identifier: Apache-2.0
7+
8+
config BOARD_SGW2
9+
select SOC_NRF9160_SICA if BOARD_SGW2_NRF9160 || BOARD_SGW2_NRF9160_NS
10+
select SOC_NRF5340_CPUAPP_QKAA if BOARD_SGW2_NRF5340_CPUAPP
11+
select SOC_NRF5340_CPUAPP_QKAA if BOARD_SGW2_NRF5340_CPUAPP_NS
12+
select SOC_NRF5340_CPUNET_QKAA if BOARD_SGW2_NRF5340_CPUNET

boards/sensoan/sgw2/board.cmake

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2019 Nordic Semiconductor ASA.
2+
# Copyright (c) 2024 Sensoan Oy
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
if(CONFIG_BOARD_SGW2_NRF9160 OR CONFIG_BOARD_SGW2_NRF9160_NS)
6+
if(CONFIG_BOARD_SGW2_NRF9160_NS)
7+
set(TFM_PUBLIC_KEY_FORMAT "full")
8+
endif()
9+
10+
if(CONFIG_TFM_FLASH_MERGED_BINARY)
11+
set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex)
12+
endif()
13+
board_runner_args(jlink "--device=nRF9160_xxAA" "--speed=4000")
14+
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
15+
include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)
16+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
17+
elseif(CONFIG_BOARD_SGW2_NRF5340_CPUAPP OR CONFIG_BOARD_SGW2_NRF5340_CPUAPP_NS OR CONFIG_BOARD_SGW2_NRF5340_CPUNET)
18+
if(CONFIG_BOARD_SGW2_NRF5340_CPUAPP_NS)
19+
set(TFM_PUBLIC_KEY_FORMAT "full")
20+
endif()
21+
22+
if(CONFIG_BOARD_SGW2_NRF5340_CPUAPP OR CONFIG_BOARD_SGW2_NRF5340_CPUAPP_NS)
23+
board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000")
24+
endif()
25+
26+
if(CONFIG_TFM_FLASH_MERGED_BINARY)
27+
set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/tfm_merged.hex")
28+
endif()
29+
30+
if(CONFIG_BOARD_SGW2_NRF5340_CPUNET)
31+
board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000")
32+
endif()
33+
34+
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
35+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
36+
endif()

boards/sensoan/sgw2/board.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2024 Sensoan Oy
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef BOARD_H
8+
#define BOARD_H
9+
10+
/* Internal macros */
11+
#define PORT(_TYPE, _PIN) _TYPE##_PORT_##_PIN
12+
#define PIN(_TYPE, _PIN) _TYPE##_PIN_##_PIN
13+
#define GPIOAUX(_PORT) &gpio##_PORT
14+
#define GPIO_BY_PORT(_PORT) GPIOAUX(_PORT)
15+
#define GPIO(_TYPE, _PIN) GPIO_BY_PORT(PORT(_TYPE, _PIN))
16+
17+
/**
18+
* Rewrite a pin with a special type as the corresponding GPIO node and pin.
19+
* These correspondences are encoded in the header files sgw2_nrf5340.h and
20+
* sgw2_nrf9160.h contained in the board directory.
21+
*
22+
* @param _TYPE Pin type (allowed types are MCU_IF and EDGE_CONN)
23+
* @param _PIN Pin number
24+
*/
25+
#define GPIO_AND_PIN(_TYPE, _PIN) GPIO(_TYPE, _PIN) PIN(_TYPE, _PIN)
26+
27+
/**
28+
* A wrapper for the NRF_PSEL macro that accepts pins with special types.
29+
* These are translated into the corresponding GPIO ports and pins
30+
* for the use of NRF_PSEL via the correspondences encoded in the header files
31+
* sgw2_nrf5340.h and sgw2_nrf9160.h contained in the board directory.
32+
*
33+
* @param _FUN Pin function configuration passed to the NRF_PSEL macro
34+
* @param _TYPE Pin type (allowed types are MCU_IF and EDGE_CONN)
35+
* @param _PIN Pin number
36+
*/
37+
#define SGW_PSEL(_FUN, _TYPE, _PIN) NRF_PSEL(_FUN, PORT(_TYPE, _PIN), PIN(_TYPE, _PIN))
38+
39+
#endif /* BOARD_H */

boards/sensoan/sgw2/board.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
board:
2+
name: sgw2
3+
vendor: sensoan
4+
socs:
5+
- name: nrf9160
6+
variants:
7+
- name: 'ns'
8+
- name: nrf5340
9+
variants:
10+
- name: 'ns'
11+
cpucluster: 'cpuapp'
7.76 KB
Loading
36.3 KB
Loading

0 commit comments

Comments
 (0)