2 Replies Latest reply on Apr 1, 2016 5:50 AM by rodu_2180346

    wiced_framework_app_get_size returns weird values

      Hello,

       

      I'm working on an application based on a custom board that includes external flash memory. Currently, I can manage to read/write from/into this memory, and now I would like to use it for OTA purpose. So, I started to research in the Application Management Functions provided by the framework.

       

      I started with a simple operation which consists of opening several apps and reading their size. Here is the sample code for one application:

       

         /*
          * DCT_APP0_INDEX
          */
         if( wiced_framework_app_open( DCT_APP0_INDEX, &app ) != WICED_SUCCESS ) {
            return WICED_ERROR;
         }
      
      
         if( wiced_framework_app_get_size( &app, &current_size ) != WICED_SUCCESS ) {
            return WICED_ERROR;
         }
      
      
         if( wiced_framework_app_close( &app ) != WICED_SUCCESS ) {
            return WICED_ERROR;
         }
      
      
         WPRINT_APP_DEBUG( ("[D - OTA] Current app size (at DCT_APP0_INDEX)\t\t: %lu bytes\n", (unsigned long)(current_size)) );
      

       

      The code is the same for every applications. And here is the output:

       

      [D - OTA] Current app size (at DCT_FR_APP_INDEX)              : 99913728 bytes
      [D - OTA] Current app size (at DCT_DCT_IMAGE_INDEX)           : 1965531136 bytes
      [D - OTA] Current app size (at DCT_OTA_APP_INDEX)             : 1848942592 bytes
      [D - OTA] Current app size (at DCT_FILESYSTEM_IMAGE_INDEX)    : 852418560 bytes
      [D - OTA] Current app size (at DCT_WIFI_FIRMWARE_INDEX)       : 2306969600 bytes
      [D - OTA] Current app size (at DCT_APP0_INDEX)                : 2316611584 bytes
      [D - OTA] Current app size (at DCT_APP1_INDEX)                : 2360836096 bytes
      [D - OTA] Current app size (at DCT_APP2_INDEX)                : 2349637632 bytes
      

       

      As specified in the documentation, wiced_framework_app_get_size is supposed to return the size of an application in bytes format.

       

      /** Returns the current size of the application.
       *
       * Returns the current size of the application.
       *
       * @warning The size of the application is always aligned to sector boundaries. Application
       *          size may be different from actual size on a PC.
       *
       * @param[inout] app : Application handler.
       * @param[out] size  : The size allocated to the application in bytes.
       *
       *  @return Wiced reuslt code
       */
      

       

      As you can see in the output, the function returns very strange values. I wonder if it is a normal behaviour (not yet stable part of SDK), or if it comes from my code.

       

      SDK version : WICED 3.3.1

      Microcontroller : STM32F415

      External memory chip : AMIC A25L

       

      Thanks in advance for your support !