zephyr: STM32WBA52 bootloader cannot jump to application code.

Describe the bug STM32WBA cannot jump to application code, on the same bootloader and application code, but stm32f429 can jump to application and working.

To Reproduce Steps to reproduce the behavior:

  1. Flash partitions in the dts file:
&flash0 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;
		 boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 DT_SIZE_K(64)>;
		};
		/* storage: 64KB for settings */
		storage_partition: partition@10000 {
			label = "storage";
			reg = <0x00010000 DT_SIZE_K(64)>;
		};
		slot0_partition: partition@20000 {
			label = "image-0";
			reg = <0x00020000 DT_SIZE_K(256)>;
		};
		slot1_partition: partition@60000 {
			label = "image-1";
			reg = <0x00060000 DT_SIZE_K(256)>;
		};
 		scratch_partition: partition@A0000 {
			label = "image-scratch";
			reg = <0x000A0000 DT_SIZE_K(16)>;
		};
	};
};
  1. Go to the ./zephyrproject/bootloader/mcuboot/boot/zephyr, added stm32wba52_board.conf file CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_BOOT_MAX_IMG_SECTORS=128
  2. Building mcuboot. west build -b stm32wba52_board -p
  3. Flashing the mcuboot. west flash
  4. Go to the application path, added CONFIG_BOOTLOADER_MCUBOOT=y in the stm32wba52_board.conf file.
  5. Building Application west build -b stm32wba52_board -p
  6. Sign application code west sign -t imgtool -- --key root-rsa-2048.pem
  7. Flash Application west flash --file build/zephyr/zephyr.signed.hex

Expected behavior After a reset, mcuboot finds the signed binary in the image slot and jumps into it for running the application.

Experienced behavior STM32WBA bootloader cannot jump to application code. I have used wese debug to debug the bootloader code. It has into do_boot() and jumping address is correct but cannot into application code.

Log as following:

*** Booting Zephyr OS build v3.6.0 ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: primary slot
I: Image index: 0, Swap type: none
I: Bootloader chainload address offset: 0x20000
I: Jumping to the first image slot

Impact We have used the stm32wba chip as the main controller of the product and need to implement DFU and FOTA features, but we are currently stuck at this point.

Environment

  • West runner: jlink
  • Board: nucleo_wba52cg
  • Zephyr OS: v3.5.0, v3.6.0
  • OS: ubuntu 22.04
  • Toolchain: Zephyr SDK 0.16.0

Thank you!

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 28 (11 by maintainers)

Most upvoted comments

Hi @erwango, I have pulled your branch (fix_wba_chainloaded) and tested the bootloader jumping. It can jump to the application code. Looking forward to merging into the Zephyr code repository.