mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-04 11:51:50 +00:00
refactor(legacy): rename check_bootloader to check_and_replace_bootloader
This commit is contained in:
parent
ca5d173071
commit
e09a74a79e
@ -117,7 +117,7 @@ This table shows the result for bootloader 1.8.0+ and 1.9.1+:
|
|||||||
| ------------------------- | ----------------------- | ------------------------------ | ------------------------------------------------------------------------------------------ |
|
| ------------------------- | ----------------------- | ------------------------------ | ------------------------------------------------------------------------------------------ |
|
||||||
| 1 | 1 | yes | works, official configuration |
|
| 1 | 1 | yes | works, official configuration |
|
||||||
| 1 | 1 | no | hardfault in header.S when setting VTOR and stack |
|
| 1 | 1 | no | hardfault in header.S when setting VTOR and stack |
|
||||||
| 0 | 1 | no | works, but don't forget to comment out `check_bootloader`, otherwise it'll get overwritten |
|
| 0 | 1 | no | works, but don't forget to comment out `check_and_replace_bootloader`, otherwise it'll get overwritten |
|
||||||
| 0 | 0 | no | hard fault because header.S doesn't set VTOR and stack right |
|
| 0 | 0 | no | hard fault because header.S doesn't set VTOR and stack right |
|
||||||
| 1 | 0 | no | works |
|
| 1 | 0 | no | works |
|
||||||
|
|
||||||
|
@ -140,9 +140,9 @@ static int known_bootloader(int r, const uint8_t *hash) {
|
|||||||
* If bootloader is older and known, replace with newer bootloader.
|
* If bootloader is older and known, replace with newer bootloader.
|
||||||
* If bootloader is unknown, halt with error message.
|
* If bootloader is unknown, halt with error message.
|
||||||
*
|
*
|
||||||
* @param shutdown_on_success: if true, shuts down device instead of return
|
* @param shutdown_on_replace: if true, shuts down device instead of return
|
||||||
*/
|
*/
|
||||||
void check_bootloader(bool shutdown_on_success) {
|
void check_and_replace_bootloader(bool shutdown_on_replace) {
|
||||||
#if MEMORY_PROTECT
|
#if MEMORY_PROTECT
|
||||||
uint8_t hash[32] = {0};
|
uint8_t hash[32] = {0};
|
||||||
int r = memory_bootloader_hash(hash);
|
int r = memory_bootloader_hash(hash);
|
||||||
@ -190,7 +190,7 @@ void check_bootloader(bool shutdown_on_success) {
|
|||||||
// check whether the write was OK
|
// check whether the write was OK
|
||||||
r = memory_bootloader_hash(hash);
|
r = memory_bootloader_hash(hash);
|
||||||
if (r == 32 && 0 == memcmp(hash, bl_hash, 32)) {
|
if (r == 32 && 0 == memcmp(hash, bl_hash, 32)) {
|
||||||
if (shutdown_on_success) {
|
if (shutdown_on_replace) {
|
||||||
// OK -> show info and halt
|
// OK -> show info and halt
|
||||||
layoutDialog(&bmp_icon_info, NULL, NULL, NULL, _("Update finished"),
|
layoutDialog(&bmp_icon_info, NULL, NULL, NULL, _("Update finished"),
|
||||||
_("successfully."), NULL, _("Please reconnect"),
|
_("successfully."), NULL, _("Please reconnect"),
|
||||||
@ -207,5 +207,5 @@ void check_bootloader(bool shutdown_on_success) {
|
|||||||
shutdown();
|
shutdown();
|
||||||
#endif
|
#endif
|
||||||
// prevent compiler warning when MEMORY_PROTECT==0
|
// prevent compiler warning when MEMORY_PROTECT==0
|
||||||
(void)shutdown_on_success;
|
(void)shutdown_on_replace;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,6 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
void check_bootloader(bool shutdown_on_success);
|
void check_and_replace_bootloader(bool shutdown_on_replace);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -123,7 +123,7 @@ int main(void) {
|
|||||||
// unpredictable stack protection checks
|
// unpredictable stack protection checks
|
||||||
oledInit();
|
oledInit();
|
||||||
#else
|
#else
|
||||||
check_bootloader(true);
|
check_and_replace_bootloader(true);
|
||||||
setupApp();
|
setupApp();
|
||||||
__stack_chk_guard = random32(); // this supports compiler provided
|
__stack_chk_guard = random32(); // this supports compiler provided
|
||||||
// unpredictable stack protection checks
|
// unpredictable stack protection checks
|
||||||
|
1
legacy/intermediate_fw/.gitignore
vendored
Normal file
1
legacy/intermediate_fw/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
bl_data.h
|
@ -112,7 +112,7 @@ int main(void) {
|
|||||||
|
|
||||||
mpu_config_off(); // needed for flash writable, RAM RWX
|
mpu_config_off(); // needed for flash writable, RAM RWX
|
||||||
timer_init();
|
timer_init();
|
||||||
check_bootloader(false);
|
check_and_replace_bootloader(false);
|
||||||
|
|
||||||
layoutDialog(&bmp_icon_warning, NULL, NULL, NULL, "Erasing old data", NULL,
|
layoutDialog(&bmp_icon_warning, NULL, NULL, NULL, "Erasing old data", NULL,
|
||||||
NULL, "DO NOT UNPLUG", "YOUR TREZOR!", NULL);
|
NULL, "DO NOT UNPLUG", "YOUR TREZOR!", NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user