This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

changes in Bootloader- saving image in external flash and transferring in internal via Bootloader

Hi , I am using ZEPHYR rtos , and using the internal bootloader and its working fine and there are two images but now my code size has increased and i can not store 2 images in internal flash  so have to do implementation of saving the image to external flash and after validation move to internal flash ,what changes i require to make in zephyr bootloader to add external flash code(SPI) and  using only 1 image in bootloader 

Parents
  • Hi Hung , I have tried the example code you mentioned but still do not work as i am using external flash as secondary image area it is fetting failed in reading the sectors or secondary image 

     rc = boot_read_sectors(state);
        if (rc != 0) {
            BOOT_LOG_WRN("Failed reading sectors; BOOT_MAX_IMG_SECTORS=%d"
                         " - too small?", BOOT_MAX_IMG_SECTORS);
            /* Unable to determine sector layout, continue with next image
             * if there is one.
             */
            BOOT_SWAP_TYPE(state) = BOOT_SWAP_TYPE_NONE;
            return;
        }
    Do i need to make any change in NCS code for bootloader i have done all required change on conf file but some linking is missing as it not able to read sectors for secondary  can you pls guide for further changes 
Reply
  • Hi Hung , I have tried the example code you mentioned but still do not work as i am using external flash as secondary image area it is fetting failed in reading the sectors or secondary image 

     rc = boot_read_sectors(state);
        if (rc != 0) {
            BOOT_LOG_WRN("Failed reading sectors; BOOT_MAX_IMG_SECTORS=%d"
                         " - too small?", BOOT_MAX_IMG_SECTORS);
            /* Unable to determine sector layout, continue with next image
             * if there is one.
             */
            BOOT_SWAP_TYPE(state) = BOOT_SWAP_TYPE_NONE;
            return;
        }
    Do i need to make any change in NCS code for bootloader i have done all required change on conf file but some linking is missing as it not able to read sectors for secondary  can you pls guide for further changes 
Children
  • Hi Anil, 
    Please provide what exact error do you receive ? Do you have any debug log ? 

    Note that it's not possible (as far as I know) to boot from the external flash. What you can do is to receive the image in the secondary slot and then swap the image to the primary slot (the internal flash) 

    Please let us know what's your modification, which flash library,  how you configure the device tree and the partition manager (partitions.yml file). 
    Do you have the Dev Kit ? You can test my example on the devkit and then change the QSPI interface to SPI interface. It's easier if we have the same hardware and can test here.

Related