6 Replies Latest reply on Aug 20, 2016 5:46 AM by chintan

    Possible 3.5.2 bug in wiced_framework_set_boot()

    garywiz

      I wonder if it's possible that there was a bug introduced in 3.5.2 that caused wiced_framework_set_boot() to fail.

      We have developed our own OTA system, and in 3.5.2 the following returns WICED_ERROR:

         result = wiced_framework_set_boot( DCT_APP0_INDEX, WICED_FRAMEWORK_LOAD_ONCE );

      I traced this down finally to some code in wiced_waf_common.c that I believe is now erroneous considering the changes to the way wiced_dct_write() has been modified under 3.5.2.   The existing code looks like this:

      wiced_result_t wiced_waf_app_set_boot(uint8_t app_id, char load_once) 
      {
           boot_detail_t boot;
           boot.entry_point                 = 0;
           boot.load_details.load_once      = load_once;
           boot.load_details.valid          = 1;
           boot.load_details.destination.id = INTERNAL;

           if ( wiced_dct_get_app_header_location( app_id, &boot.load_details.source ) != WICED_SUCCESS )
           {
               return WICED_ERROR;
           }
           if ( wiced_dct_write( &boot, DCT_INTERNAL_SECTION, OFFSETOF( platform_dct_header_t, boot_detail ), sizeof(boot_detail_t) ) != WICED_SUCCESS )
           {
               return WICED_ERROR;
           }
           return WICED_SUCCESS;
      }

      I noted that a new function was introduced in 3.5.2 to do the job of setting boot parameters.  I modified the above code to look like the following:

      wiced_result_t wiced_waf_app_set_boot(uint8_t app_id, char load_once)
      {
           boot_detail_t boot;
           boot.entry_point                 = 0;
           boot.load_details.load_once      = load_once;
           boot.load_details.valid          = 1;
           boot.load_details.destination.id = INTERNAL;

           if ( wiced_dct_get_app_header_location( app_id, &boot.load_details.source ) != WICED_SUCCESS )
           {
               return WICED_ERROR;
           }
           return wiced_dct_write_boot_details ( &boot );
      }

      I'd just like to confirm that what I've done is correct, and that there is indeed a bug.  Or, if I am missing something, please let me know.