mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 12:00:59 +00:00
feat(ble): integrate MCU boot into trezor-ble app, add stay in bootloader pin
[no changelog]
This commit is contained in:
parent
2dbdd0b909
commit
2b030aeec1
@ -27,28 +27,24 @@
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
led0: led_0 {
|
||||
gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
|
||||
gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
|
||||
label = "Green LED 0";
|
||||
};
|
||||
led1: led_1 {
|
||||
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
|
||||
gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
|
||||
label = "Green LED 1";
|
||||
};
|
||||
out0: out_0 {
|
||||
gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
|
||||
label = "FW Running";
|
||||
};
|
||||
};
|
||||
|
||||
buttons {
|
||||
compatible = "gpio-keys";
|
||||
button0: button_0 {
|
||||
gpios = <&gpio0 27 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
|
||||
gpios = <&gpio0 14 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
|
||||
label = "Push button switch 0";
|
||||
zephyr,code = <INPUT_KEY_0>;
|
||||
};
|
||||
trezor_ready: trezor_ready {
|
||||
gpios = <&gpio0 29 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
|
||||
gpios = <&gpio0 29 ( GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
|
||||
label = "Trezor ready";
|
||||
zephyr,code = <INPUT_KEY_1>;
|
||||
};
|
||||
@ -59,9 +55,8 @@
|
||||
led0 = &led0;
|
||||
led1 = &led1;
|
||||
sw0 = &button0;
|
||||
bootloader-led0 = &led0;
|
||||
bootloader-botton0 = &button0;
|
||||
mcuboot-button0 = &button0;
|
||||
mcuboot-led0 = &led0;
|
||||
watchdog0 = &wdt0;
|
||||
};
|
||||
};
|
||||
@ -118,11 +113,7 @@
|
||||
};
|
||||
slot0_partition: partition@c000 {
|
||||
label = "image-0";
|
||||
reg = <0x0000C000 0x37000>;
|
||||
};
|
||||
slot1_partition: partition@43000 {
|
||||
label = "image-1";
|
||||
reg = <0x00043000 0x37000>;
|
||||
reg = <0x0000C000 0x7A000>;
|
||||
};
|
||||
storage_partition: partition@7a000 {
|
||||
label = "storage";
|
||||
|
@ -18,6 +18,7 @@ CONFIG_BOOT_SERIAL_UART=y
|
||||
#CONFIG_MCUMGR_SMP_UART=y
|
||||
CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP=y
|
||||
CONFIG_SINGLE_APPLICATION_SLOT=y
|
||||
CONFIG_BOOT_VALIDATE_SLOT0=y
|
||||
|
||||
CONFIG_RTT_CONSOLE=y
|
||||
CONFIG_USE_SEGGER_RTT=y
|
||||
|
@ -89,3 +89,16 @@ CONFIG_LOG_PRINTK=n
|
||||
|
||||
CONFIG_NANOPB=n
|
||||
CONFIG_ASSERT=y
|
||||
|
||||
|
||||
# bootloader
|
||||
#CONFIG_SECURE_BOOT=y
|
||||
CONFIG_BOOTLOADER_MCUBOOT=y
|
||||
#CONFIG_SB_SIGNING_OPENSSL=y
|
||||
#CONFIG_SB_SIGNING_KEY_FILE="/home/ondro/work/satoshilabs/repos/ncs/mcuboot_priv.pem"
|
||||
#CONFIG_SB_SIGNING_KEY_FILE="/home/ondro/work/satoshilabs/repos/ncs/mcuboot_priv.pem"
|
||||
#CONFIG_SB_PUBLIC_KEY_FILES="/home/ondro/work/satoshilabs/repos/ncs/mcuboot_pub.pem"
|
||||
#CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="/home/ondro/work/satoshilabs/repos/ncs/mcuboot_priv.pem"
|
||||
#CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="/home/ondro/work/satoshilabs/repos/ncs/mcuboot_priv.pem"
|
||||
#CONFIG_BOOT_SIGNATURE_KEY_FILE="/home/ondro/work/satoshilabs/repos/ncs/mcuboot_priv.pem"
|
||||
CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP=y
|
||||
|
@ -46,8 +46,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
||||
#define RUN_STATUS_LED DK_LED1
|
||||
#define RUN_LED_BLINK_INTERVAL 1000
|
||||
|
||||
#define FW_RUNNING_SIG DK_LED3
|
||||
#define CON_STATUS_LED DK_LED2
|
||||
#define FW_RUNNING_SIG DK_LED2
|
||||
|
||||
static K_SEM_DEFINE(ble_init_ok, 0, 1);
|
||||
static K_SEM_DEFINE(led_init_ok, 0, 1);
|
||||
@ -231,7 +230,7 @@ void ble_write_thread(void) {
|
||||
}
|
||||
|
||||
void led_thread(void) {
|
||||
bool connected = false;
|
||||
// bool connected = false;
|
||||
int blink_status = 0;
|
||||
/* Don't go any further until BLE is initialized */
|
||||
k_sem_take(&led_init_ok, K_FOREVER);
|
||||
@ -240,17 +239,17 @@ void led_thread(void) {
|
||||
blink_status++;
|
||||
dk_set_led(RUN_STATUS_LED, (blink_status) % 2);
|
||||
|
||||
connected = is_connected();
|
||||
|
||||
if (connected) {
|
||||
dk_set_led_on(CON_STATUS_LED);
|
||||
} else {
|
||||
if (is_advertising() && !is_advertising_whitelist()) {
|
||||
dk_set_led(CON_STATUS_LED, (blink_status) % 2);
|
||||
} else {
|
||||
dk_set_led_off(CON_STATUS_LED);
|
||||
}
|
||||
}
|
||||
// connected = is_connected();
|
||||
//
|
||||
// if (connected) {
|
||||
// dk_set_led_on(CON_STATUS_LED);
|
||||
// } else {
|
||||
// if (is_advertising() && !is_advertising_whitelist()) {
|
||||
// dk_set_led(CON_STATUS_LED, (blink_status) % 2);
|
||||
// } else {
|
||||
// dk_set_led_off(CON_STATUS_LED);
|
||||
// }
|
||||
// }
|
||||
|
||||
k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL));
|
||||
}
|
||||
|
@ -15,7 +15,3 @@ manifest:
|
||||
repo-path: sdk-nrf
|
||||
revision: v2.7.0
|
||||
import: true
|
||||
- name: mcuboot
|
||||
url: https://github.com/hiviah/mcuboot
|
||||
path: bootloader/mcuboot
|
||||
revision: edfe1e1465dbc698bf9a195816247913490ab391
|
||||
|
Loading…
Reference in New Issue
Block a user