defunct: playing around with bootloaders
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "flash_partitions_128kb.dtsi"
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,code-partition = &slot0_partition;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Devicetree Overlay for 128KB Flash
|
||||
* - MCUboot Bootloader (32KB)
|
||||
* - Application Slot (96KB)
|
||||
*/
|
||||
|
||||
&flash0 {
|
||||
/delete-node/ partitions;
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
boot_partition: partition@0 {
|
||||
label = "mcuboot";
|
||||
reg = <0x00000000 DT_SIZE_K(32)>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
slot0_partition: partition@8000 {
|
||||
label = "image-0";
|
||||
reg = <0x00008000 DT_SIZE_K(96)>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/* Add retention memory to the existing SRAM node */
|
||||
&sram0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
retainedmem {
|
||||
compatible = "zephyr,retained-ram";
|
||||
status = "okay";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
boot_mode: retention@7f00 {
|
||||
compatible = "zephyr,retention";
|
||||
status = "okay";
|
||||
reg = <0x7f00 0x100>;
|
||||
prefix = [08 04];
|
||||
checksum = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,boot-mode = &boot_mode;
|
||||
zephyr,console = &cdc_acm_uart0;
|
||||
};
|
||||
};
|
||||
|
||||
&zephyr_udc0 {
|
||||
status = "okay";
|
||||
|
||||
cdc_acm_uart0: cdc_acm_uart0 {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
label = "CDC_ACM_0";
|
||||
};
|
||||
};
|
||||
46
software/apps/snippets/bootloader/sysbuild/mcuboot.conf
Normal file
46
software/apps/snippets/bootloader/sysbuild/mcuboot.conf
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# MCUboot Configuration for Serial Recovery over USB-CDC
|
||||
#
|
||||
|
||||
# Enables serial recovery mode in MCUboot.
|
||||
CONFIG_MCUBOOT_SERIAL=y
|
||||
|
||||
# Tell MCUboot to check for a trigger to enter recovery
|
||||
CONFIG_BOOT_SERIAL_BOOT_MODE=y
|
||||
|
||||
# --- USB Stack Configuration ---
|
||||
CONFIG_USB_DEVICE_STACK=y
|
||||
CONFIG_USB_DEVICE_PRODUCT="MCUboot Serial Recovery"
|
||||
|
||||
# Use USB CDC ACM for MCUboot serial recovery (not UART)
|
||||
CONFIG_BOOT_SERIAL_CDC_ACM=y
|
||||
|
||||
# --- Disable Zephyr Console to avoid conflicts ---
|
||||
# MCUboot's serial_adapter doesn't work well with the general console subsystem.
|
||||
CONFIG_UART_CONSOLE=n
|
||||
CONFIG_CONSOLE_HANDLER=n
|
||||
CONFIG_CONSOLE=n
|
||||
|
||||
# --- Flash and Stream Configuration (required for IMG_MANAGER) ---
|
||||
CONFIG_FLASH=y
|
||||
CONFIG_STREAM_FLASH=y
|
||||
|
||||
# --- mcumgr Configuration ---
|
||||
# MCUMGR requires NET_BUF, even for serial transport.
|
||||
CONFIG_NET_BUF=y
|
||||
CONFIG_NET_LOG=n
|
||||
|
||||
# Enables the mcumgr library and necessary command handlers
|
||||
CONFIG_MCUMGR=y
|
||||
CONFIG_IMG_MANAGER=y
|
||||
CONFIG_MCUMGR_GRP_IMG=y
|
||||
CONFIG_MCUMGR_GRP_OS=y
|
||||
|
||||
# --- Retention Configuration ---
|
||||
CONFIG_RETAINED_MEM=y
|
||||
CONFIG_RETENTION=y
|
||||
CONFIG_RETENTION_BOOT_MODE=y
|
||||
|
||||
# --- Optional: Reduce memory usage ---
|
||||
CONFIG_MAIN_STACK_SIZE=2048
|
||||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024
|
||||
17
software/apps/snippets/bootloader/sysbuild/mcuboot.overlay
Normal file
17
software/apps/snippets/bootloader/sysbuild/mcuboot.overlay
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "flash_partitions_128kb.dtsi"
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,code-partition = &boot_partition;
|
||||
zephyr,console = &cdc_acm_uart0;
|
||||
};
|
||||
};
|
||||
|
||||
&zephyr_udc0 {
|
||||
status = "okay";
|
||||
|
||||
cdc_acm_uart0: cdc_acm_uart0 {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
label = "CDC_ACM_0";
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user