zephyr: mimxrt1060-evk flash shell command causes shell deadlock

Describe the bug After building and flashing smp_sv shell sample on mimxrt1060-evk the flash shell command causes a deadlock in the shell.

To Reproduce Build and run smp-svr shell sample application.

Expected behavior The correct flash shell command output:

uart:~$ flash
flash: wrong parameter count
flash - Flash shell commands
Subcommands:
  erase  :[<device>] <page address> [<size>]
  read   :[<device>] <address> [<Dword count>]
  test   :[<device>] <address> <size> <repeat count>
  write  :[<device>] <address> <dword> [<dword>...]

Logs and console output

*** Booting Zephyr OS build v2.7.99-931-gf90b24536184  ***
I: Starting bootloader
I: Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x1
I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: primary slot
I: Swap type: none
I: Bootloader chainload address offset: 0x10000
I: Jumping to the first image slot
*** Booting Zephyr OS build v2.7.99-931-gf90b24536184  ***


uart:~$ flash

Environment (please complete the following information):

  • OS: Arch Linux
  • Toolchain Zephyr SDK 0.13.1
  • v2.7.99-931-gf90b24536184

Additional context Sometimes for unknown reasons, I was also getting kernel panic such as:

uart:~$ flash
[00:00:05.980,000] <err> os: ***** USAGE FAULT *****
[00:00:05.980,000] <err> os:   Illegal use of the EPSR
[00:00:05.980,000] <err> os: r0/a1:  0x60029c60  r1/a2:  0x00000001  r2/a3:  0x80007ca4
[00:00:05.980,000] <err> os: r3/a4:  0x00000040 r12/ip:  0x00000000 r14/lr:  0x6001530b
[00:00:05.980,000] <err> os:  xpsr:  0x60000000
[00:00:05.980,000] <err> os: Faulting instruction address (r15/pc): 0x00000040
[00:00:05.980,000] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:05.980,000] <err> os: Current thread: 0x80002c28 (shell_uart)
[00:00:05.988,000] <err> os: Halting system

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17

Commits related to this issue

Most upvoted comments

It seems that setting CONFIG_FLASH_LOG_LEVEL_OFF=y fixes the issue with flash-shell sample. I’ve also checked it with my application that uses MCUMGR over uart and sometimes it’s stucking during firmware uploading but it needs more investigating because I’m not sure if it’s related to this issue at all.

The stacking may by caused by halting the CPU for erase. Have you tried enabling Kconfig option CONFIG_IMG_ERASE_PROGRESSIVELY?

When you use mcumgr-cli, and have the above option enabled you may do image upload -e, this will make mcumgr erase pages as data comes instead of pre-erasing target slot.

After setting CONFIG_IMG_ERASE_PROGRESSIVELY option the stucking has gone, thanks for the hint 😃 So it seems that everything is working fine and we are waiting for the proper fix from @danieldegrasse. Thanks guys for your investigation.