You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/06/25 10:33:11 UTC

[GitHub] [mynewt-mcumgr] ErlendWithammerLux opened a new issue #129: Image transfer over uart not bootable

ErlendWithammerLux opened a new issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129


   Hello again! 
   I'm working on transferring images to the nrf52840 by uploading it to nrf9160 and sending it over UART, on the nrf9160dk.
   
   When the image has gone through the 91 it is not bootable however directly uploading it to the 52 works perfectly.
   To see if there was a difference between the images I transferred the same image twice to the 52. The first way was using mcumgr upload image to the 52 and swapping it to slot 0, and the second way was transferring to 91 using the same command and then sending it over the uart to slot 1.
   
   When calling mcuboot in the internal shell it lists both images, and they have the same size. Requesting an upgrade prints the error message of "image in slot 1 is not valid" when rebooted. 
   
   Looking at the memory on the 52 gave these results which have some differences that might be the cause of the image being invalid.
   
   ![2021-06-25_11-55](https://user-images.githubusercontent.com/86069562/123411393-b3a7a180-d5b0-11eb-8d79-b0e6aecdc1d0.png)
   ![2021-06-25_12-02](https://user-images.githubusercontent.com/86069562/123411418-b904ec00-d5b0-11eb-859a-98e11f7434d9.png)
   
   
   Another small problem is that only calling mcuboot in the internal shell lists the images, calling mcumgr image list only lists slot 0 after slot 1 being filled over uart. @de-nordic gave a posible reason for this here [https://github.com/apache/mynewt-mcumgr/issues/127](url) 
   
   Thanks a lot for any help on this!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
de-nordic commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-869528485


   Yes. That was supposed to be my next question: whether you confirm the image on the device you upload it to.
   The mcumgr does not do that by default, unless the image has been marked as confirmed with imgtool.
   The receiving application, on the second mcu, should set the new application it received for test, or confirmed pending; in case when the application will be set for test it needs to confirm itself after reboot (and probably some internal tests).
   You may use functions from zephyr/subsys/dfu/boot/mcuboot.c to confirm at run-time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
de-nordic commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868543256


   Good seems the uart transfer is fine, so we have this out of the way.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868443555


   Yes!
   image header:
           Magic: 2532554813
           ih_load_addr: 0
           ih_hdr_size: 512
           _pad: 0
           ih_img_size: 178084
           ih_flags: 0
           iv_major: 0
           iv_minor: 0
           iv_revision: 0
           iv_build_num: 0
           pad_: 0
   created packet: 0
   (this is read form slot 1 on 91)
   
                 
   When requesting an upgrade the magic is good and swap type is set to test as it should.
   
   Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
   I: Boot source: none
   I: Swap type: test
   E: Image in the secondary slot is not valid!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux edited a comment on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux edited a comment on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868522753


   Yes, i now took a look at the whole first and second slot and they are identical in both the beginning and the end so probably all over
   
   By this i mean slot0 on 52 where i used mcumgr upload img /build/zephyr/app_update.bin directly to 52 and swapped to slot 0.
   And slot1 being the same image uploaded the same way to 91 and then transferred over the uart by copying the flash.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
de-nordic commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-869529620


   @ErlendWithammerLux please close the issue if it is no longer relevant. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-869525388


   Got it to work!
   
   Was missing the tlv which was causing the image to be invalid.
   
   Thanks a lot for the help!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
de-nordic commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868519426


   And they both match the one you are uploading via uart?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
de-nordic commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868493349


   I guess you have nrf9120 dev board,  can switch the debug interface (SW10) to nrf52840? you  should be able to use nrfjprog tool to dump the memory to binary file.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868522753


   Yes, i now took a look at the whole first and second slot and they are identical in both the beginning and the end so probably all over


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-869466108


   Is there some sort of flags or termination characters that are being set when uploading through the mcumgr-cli to validate the image?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
de-nordic commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868459380


   Are you sure that you are copying right image? The dumps you have shown contain irq vector tables but tables are different it does not seem to be any shift as other fields seem correct.
   Can you sign your images adding versions to them and than share the first 512 bytes of bin file, the image headers?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux edited a comment on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux edited a comment on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868443555


   Yes!
   image header:
           Magic: 2532554813
           ih_load_addr: 0
           ih_hdr_size: 512
           _pad: 0
           ih_img_size: 178084
           ih_flags: 0
           iv_major: 0
           iv_minor: 0
           iv_revision: 0
           iv_build_num: 0
           pad_: 0
   (this is read form slot 1 on 91)
   
                 
   When requesting an upgrade the magic is good and swap type is set to test as it should.
   
   Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
   I: Boot source: none
   I: Swap type: test
   E: Image in the secondary slot is not valid!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux closed issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux closed issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux edited a comment on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux edited a comment on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868522753


   Yes, i now took a look at the whole first and second slot and they are identical in both the beginning and the end so probably all over
   
   By this i mean slot0 on 52 where i used mcumgr image upload build/zephyr/app_update.bin directly to 52 and swapped to slot 0.
   And slot1 (also on 52) being the same image uploaded with mcumgr to 91 and then transferred over the uart by copying the flash.
   
   Some dumps to be sure i didn't do something stupid
   ![2021-06-25_16-11](https://user-images.githubusercontent.com/86069562/123437878-6f2bfe00-d5d0-11eb-9250-269d85a759e0.png)
   ![2021-06-25_16-13](https://user-images.githubusercontent.com/86069562/123437886-70f5c180-d5d0-11eb-97c9-848c8aaceddc.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux edited a comment on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux edited a comment on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868522753


   Yes, i now took a look at the whole first and second slot and they are identical in both the beginning and the end so probably all over
   
   By this i mean slot0 on 52 where i used mcumgr upload img /build/zephyr/app_update.bin directly to 52 and swapped to slot 0.
   And slot1 (also on 52) being the same image uploaded with mcumgr to 91 and then transferred over the uart by copying the flash.
   
   Some dumps to be sure i didn't do something stupid
   ![2021-06-25_16-11](https://user-images.githubusercontent.com/86069562/123437878-6f2bfe00-d5d0-11eb-9250-269d85a759e0.png)
   ![2021-06-25_16-13](https://user-images.githubusercontent.com/86069562/123437886-70f5c180-d5d0-11eb-97c9-848c8aaceddc.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic edited a comment on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
de-nordic edited a comment on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868519426


   And they both match the one you are uploading via uart? I mean the complete images.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868515053


   hexdump slot0.bin 
   0000000 b83d 96f3 0000 0000 0200 0000 b8c4 0002
   0000010 0000 0000 0000 0000 0000 0000 0000 0000
   0000020 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0000200
   
   hexdump slot1.bin 
   0000000 b83d 96f3 0000 0000 0200 0000 b8c4 0002
   0000010 0000 0000 0000 0000 0000 0000 0000 0000
   0000020 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0000200
   
   both from the 52
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux edited a comment on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux edited a comment on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868515053


   python jflashrw.py read --start 0xc000 --length 0x200 --file slot0.bin 
   python jflashrw.py read --start 0x86000 --length 0x200 --file slot1.bin
    with script from here [https://devzone.nordicsemi.com/f/nordic-q-a/27428/read-and-write-specific-flash-pages-from-a-computer](url)
   
   hexdump slot0.bin 
   0000000 b83d 96f3 0000 0000 0200 0000 b8c4 0002
   0000010 0000 0000 0000 0000 0000 0000 0000 0000
   0000020 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0000200
   
   hexdump slot1.bin 
   0000000 b83d 96f3 0000 0000 0200 0000 b8c4 0002
   0000010 0000 0000 0000 0000 0000 0000 0000 0000
   0000020 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0000200
   
   both from the 52
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] ErlendWithammerLux commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
ErlendWithammerLux commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868480668


   You seem to be correct indeed! 
   hex of bin first 512 from 52:
   in 
   0000000 b83d 96f3 0000 0000 0200 0000 b8c4 0002
   0000010 0000 0000 0000 0000 0000 0000 0000 0000
   0000020 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0000200
   
   hex of bin first 512 from 91:
   n 
   0000000 b83d 96f3 0000 0000 0200 0000 4ad4 0003
   0000010 0000 0000 0000 0000 0000 0000 0000 0000
   0000020 ffff ffff ffff ffff ffff ffff ffff ffff
   *
   0000200
   
   Looking at JMemExe this is identical (not quite to the dumps as i have slightly changed the images).
   So JMemExe is only reading the nrf9160dk_nrf9160s memory not the 52 so the dumps are indeed wrong.
   
   I will look into reading the rigth memory further. 
   
   I am not 100% sure I'm copying the right image. I use img_mgmt_impl_read(1,sent,&data,to_send) to copy it.
   The sizes of img91 and img52 are very different, therefore since the read header size is the size of img52 it does seem like the right image is copied.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic commented on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
de-nordic commented on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868423047


   Can you share some more info regarding the image, like size and maybe 512 byes of header if that would not be a problem o security issue?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic edited a comment on issue #129: Image transfer over uart not bootable

Posted by GitBox <gi...@apache.org>.
de-nordic edited a comment on issue #129:
URL: https://github.com/apache/mynewt-mcumgr/issues/129#issuecomment-868459380


   Are you sure that you are copying right image? The dumps you have shown contain irq vector tables but tables are different it does not seem to be any shift as other fields seem correct.
   Can you sign your images adding versions to them and than share the first 512 bytes of bin files, the image headers,
   If that is allowed?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org