1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

chore(core): fix gen and style problems

[no changelog]
This commit is contained in:
tychovrahe 2023-10-31 10:34:54 +01:00 committed by matejcik
parent c5817bed6d
commit 10021bf364
14 changed files with 54 additions and 69 deletions

View File

@ -1,8 +1,8 @@
#ifndef BOOT_INTERNAL_H
#define BOOT_INTERNAL_H
#include <stdint.h>
#include <boot_args.h>
#include <stdint.h>
// The 'g_boot_command' variable stores the 'command' passed to the
// function 'svc_reboot_to_bootloader()'. It may be one of the
@ -12,10 +12,8 @@
// just powered up. The variable is set before the main() is called.
extern boot_command_t g_boot_command;
// The 'g_boot_args' array stores extra arguments passed
// function 'svc_reboot_to_bootloader()'
extern uint8_t g_boot_args[BOOT_ARGS_SIZE];
#endif // BOOT_INTERNAL_H

View File

@ -24,7 +24,6 @@ boot_command_t g_boot_command = BOOT_COMMAND_NONE;
// Simulation of a boot args normally sitting at the BOOT_ARGS region
uint8_t g_boot_args[BOOT_ARGS_SIZE];
void set_core_clock(int) {}
int bootloader_main(void);

View File

@ -176,17 +176,16 @@ extern "C" fn screen_install_confirm(
(l, r)
};
let mut frame = Confirm::new(
BLD_BG,
left,
right,
let mut frame = Confirm::new(BLD_BG, left, right, ConfirmTitle::Text(title), msg).with_info(
"FW FINGERPRINT",
fingerprint_str,
button_bld_menu(),
ConfirmTitle::Text(title),
msg,
alert,
Some(("FW FINGERPRINT", fingerprint_str)),
);
if let Some(alert) = alert {
frame = frame.with_alert(alert);
}
run(&mut frame)
}
@ -203,16 +202,8 @@ extern "C" fn screen_wipe_confirm() -> u32 {
let right = Button::with_text("RESET").styled(button_wipe_confirm());
let left = Button::with_text("CANCEL").styled(button_wipe_cancel());
let mut frame = Confirm::new(
BLD_WIPE_COLOR,
left,
right,
button_bld_menu(),
ConfirmTitle::Icon(icon),
msg,
Some(alert),
None,
);
let mut frame =
Confirm::new(BLD_WIPE_COLOR, left, right, ConfirmTitle::Icon(icon), msg).with_alert(alert);
run(&mut frame)
}

View File

@ -64,11 +64,8 @@ where
bg_color: Color,
left_button: Button<&'static str>,
right_button: Button<&'static str>,
menu_button: ButtonStyleSheet,
title: ConfirmTitle<T>,
message: Label<T>,
alert: Option<Label<T>>,
info: Option<(T, T)>,
) -> Self {
Self {
bg: Pad::with_background(bg_color).with_clear(),
@ -76,15 +73,26 @@ where
bg_color,
title,
message: Child::new(message.vertically_centered()),
alert: alert.map(|alert| Child::new(alert.vertically_centered())),
left_button: Child::new(left_button),
right_button: Child::new(right_button),
info: info.map(|(title, text)| ConfirmInfo {
alert: None,
info: None,
show_info: false,
}
}
pub fn with_alert(mut self, alert: Label<T>) -> Self {
self.alert = Some(Child::new(alert.vertically_centered()));
self
}
pub fn with_info(mut self, title: T, text: T, menu_button: ButtonStyleSheet) -> Self {
self.info = Some(ConfirmInfo {
title: Child::new(
Label::left_aligned(title, text_title(bg_color)).vertically_centered(),
Label::left_aligned(title, text_title(self.bg_color)).vertically_centered(),
),
text: Child::new(
Label::left_aligned(text, text_fingerprint(bg_color)).vertically_centered(),
Label::left_aligned(text, text_fingerprint(self.bg_color)).vertically_centered(),
),
info_button: Child::new(
Button::with_icon(Icon::new(INFO32))
@ -96,9 +104,8 @@ where
.styled(menu_button)
.with_expanded_touch_area(Insets::uniform(CORNER_BUTTON_TOUCH_EXPANSION)),
),
}),
show_info: false,
}
});
self
}
}

View File

@ -1616,16 +1616,13 @@ extern "C" fn new_confirm_firmware_update(
let left = Button::with_text("CANCEL").styled(theme::button_default());
let right = Button::with_text("INSTALL").styled(theme::button_confirm());
let obj = LayoutObj::new(Confirm::new(
theme::BG,
left,
right,
let obj = LayoutObj::new(
Confirm::new(theme::BG, left, right, ConfirmTitle::Text(title), msg).with_info(
"FW FINGERPRINT".into(),
fingerprint,
theme::button_moreinfo(),
ConfirmTitle::Text(title),
msg,
None,
Some(("FW FINGERPRINT".into(), fingerprint)),
))?;
),
)?;
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }

View File

@ -1,7 +1,6 @@
#ifndef TREZORHAL_BOOT_ARGS_H
#define TREZORHAL_BOOT_ARGS_H
// Defines boot command for 'svc_reboot_to_bootloader()' function
typedef enum {
// Normal boot sequence
@ -16,5 +15,4 @@ typedef enum {
// 'svc_reboot_to_bootloader()' function
#define BOOT_ARGS_SIZE 256
#endif // TREZORHAL_BOOT_ARGS_H

View File

@ -51,8 +51,6 @@
})
#endif
void __attribute__((noreturn)) trezor_shutdown(void);
void __attribute__((noreturn))

View File

@ -8,10 +8,8 @@
#ifdef ARM_USER_MODE
// Saves extra parameters for the bootloader
static void _copy_boot_args(const void *args, size_t args_size) {
// symbols imported from the linker script
extern uint8_t boot_args_start;
extern uint8_t boot_args_end;

View File

@ -92,7 +92,6 @@ def check_firmware_header(
Checks firmware image and vendor header and returns
{ "version": (major, minor, patch),
"vendor": string,
"full_trust": bool,
"fingerprint": bytes,
"hash": bytes
}