From 8207b9ffe562e84087d34074ec16a35ccc3b24f3 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Fri, 22 Nov 2024 15:39:54 +0100 Subject: [PATCH] feat(core): add BLE to t3w1 board [no changelog] --- .../models/T3W1/boards/trezor_t3w1_revA.h | 16 ++++++++++++++ .../models/T3W1/boards/trezor_t3w1_revA0.h | 16 ++++++++++++++ .../models/T3W1/trezor_t3w1_revA.py | 22 ++++++++----------- .../models/T3W1/trezor_t3w1_revA0.py | 22 ++++++++----------- 4 files changed, 50 insertions(+), 26 deletions(-) diff --git a/core/embed/models/T3W1/boards/trezor_t3w1_revA.h b/core/embed/models/T3W1/boards/trezor_t3w1_revA.h index 7ca1dc1547..daf289636d 100644 --- a/core/embed/models/T3W1/boards/trezor_t3w1_revA.h +++ b/core/embed/models/T3W1/boards/trezor_t3w1_revA.h @@ -150,4 +150,20 @@ #define SBU_2_PORT GPIOC #define SBU_2_CLK_ENA __HAL_RCC_GPIOC_CLK_ENABLE +#define NRF_IN_GPIO0_PIN GPIO_PIN_7 +#define NRF_IN_GPIO0_PORT GPIOE +#define NRF_IN_GPIO0_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE +#define NRF_IN_FW_RUNNING_PIN GPIO_PIN_13 +#define NRF_IN_FW_RUNNING_PORT GPIOE +#define NRF_IN_FW_RUNNING_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE +#define NRF_OUT_RESET_PIN GPIO_PIN_0 +#define NRF_OUT_RESET_PORT GPIOG +#define NRF_OUT_RESET_CLK_ENA __HAL_RCC_GPIOG_CLK_ENABLE +#define NRF_OUT_STAY_IN_BLD_PIN GPIO_PIN_15 +#define NRF_OUT_STAY_IN_BLD_PORT GPIOE +#define NRF_OUT_STAY_IN_BLD_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE +#define NRF_OUT_FW_RUNNING_PIN GPIO_PIN_11 +#define NRF_OUT_FW_RUNNING_PORT GPIOE +#define NRF_OUT_FW_RUNNING_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE + #endif // TREZOR_T3W1_REVA_H_ diff --git a/core/embed/models/T3W1/boards/trezor_t3w1_revA0.h b/core/embed/models/T3W1/boards/trezor_t3w1_revA0.h index d5f0a43de4..44bdbfb880 100644 --- a/core/embed/models/T3W1/boards/trezor_t3w1_revA0.h +++ b/core/embed/models/T3W1/boards/trezor_t3w1_revA0.h @@ -150,4 +150,20 @@ #define SBU_2_PORT GPIOC #define SBU_2_CLK_ENA __HAL_RCC_GPIOC_CLK_ENABLE +#define NRF_IN_GPIO0_PIN GPIO_PIN_7 +#define NRF_IN_GPIO0_PORT GPIOE +#define NRF_IN_GPIO0_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE +#define NRF_IN_FW_RUNNING_PIN GPIO_PIN_13 +#define NRF_IN_FW_RUNNING_PORT GPIOE +#define NRF_IN_FW_RUNNING_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE +#define NRF_OUT_RESET_PIN GPIO_PIN_0 +#define NRF_OUT_RESET_PORT GPIOG +#define NRF_OUT_RESET_CLK_ENA __HAL_RCC_GPIOG_CLK_ENABLE +#define NRF_OUT_STAY_IN_BLD_PIN GPIO_PIN_15 +#define NRF_OUT_STAY_IN_BLD_PORT GPIOE +#define NRF_OUT_STAY_IN_BLD_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE +#define NRF_OUT_FW_RUNNING_PIN GPIO_PIN_11 +#define NRF_OUT_FW_RUNNING_PORT GPIOE +#define NRF_OUT_FW_RUNNING_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE + #endif // TREZOR_T3W1_REVA_H_ diff --git a/core/site_scons/models/T3W1/trezor_t3w1_revA.py b/core/site_scons/models/T3W1/trezor_t3w1_revA.py index 43348ec0b7..7cdb2ce7e1 100644 --- a/core/site_scons/models/T3W1/trezor_t3w1_revA.py +++ b/core/site_scons/models/T3W1/trezor_t3w1_revA.py @@ -77,21 +77,17 @@ def configure( features_available.append("haptic") defines += ["USE_HAPTIC=1"] - # if "ble" in features_wanted: - # sources += ["embed/trezorhal/stm32f4/ble/ble_hal.c"] - # sources += ["embed/trezorhal/stm32f4/ble/dfu.c"] - # sources += ["embed/trezorhal/stm32f4/ble/fwu.c"] - # sources += ["embed/trezorhal/stm32f4/ble/ble.c"] - # sources += ["embed/trezorhal/stm32f4/ble/messages.c"] - # sources += [ - # "vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c" - # ] - # features_available.append("ble") - # defines += [("USE_BLE", "1")] - if "ble" in features_wanted: + sources += ["embed/io/ble/stm32/ble.c"] + paths += ["embed/io/ble/inc"] + features_available.append("ble") + defines += [("USE_BLE", "1")] + sources += ["embed/io/nrf/stm32u5/nrf.c"] + sources += ["embed/io/nrf/crc8.c"] + paths += ["embed/io/nrf/inc"] sources += [ - "vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c" + "vendor/stm32u5xx_hal_driver/Src/stm32u5xx_hal_uart.c", + "vendor/stm32u5xx_hal_driver/Src/stm32u5xx_hal_uart_ex.c", ] if "optiga" in features_wanted: diff --git a/core/site_scons/models/T3W1/trezor_t3w1_revA0.py b/core/site_scons/models/T3W1/trezor_t3w1_revA0.py index 563e0f1328..77c8e1fce9 100644 --- a/core/site_scons/models/T3W1/trezor_t3w1_revA0.py +++ b/core/site_scons/models/T3W1/trezor_t3w1_revA0.py @@ -76,21 +76,17 @@ def configure( features_available.append("haptic") defines += ["USE_HAPTIC=1"] - # if "ble" in features_wanted: - # sources += ["embed/trezorhal/stm32f4/ble/ble_hal.c"] - # sources += ["embed/trezorhal/stm32f4/ble/dfu.c"] - # sources += ["embed/trezorhal/stm32f4/ble/fwu.c"] - # sources += ["embed/trezorhal/stm32f4/ble/ble.c"] - # sources += ["embed/trezorhal/stm32f4/ble/messages.c"] - # sources += [ - # "vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c" - # ] - # features_available.append("ble") - # defines += [("USE_BLE", "1")] - if "ble" in features_wanted: + sources += ["embed/io/ble/stm32/ble.c"] + paths += ["embed/io/ble/inc"] + features_available.append("ble") + defines += [("USE_BLE", "1")] + sources += ["embed/io/nrf/stm32u5/nrf.c"] + sources += ["embed/io/nrf/crc8.c"] + paths += ["embed/io/nrf/inc"] sources += [ - "vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c" + "vendor/stm32u5xx_hal_driver/Src/stm32u5xx_hal_uart.c", + "vendor/stm32u5xx_hal_driver/Src/stm32u5xx_hal_uart_ex.c", ] if "optiga" in features_wanted: