-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disco_l475_iot1 don't confirm MCUBoot slot-1 image #25010
Comments
^^@ABOSTM |
@nandojve Is this TLS enabled? |
Hi @parthitce, if you are referring to UpdateHub, yes, it works with/without DTLS. About MCUBoot, you must use your own certificate to sign images. To get MCUboot working you need SoC flash stuff working properly, as far I know. With that, you can get UpdateHub working if you have a network interface. You can use a wifi shield like ESP_8266 or any other available. The shield is basically wifi config + board overlay. This way, you don't need a full ethernet available to test it, only a serial 115200 with RX/TX. |
Hi @nandojve,
I suspect Proxy issue, I tried to set proxy environnement variables, and also tried to add proxy to config.json, but it doesn't help. I looked for precompiled updateHub image for windows to download, (so that it could be available locally) but I could not found it.
Would you be able to test on your side the same: From original Zephyr repo, on any STM32 board with Ethernet (instead of Wifi) ? |
Hi @ABOSTM, Docker procedures:
Current master need update timer variable because timer changes, we'll open issue and send PR:
Update prj.conf file for convenience:
Build for frdm_k64f board
Flash initial image: Server not found, no network, etc:
OK, now run docker container and login: Server running and communication is OK:
Check that machine is connected at devices: Setup update: Program a upload: Wait or force upload at board's terminal:
If you have network running and flash works with MCUboot you will be able to reproduce above steps. If you have any trouble, please, let me know! |
@nvlsianpu is this related to the confirmation bug in mcumgr that you detected the other day? |
@carlescufi ^^ not related to that one (was issue caused by different NCS partition manager configuration). @nandojve Is this bug is regression to something which used to work before, or it was newer tested on this SoC? Confirmation problems suggest me an issue with the flash write operation to write area, as confirmation is just the write of proper data to certain flash addresses. |
Hi @nandojve , As I understand, generally speaking, updatehub is working with ESP_8266 shield. |
Hi @ABOSTM, by the docker command line you must have UDP port 5683 open to work. Anyway, my problem to advance with disco_iot is related to the logs:
That message is printed by the following code at samples/net/updatehub/main.c
So, my problem is, boot_write_img_confirmed need be OK to system work. It seems something related to flash on disco_iot. This issue you can check without UpdateHub-CE be present. Be sure trhat NET_CONFIG_SETTINGS option is false. Depending the code you are looking my be necessary adjust it on zephyr/lib/updatehub/Kconfig. About WIFI, I have both es-WIFI and ESP_8266 working, so yes, I can test and switch if necessary. |
Hi @nandojve , |
@nvlsianpu I never got UpdateHub working on that board. I've been raising issues related with hope to get disco_iot working at some moment. My feeling is that solving the boot_write_img_confirmed (this issue) and assuming flash write is OK probably UpdateHub will start to works. |
@ABOSTM it is mandatory apps confirm the image on first boot otherwise MCUBoot will must roolback on next reboot. I think this is not fully addressed on current MCUBoot samples on Zephyr. The consequence is we can't see regressions or even know that MCUBoot is 100% functional and supported. My suggestion is add boot_write_img_confirmed at hello word targeting to MCUBoot (CONFIG_BOOTLOADER_MCUBOOT=y) and debug it. If boot_write_img_confirmed fail you can experiment board enter on a infinite reset loop because there isn't a plan B image. Take that on consideration because isn't a bug. @nvlsianpu Is there a regression test to check boot_write_img_confirmed requirement? |
@nandojve ,
|
Hi @ABOSTM thank you for the feedback! |
@nandojve |
@ABOSTM I continue saw flash not be confirmed on your SHA and on the last one. The only difference that raise a flag for me was that: Your Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x1 Below the procedure that I believe get last version of everything to make sure environment is not poisoned. Please, add #25333 on top of master if not merged yet.
After that, I always make sure that all modules are on the last version:
Then, apply changes on hello_world
diff:
build: sign with --slot-size 0x6C000 I'm using west to flash image: Then, the unfortunately result:
|
Hi @nandojve ,
There is 1 thing you did not mention in your procedure: recompiling MCUBoot and flashing it? |
@ABOSTM is there any lower level debugging information which might help to spot what is different from your setup? |
Hi @ABOSTM
I simple omit, but I built MCUboot and flash it first same week. Anyway, could you help to understand why the difference? What make that image_ok=0x3 instead 0x1? Could be this the reason I can confirm image? NOTE: Update comment with right flags. |
I am not an MCUBoot expert, but I found those definitions
Then I figure out that after a fresh flashing of images, the 1st boot displays image_ok=0x3 and then all further reboots (manual reset) display image_ok=0x1
But it still doesn't explain why you are not able to confirm the image. |
Hi @ABOSTM, At first, I did another try with lastest Zephyr version and your signed image, both without success.
I remember that I lost the board sometimes, usully ctrl+C when using west. The west was not able to write anymore. The solution was cp *hex or bin to mounted unity and get board running again. I think we discover the way to make board works, need flash MCUboot using stm32cubeprog with full chip erase. With that, I can move forward and I think this issue can be closed. Question: Is there a way to flash with full erase from command line on linux? Just for record: I give some UpdateHub runs and get below: When I put UpdateHub to run I got some connection instability and was need increase TCP/IP buffers. After some attempts I got
And
|
Hi @nandojve ,
It is possible to use CubeProgrammer with command line (CLI). It think it should also be possible to use OpenOCD or PyOCD do full erase the flash. But I am not sure Zephyr propose such option. |
Confirming does actually write the
I use: https://github.com/stlink-org/stlink. |
Thank you guys! |
Hi @ABOSTM , I open this issue again because I got same problem with zephyr-v2.3.0-1218. If I do full chip erase and flash zephy_MCUBoot.zip and zephyr-1.0.0_Signed_HelloWorld.zip using cubeprogrammer on Windows, the system works. This process is valid on Linux using the Utzig suggestion https://github.com/stlink-org/stlink and st-flash erase command followed by west flash zephy_MCUBoot and west flash --hex-file zephyr-1.0.0_Signed_HelloWorld. Changing MCUBoot for the current version still system working. The system stop to work when I flash any application from main repository. To put system running I need execute again st-flash erase but only your app zephyr-1.0.0_Signed_HelloWorld confirming the boot image. Note: Once the problem happen even your image don't works without a full erase. |
Hi @nandojve , So I suggest to make dichotomy (git bisect) to determine which commit cause the regression. |
@nandojve Is this issue still valid? |
@nandojve testsuite for mcuboot interface functions are here: /tests/subsys/dfu/mcuboot. |
I'll check it again. |
Hi @nvlsianpu , After zephyrproject-rtos/mcuboot@bdcfc85 I can't even build MCUboot for disco_l475_iot1. The commit message doesn't explain if there are something that should be done on my environment to allow build. Any tip? |
@nandojve please raise a dedicated issue for this new problem, it will help tracking. |
^^ Fix zephyrproject-rtos/mcuboot#32 |
Hi @nvlsianpu thank you for help us with this. I'll try again later. |
@nandojve would you mind rebasing https://github.com/UpdateHub/zephyr/commits/topic/uhu_wifi so we can have a test on recent zephyr version ? |
Hi @erwango , sure! My apologies about delays from my side, it has been very busy these days. |
Hi folks, some updates. First test: Write files from ABOSTM and confirm board is Ok: Pass
Second test: Confirm that new MCUboot works as expected only flashing new MCUBoot without erase all flash content. The MCUBoot at a06884a doesn't run the current v2.3.0-rc1 on the flash: Fail
Third test: Confirm that new MCUboot works as expected with full flash erase before upload new MCUBoot and firmware. The MCUBoot at a06884a works and the current v2.3.0-rc1 run on the flash: Pass
Fourth test: Flash a new firmware with new MCUboot: Fail
Fifth test: Re flash the old firmware with new MCUboot and confirm that works: Fail
Sixth test: Flash old MCUboot and new firmware with full chip erase: Fail
Seventh test: Revert to old firmware without full chip erase: Fail
Eighth test: Full erase, new bootloader, old firmware, bad image, old firmware: Ok
Nineth test: Continuing eighth test: new image, old firmware: Fail
It seems that Zephyr-2.4.0-rc1 images doesn't confirm and corrupt the whole system. When flash a bad image (eighth test) the system run normally when revert to old firmware. I confirm that after rebase to 2.4.0-rc1 updatehub doesn't confirm the image and stay rebooting. When I disable image confirmation |
Rebased on top of 2.4.0-rc2. The 28b9617 is full functional here at ETH/WIFI/MODEM.
|
Can you describe clear operation sequence required to reproduce the file: eg:
I have only nRF52xxdks boards so want to reproduce yours results using smp_svr sample. So fare I can't. |
Hi @nvlsianpu , the project that I try run is UpdateHub@74ae362 I sign the image and upload with west flash --hex.... All that I reported on the old post is related to the image at slot-0 after flash, and the above commit is the new firmware. I think you don't need use smp_svr because problem shows with west flash. old MCUboot(bootloader) old firmware Originally posted by @ABOSTM in #25010 (comment) Sequence is inside old post, try resume the first test, eighth and nine: Eighth test: Full erase, new bootloader, old firmware, bad image, old firmware: Ok Nineth test: Continuing eighth test: new image, old firmware: Fail So, when I flash the new firmware at slot-0 using west it fail to confirm the image and somehow compromise the whole system. I mean, a old firmware (that always works) only confirm after full chip erase. I believe it can be something related only to ST SoCs. I start to think this is the key related to the problem that I've been facing with ST SoC that MCUboot don't swap slot-1 to slot-0 keeping updatehub on a infinite upgrade loop. |
@nandojve What you men by |
@nvlsianpu it is about versions |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
Describe the bug
When build UpdateHub for disco_l475_iot1 the app don't confirm the image.
To Reproduce
Steps to reproduce the behavior:
CONFIG_UPDATEHUB_WIFI_SSID="wifi network"
CONFIG_UPDATEHUB_WIFI_PSK="password"
~/<zephyr_home_dir>/bootloader/mcuboot/scripts/imgtool.py sign --key ~/<zephyr_home_dir>/bootloader/mcuboot/root-rsa-2048.pem --header-size 0x200 --align 8 --version 1.0.0 --slot-size 0x6C000 ~/<zephyr_home_dir>/zephyr/build/zephyr/zephyr.hex ~/<zephyr_home_dir>/zephyr/build/zephyr/zephyr-1.0.0.hex
Expected behavior
boot_write_img_confirmed() executes properly on main.c
Impact
MCUBoot applications don't work.
Screenshots or console output
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: