-
-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(west): introduce zephyr into firmware monorepo
[no changelog]
- Loading branch information
1 parent
e196413
commit 09a894e
Showing
62 changed files
with
3,163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ ignore-paths= | |
crypto, | ||
legacy, | ||
storage, | ||
west, | ||
fail-under=10.0 | ||
jobs=0 | ||
load-plugins=trezor_pylint_plugin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
^\./crypto/ | ||
^\./legacy/ | ||
^\./storage/ | ||
^\./west/workspace/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2021 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# This CMake file is picked by the Zephyr build system because it is defined | ||
# as the module CMake entry point (see zephyr/module.yml). | ||
|
||
|
||
zephyr_include_directories(include) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) 2021 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# This Kconfig file is picked by the Zephyr build system because it is defined | ||
# as the module Kconfig entry point (see zephyr/module.yml). You can browse | ||
# module options by going to Zephyr -> Modules in Kconfig. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Trezor BLE Gateway | ||
|
||
Welcome to the **Trezor BLE Gateway** project! | ||
This repository contains the source code and instructions to build and flash the application onto the `t3w1_nrf52833` board. | ||
|
||
## Table of Contents | ||
|
||
- [Prerequisites](#prerequisites) | ||
- [Getting Started](#getting-started) | ||
- [Install the toolchain](#install-the-toolchain) | ||
- [Launch the nRF Shell](#launch-the-nrf-shell) | ||
- [Initialize the Workspace](#initialize-the-workspace) | ||
- [Update nRF Connect SDK Modules](#update-nrf-connect-sdk-modules) | ||
- [Build the Application](#build-the-application) | ||
- [Flash the Application](#flash-the-application) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
|
||
## Prerequisites | ||
|
||
Before you begin, ensure you have met the following requirements: | ||
|
||
- **nrfutil**: Install [nrfutil](https://docs.nordicsemi.com/bundle/nrfutil/page/README.html). This tool is essential for managing the nRF Connect SDK and toolchains. | ||
- **Git**: Ensure you have Git installed for cloning repositories. | ||
|
||
## Getting Started | ||
|
||
Follow these steps to set up the project on your local machine. | ||
|
||
### Install the toolchain | ||
|
||
Using nrfutil, install the required toolchain for the nRF Connect SDK: | ||
```sh | ||
nrfutil toolchain-manager install --ncs-version v2.6.2 | ||
``` | ||
|
||
### Launch the nRF Shell | ||
|
||
First, launch the nRF shell using the `nrfutil` toolchain manager: | ||
|
||
```sh | ||
nrfutil toolchain-manager launch --shell | ||
``` | ||
|
||
### Initialize the Workspace | ||
Initialize your West workspace for the Trezor BLE Gateway project: | ||
```sh | ||
cd west | ||
west init -l ./trezor | ||
``` | ||
|
||
### Update nRF Connect SDK Modules | ||
|
||
Update the modules: | ||
```sh | ||
west update | ||
``` | ||
|
||
|
||
### Building the Application | ||
Build the application for the t3w1_revA_nrf52832 board: | ||
```sh | ||
cd trezor | ||
west build ./trezor-ble -b t3w1_revA_nrf52832 | ||
``` | ||
|
||
|
||
### Flashing the Application | ||
Flash the compiled application onto the board: | ||
```sh | ||
west flash | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# nRF52833 DK NRF52833 board configuration | ||
|
||
# Copyright (c) 2019 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if BOARD_T3W1_D1_NRF52833 | ||
|
||
config BOARD | ||
default "t3w1_d1_nrf52833" | ||
|
||
config BT_CTLR | ||
default BT | ||
|
||
endif # BOARD_T3W1_NRF52833 |
7 changes: 7 additions & 0 deletions
7
west/trezor/boards/arm/t3w1_d1_nrf52833/Kconfig.t3w1_d1_nrf52833
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# nRF52833 DK NRF52833 board configuration | ||
|
||
# Copyright (c) 2019 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_T3W1_D1_NRF52833 | ||
select SOC_NRF52833_QIAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright (c) 2021 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board_runner_args(jlink "--device=nRF52833_xxAA" "--speed=4000") | ||
board_runner_args(pyocd "--target=nrf52833" "--frequency=4000000") | ||
|
||
set(OPENOCD_NRF5_SUBFAMILY "nrf52") | ||
|
||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board: | ||
name: t3w1_d1_nrf52833 | ||
vendor: vendor | ||
socs: | ||
- name: nrf52833 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) 2024 Nordic Semiconductor | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Suppress "unique_unit_address_if_enabled" to handle the following overlaps: | ||
# - power@40000000 & clock@40000000 & bprot@40000000 | ||
# - acl@4001e000 & flash-controller@4001e000 | ||
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") |
47 changes: 47 additions & 0 deletions
47
west/trezor/boards/arm/t3w1_d1_nrf52833/t3w1_d1_nrf52833-pinctrl.dtsi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2022 Nordic Semiconductor | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&pinctrl { | ||
uart0_default: uart0_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 27)>, | ||
<NRF_PSEL(UART_RTS, 0, 8)>; | ||
}; | ||
group2 { | ||
psels = <NRF_PSEL(UART_RX, 0, 26)>, | ||
<NRF_PSEL(UART_CTS, 0, 6)>; | ||
bias-pull-up; | ||
}; | ||
}; | ||
|
||
uart0_sleep: uart0_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 27)>, | ||
<NRF_PSEL(UART_RX, 0, 26)>, | ||
<NRF_PSEL(UART_RTS, 0, 8)>, | ||
<NRF_PSEL(UART_CTS, 0, 6)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
spi0_default: spi0_default { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 1, 5)>, | ||
<NRF_PSEL(SPIM_MOSI, 0, 19)>, | ||
<NRF_PSEL(SPIM_MISO, 1, 3)>; | ||
}; | ||
}; | ||
|
||
spi0_sleep: spi0_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 1, 5)>, | ||
<NRF_PSEL(SPIM_MOSI, 0, 19)>, | ||
<NRF_PSEL(SPIM_MISO, 1, 3)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
|
||
}; |
145 changes: 145 additions & 0 deletions
145
west/trezor/boards/arm/t3w1_d1_nrf52833/t3w1_d1_nrf52833.dts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* | ||
* Copyright (c) 2019 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
#include <nordic/nrf52833_qiaa.dtsi> | ||
#include "t3w1_d1_nrf52833-pinctrl.dtsi" | ||
#include <zephyr/dt-bindings/input/input-event-codes.h> | ||
|
||
/ { | ||
model = "T3W1 D1 NRF52833"; | ||
compatible = "nordic,t3w1_d1_nrf52833"; | ||
|
||
chosen { | ||
zephyr,console = &uart0; | ||
zephyr,shell-uart = &uart0; | ||
zephyr,uart-mcumgr = &uart0; | ||
zephyr,bt-mon-uart = &uart0; | ||
zephyr,bt-c2h-uart = &uart0; | ||
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &slot0_partition; | ||
zephyr,ieee802154 = &ieee802154; | ||
}; | ||
|
||
leds { | ||
compatible = "gpio-leds"; | ||
led0: led_0 { | ||
gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; | ||
label = "Green LED 0"; | ||
}; | ||
led1: led_1 { | ||
gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; | ||
label = "Green LED 1"; | ||
}; | ||
out0: out_0 { | ||
gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; | ||
label = "FW Running"; | ||
}; | ||
}; | ||
|
||
buttons { | ||
compatible = "gpio-keys"; | ||
button0: button_0 { | ||
gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; | ||
label = "Push button switch 0"; | ||
zephyr,code = <INPUT_KEY_0>; | ||
}; | ||
trezor_ready: trezor_ready { | ||
gpios = <&gpio0 30 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>; | ||
label = "Trezor ready"; | ||
zephyr,code = <INPUT_KEY_1>; | ||
}; | ||
}; | ||
|
||
/* These aliases are provided for compatibility with samples */ | ||
aliases { | ||
led0 = &led0; | ||
led1 = &led1; | ||
sw0 = &button0; | ||
bootloader-led0 = &led0; | ||
mcuboot-button0 = &button0; | ||
mcuboot-led0 = &led0; | ||
watchdog0 = &wdt0; | ||
}; | ||
}; | ||
|
||
&adc { | ||
status = "okay"; | ||
}; | ||
|
||
&uicr { | ||
gpio-as-nreset; | ||
}; | ||
|
||
&gpiote { | ||
status = "okay"; | ||
}; | ||
|
||
&gpio0 { | ||
status = "okay"; | ||
}; | ||
|
||
&gpio1 { | ||
status = "okay"; | ||
}; | ||
|
||
&uart0 { | ||
compatible = "nordic,nrf-uarte"; | ||
status = "okay"; | ||
current-speed = <1000000>; | ||
pinctrl-0 = <&uart0_default>; | ||
pinctrl-1 = <&uart0_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
hw-flow-control; | ||
}; | ||
|
||
&spi0 { | ||
compatible = "nordic,nrf-spim"; | ||
status = "okay"; | ||
pinctrl-0 = <&spi0_default>; | ||
pinctrl-1 = <&spi0_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
cs-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; | ||
reg_my_spi_master: spi-dev-a@0 { | ||
reg = <0>; | ||
}; | ||
}; | ||
|
||
&ieee802154 { | ||
status = "okay"; | ||
}; | ||
|
||
&flash0 { | ||
|
||
partitions { | ||
compatible = "fixed-partitions"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x00000000 0xC000>; | ||
}; | ||
slot0_partition: partition@c000 { | ||
label = "image-0"; | ||
reg = <0x0000C000 0x37000>; | ||
}; | ||
slot1_partition: partition@43000 { | ||
label = "image-1"; | ||
reg = <0x00043000 0x37000>; | ||
}; | ||
storage_partition: partition@7a000 { | ||
label = "storage"; | ||
reg = <0x0007A000 0x00006000>; | ||
}; | ||
}; | ||
}; | ||
|
||
zephyr_udc0: &usbd { | ||
compatible = "nordic,nrf-usbd"; | ||
status = "okay"; | ||
}; |
16 changes: 16 additions & 0 deletions
16
west/trezor/boards/arm/t3w1_d1_nrf52833/t3w1_d1_nrf52833.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
identifier: t3w1_d1_nrf52833 | ||
name: tw31-d1-NRF52833 | ||
type: mcu | ||
arch: arm | ||
ram: 128 | ||
flash: 512 | ||
toolchain: | ||
- zephyr | ||
- gnuarmemb | ||
- xtools | ||
supported: | ||
- usb_device | ||
- ble | ||
- gpio | ||
- watchdog | ||
- counter |
Oops, something went wrong.