2 Replies Latest reply on Aug 23, 2018 6:52 PM by mifo

    ota2 wicedfs_init failing

    nickmckendree_1688136

      In my application, I have built all images for ota2 with the final one being ota2_manuf_download.

       

      • Built extraction app
      • Built ota2_image
      • Built otat factory image
      • built ota2 manufacturing image (with -debug added to platform).

       

      When I run the application, it fails during wicedfs_init with a -2.

      fs_header elements are all 1's.

       

      SDK = 6.2.0

      platform_result_t platform_filesystem_init( void )

      {

          int             result;

       

       

          if ( fs_init_done == 0)

          {

              if ( init_sflash( &wicedfs_sflash_handle, 0, SFLASH_WRITE_NOT_ALLOWED ) != WICED_SUCCESS )

              {

                  return PLATFORM_ERROR;

              }

       

       

      #if (DCT_BOOTLOADER_SDK_VERSION < DCT_BOOTLOADER_SDK_3_1_2)

              /* this SDK does not have apps_locations in bootloader_dct_header_t (platform_dct_header_t for the SDK) */

      #else

              if ( wiced_framework_app_open( DCT_FILESYSTEM_IMAGE_INDEX, &fs_app ) != WICED_SUCCESS )

              {

                  return PLATFORM_ERROR;

              }

      #endif /* (DCT_BOOTLOADER_SDK_VERSION < DCT_BOOTLOADER_SDK_3_1_2) */

       

       

            result = wicedfs_init( 0, read_callback, &resource_fs_handle, &wicedfs_sflash_handle );

              wiced_assert( "wicedfs init fail", result == 0 );

              fs_init_done = ( result == 0 ) ? 1 : 0;

              return ( result == 0 ) ? PLATFORM_SUCCESS : PLATFORM_ERROR;

          }

          return PLATFORM_SUCCESS;

      }

      int wicedfs_init ( wicedfs_usize_t base, wicedfs_read_func_t read_func, /*@out@*/ wicedfs_filesystem_t* fs_handle, /*@dependent@*/ void * user_param )

      {

          wicedfs_filesystem_header_t fs_header;

          wicedfs_usize_t             bytes_read;

       

       

          WICEDFS_CHECK_PARAMS ( ( read_func == NULL ) || ( fs_handle == NULL ), -1 );

       

       

          /* Read the filesystem header */

          bytes_read = read_func( user_param, &fs_header, (wicedfs_usize_t) sizeof(fs_header), base );

          if ( bytes_read != sizeof(fs_header) )

          {

              return -1;

          }

       

       

          /*@-usedef@*/ /* Lint: splint does not pick up 'out' annotation of function pointer read_func */

       

       

          /* Check the magic number and version matches */

          if ( ( fs_header.magic_number != WICEDFS_MAGIC ) ||

               ( fs_header.version != (uint32_t) 1 ) )

          {

              return -2;

          }

       

       

          /* Save the hardware address of the root directory

           * in the filesystem handle for use by other functions

           */

          fs_handle->root_dir_addr = base + fs_header.root_dir_offset;       /*@+usedef@*/

          fs_handle->read_func     = read_func;

          fs_handle->user_param    = user_param;

       

       

          return 0;

      }