Commit 086510d7 authored by Jean Alinei's avatar Jean Alinei
Browse files

Initial commit with first working example of USB DFU for STM32G474RE

parent dfce0be6
/ {
soc {
usb: usb@40005c00 {
status = "okay";
};
};
chosen {
zephyr,code-partition = &boot_partition;
};
aliases {
bootloader-led0 = &green_led;
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x000000000 0x0000c000>;
read-only;
};
slot0_partition: partition@c000 {
label = "image-0";
reg = <0x0000c000 0x0003a000>;
};
slot1_partition: partition@46000 {
label = "image-1";
reg = <0x00046000 0x0003a000>;
};
};
};
......@@ -517,8 +517,14 @@ void main(void)
BOOT_LOG_ERR("Cannot enable USB");
} else {
BOOT_LOG_INF("Waiting for USB DFU");
#ifdef CONFIG_MCUBOOT_INDICATION_LED
gpio_pin_set(led, LED0_GPIO_PIN, 1);
#endif
wait_for_usb_dfu(K_MSEC(CONFIG_BOOT_USB_DFU_WAIT_DELAY_MS));
BOOT_LOG_INF("USB DFU wait time elapsed");
#ifdef CONFIG_MCUBOOT_INDICATION_LED
gpio_pin_set(led, LED0_GPIO_PIN, 0);
#endif
}
#endif
......
CONFIG_DEBUG=y
#Save some memory by disabling debugging
CONFIG_DEBUG=n
CONFIG_PM=n
CONFIG_MAIN_STACK_SIZE=10240
......@@ -12,6 +13,12 @@ CONFIG_BOOT_ENCRYPT_X25519=n
CONFIG_BOOT_UPGRADE_ONLY=n
CONFIG_BOOT_BOOTSTRAP=n
#Upgrade with swapping the memory partition without the need of scratch partition
CONFIG_BOOT_SWAP_USING_MOVE=y
#Turn LED on when waiting for USB DFU
CONFIG_MCUBOOT_INDICATION_LED=y
### mbedTLS has its own heap
# CONFIG_HEAP_MEM_POOL_SIZE is not set
......@@ -28,9 +35,16 @@ CONFIG_FLASH=y
# CONFIG_BT_CTLR is not set
# CONFIG_I2C is not set
CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y # former CONFIG_MODE_MINIMAL
### Ensure Zephyr logging changes don't use more resources
CONFIG_LOG_DEFAULT_LEVEL=0
### Decrease footprint by ~4 KB in comparison to CBPRINTF_COMPLETE=y
CONFIG_CBPRINTF_NANO=y
# USB
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="MCUBOOT"
CONFIG_USB_COMPOSITE_DEVICE=n
CONFIG_USB_MASS_STORAGE=n
# Enable USB Download Firmware Upgrade (DFU)
CONFIG_BOOT_USB_DFU_WAIT=y
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment