diff --git a/core/SConscript.bootloader_emu b/core/SConscript.bootloader_emu index 4df11a6d10..af36760f74 100644 --- a/core/SConscript.bootloader_emu +++ b/core/SConscript.bootloader_emu @@ -136,6 +136,7 @@ if TREZOR_MODEL in ('R', ): ] SOURCE_TREZORHAL += [ 'embed/trezorhal/unix/secret.c', + 'embed/trezorhal/unix/optiga_hal.c', ] SOURCE_UNIX = [ diff --git a/core/embed/bootloader/main.c b/core/embed/bootloader/main.c index 95cb79e598..fd6a6e5d45 100644 --- a/core/embed/bootloader/main.c +++ b/core/embed/bootloader/main.c @@ -35,6 +35,9 @@ #ifdef USE_I2C #include "i2c.h" #endif +#ifdef USE_OPTIGA +#include "optiga_hal.h" +#endif #ifdef USE_TOUCH #include "touch.h" #endif @@ -452,6 +455,10 @@ int bootloader_main(void) { i2c_init(); #endif +#ifdef USE_OPTIGA + optiga_hal_init(); +#endif + #ifdef USE_TOUCH touch_power_on(); touch_init(); diff --git a/core/embed/trezorhal/stm32f4/optiga_hal.c b/core/embed/trezorhal/stm32f4/optiga_hal.c index 2f3164402b..0a3f92acb2 100644 --- a/core/embed/trezorhal/stm32f4/optiga_hal.c +++ b/core/embed/trezorhal/stm32f4/optiga_hal.c @@ -11,6 +11,9 @@ void optiga_hal_init(void) { GPIO_InitStructure.Alternate = 0; GPIO_InitStructure.Pin = GPIO_PIN_9; HAL_GPIO_Init(GPIOD, &GPIO_InitStructure); + // perform reset on every initialization + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_9, GPIO_PIN_RESET); + hal_delay(10); HAL_GPIO_WritePin(GPIOD, GPIO_PIN_9, GPIO_PIN_SET); // warm reset startup time min 15ms hal_delay(20); diff --git a/core/embed/trezorhal/unix/optiga_hal.c b/core/embed/trezorhal/unix/optiga_hal.c new file mode 100644 index 0000000000..9bf346f028 --- /dev/null +++ b/core/embed/trezorhal/unix/optiga_hal.c @@ -0,0 +1,26 @@ +/* + * This file is part of the Trezor project, https://trezor.io/ + * + * Copyright (c) SatoshiLabs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +void optiga_hal_init(void) { + // nothing to do +} + +void optiga_reset(void) { + // nothing to do +}