7 Replies Latest reply on Dec 14, 2016 5:22 AM by alex.damosys_1740326

    Possible bug for wiced_dct_restore_factory_reset in SDK-3.5.2 & 3.7.0

    xavier@candyhouse

      This is NOT a duplicate of this issue : Possible bug in wiced_dct_restore_factory_reset()

       

      In bootloader there is a mechanism to trigger "back to factory default", which is like this:

          if ( wiced_waf_check_factory_reset( ) )

          {

              wiced_dct_restore_factory_reset( );

              wiced_waf_app_set_boot( DCT_FR_APP_INDEX, PLATFORM_DEFAULT_LOAD );

          }

      Trace down to "WICED/platform/MCU/wiced_dct_internal_common.c : static wiced_result_t wiced_dct_load( const image_location_t* dct_location )" I see a possible bug :

          while ( size > 0 )

          {

              uint32_t write_size = MIN( sizeof(buff), size);

      #ifdef KEEP_POSSIBLE_STOCK_SDK_BUGS // same possible bug for SDK-3.7.0

              if (wiced_apps_read( dct_location, buff, offset, write_size) != 0)

      #else

              if (wiced_apps_read( dct_location, buff, offset, write_size) == 0)

      #endif

              {

                  if (platform_write_flash_chunk( (uint32_t)dest_loc, buff, write_size ) != 0)

                  {

                      return WICED_ERROR;

                  }

              }

       

              offset   += write_size;

              dest_loc += write_size;

              size     -= write_size;

          }

       

      With the original code I never successfully done restoring DCT.

      And the modified version above seems to work well in my tests so far.

       

      Cypress team :

      1. Please help confirm if this is a bug, and if the fix above is valid & solid in all cases.

      2. Is it possible to have a official git, which is bound w/ WICED forum accounts maybe, so we can send pull requests for possible bug fixes?

          It will be definitely beneficial to us developers to collect & examine all possible bug / fixes spread out there in forum discussions.

          I believe Cypress will also profit from something like this.

          Or maybe you can consider some other related suggestions such as Do you consider to make pre-release SDK public ?