mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-26 01:42:34 +00:00
Build T3W1 zephyr+NCS with mcuboot bootloader, mcumgr serial recovery
Currently this will enter bootloader recovery due some pin To build with bootloader without serial recovery so application runs: west build -b t3w1_nrf52833 testapp3 -- -Dmcuboot_OVERLAY_CONFIG=/home/ondro/work/satoshilabs/repos/ncs/testapp3/mcuboot.conf.without_serial_recovery Build with serial recovery (gets stuck in bootloader serial recovery): west build -b t3w1_nrf52833 testapp3 -- -Dmcuboot_OVERLAY_CONFIG=/home/ondro/work/satoshilabs/repos/ncs/testapp3/mcuboot.conf
This commit is contained in:
parent
8354eab2a9
commit
6ac9f7c1e5
@ -336,6 +336,7 @@ flash_bootloader_ci_jlink: $(BOOTLOADER_CI_BUILD_DIR)/bootloader.bin ## flash CI
|
|||||||
flash_firmware_jlink: $(FIRMWARE_BUILD_DIR)/firmware.bin ## flash firmware using JLink. file names must end in .bin for JLink
|
flash_firmware_jlink: $(FIRMWARE_BUILD_DIR)/firmware.bin ## flash firmware using JLink. file names must end in .bin for JLink
|
||||||
cp -f $<.p1 $<.p1.bin
|
cp -f $<.p1 $<.p1.bin
|
||||||
cp -f $<.p2 $<.p2.bin
|
cp -f $<.p2 $<.p2.bin
|
||||||
|
truncate -s $(FIRMWARE_P2_MAXSIZE) $<.p2.bin
|
||||||
JLinkExe -nogui 1 -commanderscript embed/firmware/firmware_flash.jlink
|
JLinkExe -nogui 1 -commanderscript embed/firmware/firmware_flash.jlink
|
||||||
|
|
||||||
flash_firmware_t1_jlink: $(FIRMWARE_BUILD_DIR)/firmware.bin ## flash T1 core port via JLink
|
flash_firmware_t1_jlink: $(FIRMWARE_BUILD_DIR)/firmware.bin ## flash T1 core port via JLink
|
||||||
|
26
core/embed/ble_zephyr_fw/BUILD.md
Normal file
26
core/embed/ble_zephyr_fw/BUILD.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
## Build in the directory above `testapp`
|
||||||
|
west -v build -b t3w1_nrf52833 testapp3 -- -Dmcuboot_OVERLAY_CONFIG=/home/ondro/work/satoshilabs/repos/ncs/testapp3/mcuboot.conf
|
||||||
|
|
||||||
|
## Nobody know WTF this is what it wants
|
||||||
|
warning: The choice symbol MCUBOOT_BOOTLOADER_MODE_SINGLE_APP (defined at
|
||||||
|
modules/Kconfig.mcuboot:149) was selected (set =y), but no symbol ended up as the choice selection.
|
||||||
|
See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP
|
||||||
|
and/or look up MCUBOOT_BOOTLOADER_MODE_SINGLE_APP in the menuconfig/guiconfig interface. The
|
||||||
|
|
||||||
|
### update via mcumgr boha jeho
|
||||||
|
|
||||||
|
List slots:
|
||||||
|
|
||||||
|
/home/ondro/work/satoshilabs/repos/ncs/mcumgr-client/target/debug/mcumgr-client -d /dev/ttyUSB0 -v list
|
||||||
|
|
||||||
|
Updated signed app upload - works, needs reset
|
||||||
|
|
||||||
|
/home/ondro/work/satoshilabs/repos/ncs/mcumgr-client/target/debug/mcumgr-client -d /dev/ttyUSB0 -s 0 upload build/zephyr/app_update.bin
|
||||||
|
/home/ondro/work/satoshilabs/repos/ncs/mcumgr-client/target/debug/mcumgr-client -d /dev/ttyUSB0 reset
|
||||||
|
|
||||||
|
Other baudrate:
|
||||||
|
|
||||||
|
/home/ondro/work/satoshilabs/repos/ncs/mcumgr-client/target/debug/mcumgr-client -d /dev/ttyUSB0 -s 0 -b 460800 upload build/zephyr/app_update.bin
|
||||||
|
/home/ondro/work/satoshilabs/repos/ncs/mcumgr-client/target/debug/mcumgr-client -d /dev/ttyUSB0 -b 460800 reset
|
||||||
|
/home/ondro/work/satoshilabs/repos/ncs/mcumgr-client/target/debug/mcumgr-client -d /dev/ttyUSB0 -b 460800 -v list
|
||||||
|
|
@ -125,11 +125,7 @@
|
|||||||
};
|
};
|
||||||
slot0_partition: partition@c000 {
|
slot0_partition: partition@c000 {
|
||||||
label = "image-0";
|
label = "image-0";
|
||||||
reg = <0x0000C000 0x37000>;
|
reg = <0x0000C000 0x7A000>;
|
||||||
};
|
|
||||||
slot1_partition: partition@43000 {
|
|
||||||
label = "image-1";
|
|
||||||
reg = <0x00043000 0x37000>;
|
|
||||||
};
|
};
|
||||||
storage_partition: partition@7a000 {
|
storage_partition: partition@7a000 {
|
||||||
label = "storage";
|
label = "storage";
|
||||||
|
25
core/embed/ble_zephyr_fw/mcuboot.conf
Normal file
25
core/embed/ble_zephyr_fw/mcuboot.conf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000
|
||||||
|
|
||||||
|
CONFIG_SERIAL=y
|
||||||
|
CONFIG_UART_LINE_CTRL=y
|
||||||
|
CONFIG_UART_NRFX=y
|
||||||
|
#CONFIG_UART_INTERRUPT_DRIVEN=n
|
||||||
|
|
||||||
|
# MCUBoot serial
|
||||||
|
CONFIG_GPIO=y
|
||||||
|
CONFIG_GPIO_NRFX_INTERRUPT=n
|
||||||
|
CONFIG_MCUBOOT_SERIAL=y
|
||||||
|
CONFIG_BOOT_SERIAL_CDC_ACM=y
|
||||||
|
CONFIG_BOOT_SERIAL_UART=y
|
||||||
|
|
||||||
|
#CONFIG_LOG_BACKEND_UART=y
|
||||||
|
|
||||||
|
#CONFIG_BOOT_SERIAL_DETECT_PIN=11
|
||||||
|
#CONFIG_MCUMGR_SMP_UART=y
|
||||||
|
CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP=y
|
||||||
|
CONFIG_SINGLE_APPLICATION_SLOT=y
|
||||||
|
|
||||||
|
CONFIG_RTT_CONSOLE=y
|
||||||
|
CONFIG_USE_SEGGER_RTT=y
|
||||||
|
CONFIG_UART_CONSOLE=n
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
#CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000
|
||||||
|
|
||||||
|
#CONFIG_SERIAL=y
|
||||||
|
#CONFIG_UART_LINE_CTRL=y
|
||||||
|
#CONFIG_UART_NRFX=y
|
||||||
|
#CONFIG_UART_INTERRUPT_DRIVEN=n
|
||||||
|
|
||||||
|
# MCUBoot serial
|
||||||
|
CONFIG_GPIO=y
|
||||||
|
CONFIG_GPIO_NRFX_INTERRUPT=n
|
||||||
|
#CONFIG_MCUBOOT_SERIAL=y
|
||||||
|
#CONFIG_BOOT_SERIAL_CDC_ACM=y
|
||||||
|
#CONFIG_BOOT_SERIAL_UART=y
|
||||||
|
|
||||||
|
#CONFIG_LOG_BACKEND_UART=y
|
||||||
|
|
||||||
|
#CONFIG_BOOT_SERIAL_DETECT_PIN=11
|
||||||
|
#CONFIG_MCUMGR_SMP_UART=y
|
||||||
|
CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP=y
|
||||||
|
CONFIG_SINGLE_APPLICATION_SLOT=y
|
||||||
|
|
||||||
|
CONFIG_RTT_CONSOLE=y
|
||||||
|
CONFIG_USE_SEGGER_RTT=y
|
||||||
|
CONFIG_UART_CONSOLE=n
|
||||||
|
|
26
core/embed/ble_zephyr_fw/pm_static.yml
Normal file
26
core/embed/ble_zephyr_fw/pm_static.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
mcuboot:
|
||||||
|
address: 0x0
|
||||||
|
size: 0xc000
|
||||||
|
mcuboot_pad:
|
||||||
|
address: 0xc000
|
||||||
|
size: 0x200
|
||||||
|
app:
|
||||||
|
address: 0x10200
|
||||||
|
size: 0x6de00
|
||||||
|
mcuboot_primary:
|
||||||
|
orig_span: &id001
|
||||||
|
- mcuboot_pad
|
||||||
|
- app
|
||||||
|
span: *id001
|
||||||
|
address: 0xc000
|
||||||
|
size: 0x6e000
|
||||||
|
mcuboot_primary_app:
|
||||||
|
orig_span: &id002
|
||||||
|
- app
|
||||||
|
span: *id002
|
||||||
|
address: 0x10200
|
||||||
|
size: 0x6de00
|
||||||
|
settings_storage:
|
||||||
|
address: 0x7e000
|
||||||
|
size: 0x2000
|
||||||
|
|
@ -38,6 +38,7 @@ CONFIG_BT_FILTER_ACCEPT_LIST=y
|
|||||||
CONFIG_BT_BONDING_REQUIRED=y
|
CONFIG_BT_BONDING_REQUIRED=y
|
||||||
CONFIG_BT_PRIVACY=y
|
CONFIG_BT_PRIVACY=y
|
||||||
CONFIG_BT_TINYCRYPT_ECC=y
|
CONFIG_BT_TINYCRYPT_ECC=y
|
||||||
|
#CONFIG_BT_LL_SW_SPLIT=n
|
||||||
CONFIG_BT_LL_SW_SPLIT=y
|
CONFIG_BT_LL_SW_SPLIT=y
|
||||||
|
|
||||||
#CONFIG_BT_DEBUG_SMP=y
|
#CONFIG_BT_DEBUG_SMP=y
|
||||||
@ -93,6 +94,75 @@ CONFIG_UART_CONSOLE=n
|
|||||||
CONFIG_USE_SEGGER_RTT=y
|
CONFIG_USE_SEGGER_RTT=y
|
||||||
CONFIG_LOG_BACKEND_RTT=y
|
CONFIG_LOG_BACKEND_RTT=y
|
||||||
CONFIG_LOG_BACKEND_UART=n
|
CONFIG_LOG_BACKEND_UART=n
|
||||||
CONFIG_LOG_PRINTK=n
|
CONFIG_LOG_PRINTK=y
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL=3
|
||||||
|
|
||||||
CONFIG_ASSERT=y
|
CONFIG_ASSERT=y
|
||||||
|
|
||||||
|
# debug
|
||||||
|
#CONFIG_THREAD_NAME=y
|
||||||
|
#CONFIG_THREAD_ANALYZER=y
|
||||||
|
#CONFIG_THREAD_ANALYZER_AUTO=y
|
||||||
|
#CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
|
||||||
|
#CONFIG_THREAD_ANALYZER_USE_PRINTK=y
|
||||||
|
#CONFIG_CONSOLE=y
|
||||||
|
#CONFIG_USE_SEGGER_RTT=y
|
||||||
|
#CONFIG_CONSOLE=y
|
||||||
|
#CONFIG_UART_CONSOLE=y
|
||||||
|
#CONFIG_RTT_CONSOLE=y
|
||||||
|
#CONFIG_SEGGER_DEBUGMON=y
|
||||||
|
#CONFIG_LOG_MODE_DEFERRED=y
|
||||||
|
#CONFIG_SETTINGS=y
|
||||||
|
#CONFIG_FLASH_MAP=y
|
||||||
|
|
||||||
|
#Optimization
|
||||||
|
CONFIG_DEBUG_OPTIMIZATIONS=y
|
||||||
|
CONFIG_COMPILER_OPT="-ggdb3 -g3"
|
||||||
|
|
||||||
|
|
||||||
|
CONFIG_THREAD_NAME=y
|
||||||
|
CONFIG_THREAD_MONITOR=y
|
||||||
|
CONFIG_CORTEX_M_DEBUG_MONITOR_HOOK=y
|
||||||
|
CONFIG_SEGGER_DEBUGMON=y
|
||||||
|
|
||||||
|
#thread view
|
||||||
|
#CONFIG_THREAD_ANALYZER=y
|
||||||
|
#CONFIG_THREAD_ANALYZER_AUTO=y
|
||||||
|
#CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
|
||||||
|
#CONFIG_THREAD_ANALYZER_USE_PRINTK=y
|
||||||
|
#not needed for single core
|
||||||
|
#CONFIG_SCHED_CPU_MASK=y
|
||||||
|
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
# NCS docs said you need to have this, but nope, you don't. It's PoS the whole SDK
|
||||||
|
#CONFIG_MCUMGR=y
|
||||||
|
#CONFIG_NET_BUF=y
|
||||||
|
#CONFIG_ZCBOR=y
|
||||||
|
#CONFIG_CRC=y
|
||||||
|
#CONFIG_STREAM_FLASH=y
|
||||||
|
#CONFIG_FLASH_MAP=y
|
||||||
|
|
||||||
|
# Enable most core commands.
|
||||||
|
#CONFIG_IMG_MANAGER=y
|
||||||
|
#CONFIG_MCUMGR_GRP_IMG=y
|
||||||
|
#CONFIG_MCUMGR_GRP_OS=y
|
||||||
|
|
||||||
|
# Enable the serial mcumgr transport.
|
||||||
|
#CONFIG_MCUMGR_TRANSPORT_UART=y
|
||||||
|
#CONFIG_BASE64=y
|
||||||
|
CONFIG_CONSOLE=n
|
||||||
|
|
||||||
|
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
|||||||
#define UART_WAIT_FOR_BUF_DELAY K_MSEC(50)
|
#define UART_WAIT_FOR_BUF_DELAY K_MSEC(50)
|
||||||
#define UART_WAIT_FOR_RX CONFIG_BT_NUS_UART_RX_WAIT_TIME
|
#define UART_WAIT_FOR_RX CONFIG_BT_NUS_UART_RX_WAIT_TIME
|
||||||
|
|
||||||
static const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uart));
|
const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uart));
|
||||||
|
|
||||||
static K_FIFO_DEFINE(fifo_uart_tx_data);
|
static K_FIFO_DEFINE(fifo_uart_tx_data);
|
||||||
static K_FIFO_DEFINE(fifo_uart_rx_data);
|
static K_FIFO_DEFINE(fifo_uart_rx_data);
|
||||||
@ -274,8 +274,8 @@ int uart_init(void)
|
|||||||
|
|
||||||
err = uart_callback_set(uart, uart_cb, NULL);
|
err = uart_callback_set(uart, uart_cb, NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
LOG_ERR("Cannot initialize UART callback (err: %d) FF", err);
|
||||||
k_free(rx);
|
k_free(rx);
|
||||||
LOG_ERR("Cannot initialize UART callback");
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3284
poetry.lock
generated
3284
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user