4 Replies Latest reply on Apr 7, 2017 2:12 PM by webmstreric

    OTA2 overwrite MFG DCT ?

    vtunr

      Hi,

       

      I'm working on OTA2 with BCMUSI33 platform, with SDK 3.7.0 (OTA2 patch applied on it).

      OTA2 is working now, but it seems that MFG DCT is erased once the extract happen. I don't know if it's also the case with network and wifi DCT.

       

      What i tried is :

           Change the serial number in MFG DCT from an empty value to a 16 char string.

           Reboot and check that the serial number is really changed

           Update with a the same FW.

           Once rebooted on the new FW, serial number is empty.

       

      It's not really the behavior I'd expect from an OTA update.

       

      So is this the normal behavior ?

      If not, could it be a problem with the image I use for OTA update ? Or is there any special configuration or things to do to keep the basic WICED DCT untouched ?

       

      Regards,

       

      vtunr

        • 1. Re: OTA2 overwrite MFG DCT ?
          mifo

          +jone_yi_1844281 from USI.

           

          I'm not familiar with the USI part number.

           

          Did you mean to write WM-BAN-BM-33, which is a BCM43907+BCM20707 based device?

           

          If this is the case, neither device on the module is supported through the community forum and it may make sense to setup via the local channel either within USI or Cypress that enabled you for this engagement. Let me know if I have reached this assumption in error.

          • 2. Re: OTA2 overwrite MFG DCT ?
            vtunr

            Yes you're right it's the WM-BAN-BM-33

             

            On this topic, it's mainly a wiced api question, not really related to platform if i'm not mistaken. OTA2 is working fine with the WM-BAN-BM-33.

             

            I found a solution to keep all the wanted DCT, not sure it's the right one though.

             

            What i did is on the snip.ota2_extract, add a reading of the wanted DCT before the extract and rewriting it after the extract.

            I'd prefer not to have to do that, and keep it untouched, but not sure if it's possible.

             

            If it's the right solution, maybe that'd be great to have the copy/write of network/wifi/manufacturing directly in the snip.ota2_extract, because losing this kind of information is probably not wanted when OTA occured.

             

            Regards,

             

            vtunr

             

            • 3. Re: OTA2 overwrite MFG DCT ?
              webmstreric

              I agree with you. This is not the right behavior for an OTA process. I am seeing the same problem on ota2 on WICED 4.1 using the BCM943907AEVAL1F board. This is a supported platform. Not only is the serial number wiped out by an update, but security keys in the security section of the DCT are also destroyed.

               

              The reason for this is the extraction app is used by both the factory reset process and the OTA upgrade process. For the factory reset process it must replace the existing DCT with the original DCT as it was when the device was shipped from the factory. For the upgrade process the DCT should not be replaced at all. Instead only the specific pieces of information in the DCT that need to be changed should be changed. The extraction app always replaces the DCT regardless of whether it is being used for an OTA or a factory reset. The same kind of heavy handed logic that you discuss above is used to copy the old DCT to a DCT Save Space before the extraction. Then after the extraction only the important parts of the saved DCT are copied back into the newly extracted DCT. This includes the Wifi and Network configuration sections of the DCT as well as the Application section but not much else. The Manufacturing, Security and Bluetooth configuration sections are not restored, so all of that data will get wiped out by the OTA upgrade. My feeling is that this whole DCT Save Space logic is wrong and should be removed. It should be replaced with logic that only replaces the DCT for a factory reset and keeps the old DCT when doing an OTA update.

               

              I would suggest removing the following two functions entirely. Also I would either remove the DCT Save Space or use it for the factory reset DCT and remove the DCT from the factory reset archive.

               

              wiced_dct_ota2_save_copy() in WICED\platform\MCU\wiced_dct_external_ota2.c

              over_the_air_2_app_restore_settings_after_update() in apps\snip\ota2_example\ota2_test.c

              1 of 1 people found this helpful
              • 4. Re: OTA2 overwrite MFG DCT ?
                webmstreric

                Here is what I am doing to prevent overwriting the DCT during an OTA update. I am removing the code that uses Save DCT space in flash and I am removing the code that replaces the current DCT with a new copy from the downloaded OTA archive. Here are the 4 steps to do that. I originally planned on doing a 5th step which would have involved using the old Save DCT space in flash for a factory reset DCT, because it could be challenging to provision Manufacturing Information like the device's serial number and part number on the device after a standard copy of the factory reset image has already been saved onto the device. That wasn't essential for the task I had, so I didn't do that part yet. The following 4 steps remove the DCT from the OTA archive but keep the DCT stored in the factory reset archive, so a factory reset will always replace the DCT, but an OTA update never replaces it.


                1) The extract app goes through the list of files in the archive and extracts all of them, so the easiest way to prevent the DCT from being extracted is to remove it from the archive. I did this by removing the following 2 lines from the ota2_image: rule in tools/makefiles/wiced_apps.mk:


                     $(QUIET)$(call WRITE_FILE_APPEND, $(OTA2_IMAGE_CONFIG_FILE) ,DCT_LOC=$(SFLASH_DCT_LOC))
                     $(QUIET)$(call WRITE_FILE_APPEND, $(OTA2_IMAGE_CONFIG_FILE) ,

                            DCT_FILE=$(call CONV_SLASHES,$(FINAL_DCT_FILE)))

                 

                 

                2) Previously the DCT was saved to the Save area for the DCT. I don't want to use that saved DCT, so I delete all function calls that restore data from the Saved area for the DCT. Then I delete the function definitions so that if I missed a call, I will get a build error and need to delete the function call:


                            over_the_air_2_app_restore_settings_after_update(); [removed 2 calls and the function definition from

                                        apps/snip/ota2_example/ota2_test.c]

                             wiced_dct_ota2_read_saved_copy(); [ replaced 1 call from libraries/filesystems/ota2/wiced_ota2_image.c with: 

                                        wiced_dct_read_with_copy();] [ also removed wiced_dct_ota2_read_saved_copy() declaration from

                                        WICED/platform/MCU/wiced_dct_common.h]


                3) Removed function calls that save the current DCT to the saved area and removed the module for these functions from the source file

                list in the makefile:


                            wiced_dct_ota2_save_copy(); [Replaced 3 function calls from init_player() in apps/snip/ota2_example/ota2_test.c with

                                         the following single block that comes after the switch() {} that the three functions calls are in:]

                             // Next boot should be a normal boot.
                               if ( boot_type != OTA2_BOOT_NORMAL ) {
                                        ota2_boot_type_t boot_type = OTA2_BOOT_NORMAL;
                                        result = wiced_dct_write( &boot_type, DCT_OTA2_CONFIG_SECTION,
                                                 OFFSETOF( platform_dct_ota2_config_t, boot_type ), sizeof( ota2_boot_type_t ) );
                                         if ( result != WICED_SUCCESS ) {
                                                 OTA2_APP_PRINT(OTA2_LOG_ERROR, ("Failed to write boot_type into DCT\r\n"));
                                          }
                                 }

                 


                                [There were 2 other function calls in the same file in an unused CLI function in the same file. I just commented those out.]

                 

                                 [Also removed 2 calls to wiced_dct_ota2_save_copy() from application_start() in apps/snip/ota2_extract/ota2_extract.c]
                                 [ To get rid of the definition I removed the module from the list of source files in
                                           WICED/platform/MCU/BCM4390x/BCM4390x.mk ]

                                 # $(NAME)_SOURCES += ../wiced_dct_external_ota2.c


                 

                 

                4) Changed OTA2_IMAGE_APP_DCT_SAVE_AREA_BASE to OTA2_IMAGE_APP_DCT_FR_AREA_BASE in both platforms/BCM943907AEVAL1F/ota_image_defines.h and in a print statement in apps/snip/ota2_example/ota2_test.c. The new name is not used.