mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-07 14:00:57 +00:00
refactor(core): simplify ensure_compatible_settings
[no changelog]
This commit is contained in:
parent
c0e5bb0d67
commit
244c5a943d
@ -322,9 +322,7 @@ int main(void) {
|
|||||||
|
|
||||||
display_deinit(DISPLAY_JUMP_BEHAVIOR);
|
display_deinit(DISPLAY_JUMP_BEHAVIOR);
|
||||||
|
|
||||||
#ifdef ENSURE_COMPATIBLE_SETTINGS
|
|
||||||
ensure_compatible_settings();
|
ensure_compatible_settings();
|
||||||
#endif
|
|
||||||
|
|
||||||
mpu_reconfig(MPU_MODE_DISABLED);
|
mpu_reconfig(MPU_MODE_DISABLED);
|
||||||
|
|
||||||
|
@ -333,9 +333,7 @@ void real_jump_to_firmware(void) {
|
|||||||
|
|
||||||
display_deinit(DISPLAY_JUMP_BEHAVIOR);
|
display_deinit(DISPLAY_JUMP_BEHAVIOR);
|
||||||
|
|
||||||
#ifdef ENSURE_COMPATIBLE_SETTINGS
|
|
||||||
ensure_compatible_settings();
|
ensure_compatible_settings();
|
||||||
#endif
|
|
||||||
|
|
||||||
mpu_reconfig(MPU_MODE_DISABLED);
|
mpu_reconfig(MPU_MODE_DISABLED);
|
||||||
|
|
||||||
|
@ -55,11 +55,4 @@
|
|||||||
#define SD_ENABLE_PORT GPIOC
|
#define SD_ENABLE_PORT GPIOC
|
||||||
#define SD_ENABLE_PIN GPIO_PIN_0
|
#define SD_ENABLE_PIN GPIO_PIN_0
|
||||||
|
|
||||||
// Ensure compatible hardware settings before jumping to
|
|
||||||
// the different booting stage. This function is used to
|
|
||||||
// ensure backward compatibility with older versions of
|
|
||||||
// released bootloaders and firmware.
|
|
||||||
#define ENSURE_COMPATIBLE_SETTINGS
|
|
||||||
extern void ensure_compatible_settings(void);
|
|
||||||
|
|
||||||
#endif //_TREZOR_T_H
|
#endif //_TREZOR_T_H
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "startup_init.h"
|
|
||||||
|
|
||||||
void ensure_compatible_settings(void) {
|
|
||||||
// Early version of bootloader on T2T1 expects 168 MHz core clock.
|
|
||||||
// So we need to set it here before handover to the bootloader.
|
|
||||||
set_core_clock(CLOCK_168_MHZ);
|
|
||||||
}
|
|
@ -60,4 +60,12 @@ void memset_reg(volatile void *start, volatile void *stop, uint32_t val);
|
|||||||
// memory and registers that could contain sensitive information.
|
// memory and registers that could contain sensitive information.
|
||||||
void jump_to(uint32_t address);
|
void jump_to(uint32_t address);
|
||||||
|
|
||||||
|
// Ensure compatible hardware settings before jumping to
|
||||||
|
// the different booting stage. This function is used to
|
||||||
|
// ensure backward compatibility with older versions of
|
||||||
|
// released bootloaders and firmware.
|
||||||
|
//
|
||||||
|
// Does nothing on almost all platforms.
|
||||||
|
void ensure_compatible_settings(void);
|
||||||
|
|
||||||
#endif // TREZORHAL_BOOTUTILS_H
|
#endif // TREZORHAL_BOOTUTILS_H
|
||||||
|
@ -30,6 +30,10 @@
|
|||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "mpu.h"
|
#include "mpu.h"
|
||||||
|
|
||||||
|
#ifdef TREZOR_MODEL_T
|
||||||
|
#include "stm32f4/startup_init.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef KERNEL_MODE
|
#ifdef KERNEL_MODE
|
||||||
|
|
||||||
#ifdef STM32U5
|
#ifdef STM32U5
|
||||||
@ -153,9 +157,7 @@ reboot_with_args(boot_command_t command, const void* args, size_t args_size) {
|
|||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
#else
|
#else
|
||||||
display_deinit(DISPLAY_RESET_CONTENT);
|
display_deinit(DISPLAY_RESET_CONTENT);
|
||||||
#ifdef ENSURE_COMPATIBLE_SETTINGS
|
|
||||||
ensure_compatible_settings();
|
ensure_compatible_settings();
|
||||||
#endif
|
|
||||||
|
|
||||||
mpu_reconfig(MPU_MODE_DISABLED);
|
mpu_reconfig(MPU_MODE_DISABLED);
|
||||||
|
|
||||||
@ -201,4 +203,12 @@ void __attribute__((noreturn)) secure_shutdown(void) {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ensure_compatible_settings(void) {
|
||||||
|
#ifdef TREZOR_MODEL_T
|
||||||
|
// Early version of bootloader on T2T1 expects 168 MHz core clock.
|
||||||
|
// So we need to set it here before handover to the bootloader.
|
||||||
|
set_core_clock(CLOCK_168_MHZ);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif // KERNEL_MODE
|
#endif // KERNEL_MODE
|
||||||
|
@ -62,3 +62,7 @@ void __attribute__((noreturn)) secure_shutdown(void) {
|
|||||||
|
|
||||||
exit(3);
|
exit(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ensure_compatible_settings(void) {
|
||||||
|
// Left empty
|
||||||
|
}
|
||||||
|
@ -39,9 +39,6 @@ def configure(
|
|||||||
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
defines += [f'TREZOR_BOARD=\\"{board}\\"']
|
||||||
defines += [f"HW_MODEL={hw_model}"]
|
defines += [f"HW_MODEL={hw_model}"]
|
||||||
defines += [f"HW_REVISION={hw_revision}"]
|
defines += [f"HW_REVISION={hw_revision}"]
|
||||||
sources += [
|
|
||||||
"embed/models/T2T1/compat_settings.c",
|
|
||||||
]
|
|
||||||
|
|
||||||
if "new_rendering" in features_wanted:
|
if "new_rendering" in features_wanted:
|
||||||
sources += ["embed/trezorhal/xdisplay_legacy.c"]
|
sources += ["embed/trezorhal/xdisplay_legacy.c"]
|
||||||
|
Loading…
Reference in New Issue
Block a user