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/18 20:56:42 UTC

[GitHub] [mynewt-mcumgr] ErlendWithammerLux opened a new issue #127: send image form one chip to another

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


   Hey!
   
   I'm trying to send an image from Slot 1 on the nrf9160dk_nrf9160 to Slot 1 on the nrf9160dk_52840. (on the nrf9160dk)
   Looking in the img_mgmt directory I didn't find any simple way to do this.
   One a bit more sketchy way of doing it could be to read data form flash on 91 and send packets of this over the uart, for then to write it to flash on the 52.
   
   However when i tried to get the length of the image in slot 1 using img_mgmt_impl_read(1,96,&image_length,32) (96 being the offset inn to the header where length is stored) to read the length from the image header i get only nonesens. There is probably some offset i'm missing.
   
   Is there any simple way to do this using your framework? Or a simple way to get the right loaction in flash to copy the image?
   
   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.

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



[GitHub] [mynewt-mcumgr] ErlendWithammerLux commented on issue #127: send image form one chip to another

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


   uart:~$  I: vcom0_pins_routing is ENABLED 
   I: vcom2_pins_routing is ENABLED   
   I: led1_pin_routing is ENABLED   
   I: led2_pin_routing is ENABLED 
   I: led3_pin_routing is ENABLED 
   I: led4_pin_routing is ENABLED   
   I: switch1_pin_routing is ENABLED   
   I: switch2_pin_routing is ENABLED   
   I: button1_pin_routing is ENABLED 
   I: button2_pin_routing is ENABLED
   I: nrf_interface_pins_0_2_routing is disabled 
   I: nrf_interface_pins_3_5_routing is disabled    
   I: nrf_interface_pins_6_8_routing is disabled  
   I: Board configured.    
   *** Booting Zephyr OS build v2.4.99-ncs1  ***  
   I: Starting bootloader         
   I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3   
   I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3      
   I: Boot source: none  
   I: Swap type: none    
   I: Bootloader chainload address offset: 0xc000  
   I: Jumping to the first image slot*** Booting Zephyr OS build v2.4.99-ncs1  ***    
   Hello 52!     
   pipe: registered   
   uart:~$ [00:00:00.001,403] <inf> board_control: vcom0_pins_routing is ENABLED 
    art:~$ [00:00:00.001,464] <inf> board_control: vcom2_pins_routing is ENABLED                        
   uart:~$ [00:00:00.001,464] <inf> board_control: led1_pin_routing is ENABLED 
   uart:~$ [00:00:00.001,495] <inf> board_control: led2_pin_routing is ENABLED  
   uart:~$ [00:00:00.001,525] <inf> board_control: led3_pin_routing is ENABLED   
   uart:~$ [00:00:00.001,556] <inf> board_control: led4_pin_routing is ENABLED      
   uart:~$ [00:00:00.001,586] <inf> board_control: switch1_pin_routing is ENABLED      
   uart:~$ [00:00:00.001,617] <inf> board_control: switch2_pin_routing is ENABLED    
   uart:~$ [00:00:00.001,647] <inf> board_control: button1_pin_routing is ENABLED  
   uart:~$ [00:00:00.001,647] <inf> board_control: button2_pin_routing is ENABLED    
   uart:~$ [00:00:00.001,678] <inf> board_control: nrf_interface_pins_0_2_routing is ENABLED   
   uart:~$ [00:00:00.001,708] <inf> board_control: nrf_interface_pins_3_5_routing is ENABLED     
   uart:~$ [00:00:00.001,739] <inf> board_control: nrf_interface_pins_6_8_routing is disabled   
   uart:~$ [00:00:00.001,770] <inf> board_control: Board configured.            
   uart:~$ uart:~$ uart:~$ Frags:                                              
           Current: = 1,                                                                      
           Last = 0                          
   Recieved header has:                      
           Header.op = 1234                                                         
           Header.length = 169828                                                         
   Frags:                                                                                           
           Current: = 2,                       
           Last = 1 
   wrote more data, bytes handled = 80                                 
   Frags:                                                                                       
           Current: = 3,         
           Last = 2                      
   wrote more data, bytes handled = 160                                
   Frags:                       
           Current: = 4,         
           Last = 3   
   wrote more data, bytes handled = 240         
   Frags:      
           Current: = 5,   
           Last = 4     
   wrote more data, bytes handled = 320       
   Frags:         
           Current: = 6,      
           Last = 5                
   wrote more data, bytes handled = 400          
   Frags:                        
           Current: = 7,      
           Last = 6 
   wrote more data, bytes handled = 480       
   Frags:             
           Current: = 8,    
           Last = 7       
   [00:00:24.023,223] <inf> mcuboot_util: Swap type: none     
   [00:00:24.024,047] <inf> mcuboot_util: Swap type: none   
   [00:00:33.739,105] <err> os: ***** BUS FAULT *****          
   [00:00:33.739,135] <err> os:   Imprecise data bus error  
   [00:00:33.739,135] <err> os: r0/a1:  0x00000001  r1/a2:  0x96f3b83d  r2/a3:  0x96f3b83d    
   [00:00:33.739,166] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x0001939b   
   [00:00:33.739,196] <err> os:  xpsr:  0x61000000       
   [00:00:33.739,196] <err> os: Faulting instruction address (r15/pc): 0x000193b0     
   [00:00:33.739,227] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0    
   [00:00:33.739,257] <err> os: Current thread: 0x20000768 (main)   
   [00:00:33.830,871] <err> fatal_error: Resetting system            
   I: vcom0_pins_routing is ENABLED            
   I: vcom2_pins_routing is ENABLED    
   
   
   addr2line -e zephyr.elf -f 0x000193b0 
   __DMB
   MYPC/modules/hal/cmsis/CMSIS/Core/Include/cmsis_gcc.h:958
   
   The bus fault happens the first time it tries to write to flash. Previous data packets are stored in a buffer until 512 bytes are recieved and ready to be written to 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.

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



[GitHub] [mynewt-mcumgr] de-nordic commented on issue #127: send image form one chip to another

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


   I have taken brief look at mcuboot_shell and mcumgr function `img_mgmt_read_info` that takes care of obtaining the info I do not see any obvious hint where the problem is.


-- 
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 commented on issue #127: send image form one chip to another

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


   CONFIG_IMG_ERASE_PROGRESSIVELY=y
   also causes the same type of crash when erasing flash.
   
   maybe i have a config mistake?


-- 
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 commented on issue #127: send image form one chip to another

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


   Increasing stack did not help (on version 020), which version are you working on?
   v020
   prj.conf : 
       #Some commmand handlers require a large stack
       CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
   
   The fault seems to happen from the function flash_synch(struct stream_flash_ctx*) in stream_flash.c
   which is called by img_mgmt_impl_write_image_data().
   
   


-- 
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 #127: send image form one chip to another

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


   Can you share the crash info from console?


-- 
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 commented on issue #127: send image form one chip to another

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


   Yes, i'll post it tomorrow!


-- 
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 #127: send image form one chip to another

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


   Doing a little digging I found "According to the ARM Cortex M4 documentation, if this bit (IMPRECISERR bit) is set a data bus error has occurred, but the return address in the stack frame is not related to the instruction that caused the error."
   
   So the fuction _DMB is probably unrelated. 
   
   *edit*
   The problem seems to be stemming from :
   nvmc_word_write
   MYPC/modules/hal/nordic/nrfx/drivers/src/nrfx_nvmc.c:242


-- 
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 #127: send image form one chip to another

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


   


-- 
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 #127: send image form one chip to another

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


   Thanks for the quick respons! 
   
   Oh my, what rookie mistake!
   
   Okay I see, I'll start looking in to sending it directly then.


-- 
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 #127: send image form one chip to another

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


   The mcumgr and mcuboot shell gather info on images independently, I assume that there is bug in mcumgr in how it addresses the images, and since the second slot (image) is in external device it probably fails to figure that out and queries the internal 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.

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



[GitHub] [mynewt-mcumgr] ErlendWithammerLux commented on issue #127: send image form one chip to another

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


   Doing a little digging I found "According to the ARM Cortex M4 documentation, if this bit (IMPRECISERR bit) is set a data bus error has occurred, but the return address in the stack frame is not related to the instruction that caused the error."
   
   So the fuction _DMB is probably unrelated. 


-- 
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 #127: send image form one chip to another

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


   @ErlendWithammerLux what is the sha of modules/lib/mcumgr you are using? which repo?


-- 
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 #127: send image form one chip to another

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


   Btw. you may join the Zephyr slack, there is mcumgr channel.


-- 
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 commented on issue #127: send image form one chip to another

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


   The problem seems to have been initializing the wrong flash in the new version.
   
   In modules/lib/mcumgr/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c:295
   this : rc = flash_img_init(ctx);
   was changed to this in the new version:
   rc = flash_img_init_id(ctx, g_img_mgmt_state.area_id);
   
   However g_img_mgmt_state.area_id = 0 on the first call but it should be 5 to initialize the correct flash.
   
   Changing this the image transfers fine, but I am back to the original problem of the image not being 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] de-nordic commented on issue #127: send image form one chip to another

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


   ```
   git log --oneline --decorate
   e289ead (apache/master) Merge pull request #114 from de-nordic/img-mgmt-curr-slot
   6f52fd9 zephyr: fix initialization of file struct
   99f9fd6 img_mgmt: Use IMG_MGMT_BOOT_CURR_SLOT as current running slot ID
   b92aa0b Fix encoding usage for halffloat
   f21eef7 Bug #18312 Add support for half-floats to MCUMGR
   35d290e (amaster) zephyr: Use flash_img_init_id instead of flash_img_init
   ```
   
   It crashes probably due to:
   https://github.com/apache/mynewt-mcumgr/pull/126
   
   the stack of workqueue is too small since the "image" parsing has been added.


-- 
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 commented on issue #127: send image form one chip to another

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


   I was using version 0.1.0, don't know where to find sha and fork.
   
   I upgraded to 0.2.0  to see if this would help, however now it can no longer write to flash and is simply crashing when the flash buffer is full and writes to 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.

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



[GitHub] [mynewt-mcumgr] de-nordic commented on issue #127: send image form one chip to another

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


   Seems that mcuboot is not able to pick the image from external flash somehow.


-- 
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 #127: send image form one chip to another

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


   @ErlendWithammerLux what is the sha of modules/lib/mcumgr you are using? which fork?


-- 
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 #127: send image form one chip to another

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


   Hi,  the offset is incorrect, you have counted bits not bytes, the correct offset is 12 (96/8).
   As far as I can tell, there is not other method to pass the image, with no modifications to board.
   


-- 
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 #127: send image form one chip to another

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


   Current e71063a, but I work on unmodified smp_svr.


-- 
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 commented on issue #127: send image form one chip to another

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


   Hey again! 
   
   I've been able to send the image over uart. The image is received fine, but here comes the problem.
   Listing the images calling mcuboot on the local shell lists both the old and the new image, and the header is read correctly to list the image size. However calling image list from the mcumgr-cli does not list the new image. Upgrading the to the new image also does not work with error message "Image in the secondary slot is not valid!".
   
   Do you have any idea what could be the problem?
   


-- 
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