4 Replies Latest reply on Feb 11, 2020 2:30 AM by HiIw_4620611

    How to build a Factory Reset image

    HiIw_4620611

      Hello.

       

      How do I create a factory reset image of an executable application and download it to an external SFlash?

       

      The contents I tried are as follows.

       

      Executable applications are built and run in the following ways:

      make <App>-<Platform>-ThreadX-NetX_Duo download run

       

      Created a factory reset image of the external flash according to the usage described in the Makefile.

      make <App>-<Platform> -ThreadX-NetX_Duo SFLASH=app-dct-download

      Note: There is no OTA-APP.

       

      At this time, among the generated files, the size of build/<App>-<Platform>-ThreadX-NetX_Duo/DCT.stripped.elf is very large, and an error exceeding the size occurs.

      DCT.elf               ...             24,416Bytes

      DCT.stripped.elf ... 1,179,403,647Bytes

       

      Q1. How to specify correct make to download Factory Reset Image to external sflash?

       

      Q2. Are the images stored in the external sflash FR_APP and APP0 stored by Factory Reset the same format?

      It is unclear whether FR_DCT is included in FR_APP or stored in DCT_IMAGE separately from FR_APP.

       

      Q3. Is there a tool to access external flash from PC?

       

      Thanks.

        • 1. Re: How to build a Factory Reset image
          HiIw_4620611

          Hello.
          It is self-follow.

           

          A3. Please refer to the following: How to use sflash_write.tcl script embedded in WICED?

           

          To read 4MB from external flash, use the following command line:

          tools\OpenOCD\Win32\openocd-all-brcm-libftdi.exe -f tools\OpenOCD\CYW9WCD1EVAL1.cfg -f tools\OpenOCD\stm32f4x.cfg -f apps\waf\sflash_write\sflash_write.tcl -c "sflash_read_file contents.bin 0 <Platform name>-SDIO 4194304 0" -c shutdown

           

          contents.bin of the current folder is completed.

           

          If there is a mistake in the usage, please point out.

           

          Thanks.

          • 2. Re: How to build a Factory Reset image
            HiIw_4620611

            Hello.

            It is self-follow, again

             

            A.1  Add the following line to your application's makefile:

            FR_APP    := $(OUTPUT_DIR)/binary/$(CLEANED_BUILD_STRING).stripped.elf

            DCT_IMAGE := $(OUTPUT_DIR)/DCT.stripped.elf

             

            With these two definitions, FR_APP is generated without OTA-APP, is it right?

             

            A.2 FR_DCT is stored in DCT_IMAGE separately from FR_APP.

            Also, the images of FR_APP and APP0 are both stripped.elf.

            Is it right?

             

            Based on this result, I tried the following steps:

             

            S.1 Add <A.1> to the makefile of my application and build.

            By this procedure, FR_APP and DCT_IMAGE are deployed to external flash.

             

            S.2 Then, restore <A.1> and force the next two lines with bootloader

            wiced_dct_restore_factory_reset( );
            wiced_waf_app_set_boot( DCT_FR_APP_INDEX, PLATFORM_DEFAULT_LOAD );

             

            S.3 Runs as it is, it will terminate abnormally.

             

            What I want to make sure is that the current application is replaced and run with the factory reset image.

             

            As a result of analysis, FR_APP and DCT_IMAGE deployed in the first make in the second make were overwritten by filesystem.bin.

            Probably, wiced_apps.mk puts the required image in the front justification.

             

            So, please teach me the next method.

             

            Q.4 How do I build only the current application and deploy it to the internal flash only?

            I want to suppress file system and WiFi firmware (and else) automatically deploy to external flash.

            By the way, is there an image that is automatically assigned other than the external flash file system and WIFi firmware?

             

            Q.5 How do I assign an image location to a fixed area on the external flash?

             

            If you have any other good ideas, please suggest them.

             

            best regards.

            • 3. Re: How to build a Factory Reset image
              MuraliR_36

              Hi

               

              Q1. How to specify correct make to download Factory Reset Image to external sflash?

              --> Add the following lines in the make file

              FR_APP    := $(OUTPUT_DIR)/binary/$(CLEANED_BUILD_STRING).stripped.elf

              DCT_IMAGE := $(OUTPUT_DIR)/DCT.stripped.elf

              and add download_apps(snip.apsta-CYW943907AEVAL1F download download_apps run) to the makefile, for the FR_APP and DCT to get loaded.

               

               

              S.2 Then, restore <A.1> and force the next two lines with bootloader

              --> Could you try adding wiced_framework_reboot(); after wiced_waf_app_set_boot( DCT_FR_APP_INDEX, PLATFORM_DEFAULT_LOAD ); and check it.

               

               

              Q2. Are the images stored in the external sflash FR_APP and APP0 stored by Factory Reset the same format?

              It is unclear whether FR_DCT is included in FR_APP or stored in DCT_IMAGE separately from FR_APP.

              --> All the application images are stored in the .striped.elf format

              The FR_DCT is stored deparately from the FR_APP.

               

               

              Q3. Is there a tool to access external flash from PC?

              A3. Please refer to the following: How to use sflash_write.tcl script embedded in WICED?

              If there is a mistake in the usage, please point out.

              --> I don't see any issues in this implementation.

               

               

              Q4. How do I build only the current application and deploy it to the internal flash only? I want to suppress file system and WiFi firmware (and else) automatically deploy to external flash.By the way, is there an image that is automatically assigned other than the external flash file system and WIFi firmware?

              --> Here's a post which may help you out : How can I flash the wifi firmware at a certain address on the internal flash ?

              1. Change RESOURCES_LOCATION ?= RESOURCES_IN_WICEDFS to RESOURCES_IN_DIRECT_RESOURCES in the platform make file

              2. Comment out #define USES_RESOURCE_FILESYSTEM in platform_config.h

              3. Comment out  the definitions WICED_PLATFORM_INCLUDES_SPI_FLASH and WICED_SPI_FLASH_CS in the platform.h file

              There's no other image automatically assigned other than the firmware, DCT and the filesystem.

               

               

              Thanks

              • 4. Re: How to build a Factory Reset image
                HiIw_4620611

                Hello

                 

                Thank you for answering.

                 

                It seems that the intent of "As a result of analysis" is not being conveyed correctly.

                The cause of "terminate abnormally." Is that FR_APP and DCT_IMAGE were overwritten by filesystem.bin.

                 

                As a countermeasure, I asked about the method of Q4 and Q5, but the answer, It's method looks like assign filesystem.bin to internal flash

                 

                Question again.

                 

                Q.4 How to suppress writing to external flash during make in <A.1>?

                As a prerequisite, LUT, FR_APP, DCT_IMAGE, FILESYSTEM_IMAGE, WIFI_FIRMWARE have already been deployed to the external flash by the method of <A.1>, and I want to update only the APP and DCT of the built-in flash.

                I don't want to put filesystem.bin in the internal flash.

                 

                Q.5 How do I assign an image location to a fixed area on the external flash?

                If Q.4 seems to be difficult, I would like to deal with overwriting by assigning a fixed address to the image assignment to the external flash.

                 

                As a temporary measure, the image of FR_APP is saved in advance and adopts the method specified by <A.1> 's FR_APP.

                 

                best regards.