mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-21 23:18:13 +00:00
chore(core): fix gen and style problems
[no changelog]
This commit is contained in:
parent
c5817bed6d
commit
10021bf364
@ -1 +1 @@
|
||||
Support interaction-less upgrade
|
||||
Support interaction-less upgrade
|
||||
|
@ -1 +1 @@
|
||||
Support interaction-less upgrade
|
||||
Support interaction-less upgrade
|
||||
|
@ -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
|
||||
// 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
|
||||
|
@ -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);
|
||||
|
@ -389,7 +389,7 @@ static uint32_t chunk_size = 0;
|
||||
|
||||
__attribute__((section(".buf"))) uint32_t chunk_buffer[IMAGE_CHUNK_SIZE / 4];
|
||||
|
||||
#define CHUNK_BUFFER_PTR ((const uint8_t *const) & chunk_buffer)
|
||||
#define CHUNK_BUFFER_PTR ((const uint8_t *const)&chunk_buffer)
|
||||
|
||||
/* we don't use secbool/sectrue/secfalse here as it is a nanopb api */
|
||||
static bool _read_payload(pb_istream_t *stream, const pb_field_t *field,
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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,30 +73,40 @@ 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 {
|
||||
title: Child::new(
|
||||
Label::left_aligned(title, text_title(bg_color)).vertically_centered(),
|
||||
),
|
||||
text: Child::new(
|
||||
Label::left_aligned(text, text_fingerprint(bg_color)).vertically_centered(),
|
||||
),
|
||||
info_button: Child::new(
|
||||
Button::with_icon(Icon::new(INFO32))
|
||||
.styled(menu_button)
|
||||
.with_expanded_touch_area(Insets::uniform(CORNER_BUTTON_TOUCH_EXPANSION)),
|
||||
),
|
||||
close_button: Child::new(
|
||||
Button::with_icon(Icon::new(X32))
|
||||
.styled(menu_button)
|
||||
.with_expanded_touch_area(Insets::uniform(CORNER_BUTTON_TOUCH_EXPANSION)),
|
||||
),
|
||||
}),
|
||||
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(self.bg_color)).vertically_centered(),
|
||||
),
|
||||
text: Child::new(
|
||||
Label::left_aligned(text, text_fingerprint(self.bg_color)).vertically_centered(),
|
||||
),
|
||||
info_button: Child::new(
|
||||
Button::with_icon(Icon::new(INFO32))
|
||||
.styled(menu_button)
|
||||
.with_expanded_touch_area(Insets::uniform(CORNER_BUTTON_TOUCH_EXPANSION)),
|
||||
),
|
||||
close_button: Child::new(
|
||||
Button::with_icon(Icon::new(X32))
|
||||
.styled(menu_button)
|
||||
.with_expanded_touch_area(Insets::uniform(CORNER_BUTTON_TOUCH_EXPANSION)),
|
||||
),
|
||||
});
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Component for Confirm<T>
|
||||
|
@ -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,
|
||||
theme::button_moreinfo(),
|
||||
ConfirmTitle::Text(title),
|
||||
msg,
|
||||
None,
|
||||
Some(("FW FINGERPRINT".into(), fingerprint)),
|
||||
))?;
|
||||
let obj = LayoutObj::new(
|
||||
Confirm::new(theme::BG, left, right, ConfirmTitle::Text(title), msg).with_info(
|
||||
"FW FINGERPRINT".into(),
|
||||
fingerprint,
|
||||
theme::button_moreinfo(),
|
||||
),
|
||||
)?;
|
||||
Ok(obj.into())
|
||||
};
|
||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||
|
@ -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
|
||||
@ -12,9 +11,8 @@ typedef enum {
|
||||
BOOT_COMMAND_INSTALL_UPGRADE = 0xFA4A5C8D,
|
||||
} boot_command_t;
|
||||
|
||||
// Maximum size of extra arguments passed to
|
||||
// Maximum size of extra arguments passed to
|
||||
// 'svc_reboot_to_bootloader()' function
|
||||
#define BOOT_ARGS_SIZE 256
|
||||
|
||||
|
||||
#endif // TREZORHAL_BOOT_ARGS_H
|
||||
#endif // TREZORHAL_BOOT_ARGS_H
|
||||
|
@ -51,8 +51,6 @@
|
||||
})
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void __attribute__((noreturn)) trezor_shutdown(void);
|
||||
|
||||
void __attribute__((noreturn))
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -46,4 +46,4 @@ UnlockPath.mac max_size:32
|
||||
|
||||
UnlockedPathRequest.mac max_size:32
|
||||
|
||||
RebootToBootloader.firmware_header type:FT_IGNORE
|
||||
RebootToBootloader.firmware_header type:FT_IGNORE
|
||||
|
@ -1 +1 @@
|
||||
trezorctl: Automatically go to bootloader when upgrading firmware
|
||||
trezorctl: Automatically go to bootloader when upgrading firmware
|
||||
|
Loading…
Reference in New Issue
Block a user