WICED Multi-Application Support Question

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

In 3.1.1 8 binary is supported for external flash, i understand that the last 3 are free to use but how do i predefine the size of each Application (0 to 3)?

PS. I can successfully set the size on run time but it looks like the size you set for the very first time cannot be changed afterward. Eg, calling wiced_framework_app_erase doesn't do the work. That means i will have to set the size on runtime for the first time to be much larger in case for future App update the size is bigger. I believe there should be a place that you can predefine the size somewhere when building the project.

Thanks in advance

12 Replies
Anonymous
Not applicable

Hi,

The files are set during build time by setting the APP0, APP1 and APP2 make variables in the make files (  have a look at ota_fr.mk for an example). The file size at this point is the size of the file the variable is pointing to (rounded to the nearest page size). At run time the size of the file can by set by calling wiced_framework_app_set_size (again the size of the file will be rounded to the nearest page size). Currently there is make variable that can set the size of the file at build time.

Regards,

Bassem

0 Likes
Anonymous
Not applicable

Hi Bassem,

I think there is a bug in API below.. See the fix and let me know if its accurate. With original code it will fail with a write in the end if update same App index on third time (providing that the size is bigger on each update).

static wiced_result_t wiced_apps_get_physical_address( app_header_t *app_header, uint32_t offset, uint32_t* address, uint32_t* size )

{

    uint8_t  index;

    uint32_t current_offset = 0;

    for ( index = 0; index < app_header->count; index++ )

    {

        uint32_t current_size = app_header->sectors[ index ].count * SFLASH_SECTOR_SIZE;

        if ( ( offset >= current_offset ) & ( offset < ( current_offset + current_size ) ) )

        {

            uint32_t diff = offset - current_offset;

            *address = app_header->sectors[ index ].start * SFLASH_SECTOR_SIZE + diff;

            *size = current_size - diff;

            return WICED_SUCCESS;

        }

#if 0 //Original - Bug

        current_offset = app_header->sectors[ index ].count * SFLASH_SECTOR_SIZE;

#else //Fixed version

        current_offset += app_header->sectors[ index ].count * SFLASH_SECTOR_SIZE;    

#endif

    }

    return WICED_ERROR;

}

Anonymous
Not applicable

Hi aaron,

Thank you for the feedback, yes you are correct this was a bug. The fix  should be in WICED-SDK-3.1.3 (yet to be released).

Thanks,

Bassem

0 Likes
Anonymous
Not applicable

Hi Bassem

Here is another one... Please check below.

wiced_result_t wiced_apps_erase( const image_location_t* app_header_location )

{

    sflash_handle_t sflash_handle;

    app_header_t    app_header;

    uint8_t         index;

    /* Loop on each entry and erase the sectors*/

    init_sflash( &sflash_handle, PLATFORM_SFLASH_PERIPHERAL_ID, SFLASH_WRITE_ALLOWED );

    sflash_read( &sflash_handle, app_header_location->detail.external_fixed.location, &app_header, sizeof(app_header_t) );

    for ( index = 0; index < app_header.count; index++ )

    {

        unsigned long sector;

#if 0 //Original - Bug

        for ( sector = 0; sector < app_header.sectors[ index ].start; sector++ )

#else //Fix

        for ( sector = 0; sector < app_header.sectors[ index ].count; sector++ )

#endif

        {

            sflash_sector_erase( &sflash_handle, ( app_header.sectors[ index ].start + sector ) * SFLASH_SECTOR_SIZE );

        }

    }

    return WICED_SUCCESS;

}

Anonymous
Not applicable

Thanks for that, we will be releasing a patch for 3.1.2 later, hopefully those two bugs will be in included.

0 Likes
Anonymous
Not applicable

Just a hint regarding wiced_apps_erase, The wiced_apps_write_chnunk has an erase per write in it. So wiced_apps_erase is not usually needed when rewriting applications (as it spends a long time erasing the flash which may sometimes timeout connections).

0 Likes
Anonymous
Not applicable

While applying this patch at the wiced_apps_common.c,  module is not working.

SDK 3.1.2

Module : 4390

Project : demo.s2w-BCM94390WCD2-FreeRTOS-LwIP download download_apps

// we have issues, for the FR_APP download and testing at the boot-loader by pressing SW1,

// while copying  FR DCT and FR APP , it seems to be garbage because of addressing.

// if anybody has face this problem, please share about it.

// Factory reset is working well at BCM43362 module.

wiced_result_t wiced_apps_erase( const image_location_t* app_header_location )

{

    sflash_handle_t sflash_handle;

    app_header_t    app_header;

    uint8_t         index;

    /* Loop on each entry and erase the sectors*/

    init_sflash( &sflash_handle, PLATFORM_SFLASH_PERIPHERAL_ID, SFLASH_WRITE_ALLOWED );

    sflash_read( &sflash_handle, app_header_location->detail.external_fixed.location, &app_header, sizeof(app_header_t) );

    for ( index = 0; index < app_header.count; index++ )

    {

        unsigned long sector;

#if 0      // original

        for ( sector = 0; sector < app_header.sectors[ index ].start; sector++ )

#else     // alex damosys from wiced forum

        for ( sector = 0; sector < app_header.sectors[ index ].count; sector++ )

#endif

        {

                        sflash_sector_erase( &sflash_handle,(unsigned long) ( app_header.sectors[ index ].start + sector ) * SFLASH_SECTOR_SIZE );

        }

    }

    return WICED_SUCCESS;

}

static wiced_result_t wiced_apps_get_physical_address( app_header_t *app_header, uint32_t offset, uint32_t* address, uint32_t* size )

{

    uint8_t  index;

    uint32_t current_offset = 0;

    for ( index = 0; index < app_header->count; index++ )

    {

        uint32_t current_size = app_header->sectors[ index ].count * SFLASH_SECTOR_SIZE;

        if ( ( offset >= current_offset ) && ( offset < ( current_offset + current_size ) ) )

        {

            uint32_t diff = offset - current_offset;

            *address = app_header->sectors[ index ].start * SFLASH_SECTOR_SIZE + diff;

            *size = current_size - diff;

            return WICED_SUCCESS;

        }

#if 1 // orginal

        current_offset = app_header->sectors[ index ].count * SFLASH_SECTOR_SIZE;

#else         // alex damosys from wiced forum

        current_offset += app_header->sectors[ index ].count * SFLASH_SECTOR_SIZE;

#endif

    }

    return WICED_ERROR;

}

0 Likes
Anonymous
Not applicable

@manulsan, Can you please explain more your case?

0 Likes
Anonymous
Not applicable

Hi badwood

   Please refer below information.

   1. SDK 3.1.2

   2. Module : SPIL's 4390 SIP ( MCU+MEM+FLASH...) as one chip

   3. Issue :

         - While test Factory Reset( Factory APP & Factory DCT), copy mecanism for recovery.

           BCM43362 does it work well, but this 4390 module can not do recovery ( recovery failed )

         - BCM43362 module and BCM4390 module seems to have different flash operation

           I think differences as below:

                  43362 module has two flash , one is MCU inside for application, another is external serial flash to write

                            FR_APP and FR_DCT and more app for copy.

                            While boot-loader checked for "Factory Reset" by pressing SW1, it make copy from external serial

                            flash to MCU's flash.

                  45390 SPIL : it seems to have one flash 2MB in SIP and seems to manage like partition based.

                                      With my survey, it has following flash map ( This is my survey not confirmed information

                                      and  I regard sector size as 0x1000(4096) to get address from sector

                                             "addr"                  "content"

                                                           0 :      "DCT "

                                           0x00010000 : boot-loader

                                           0x00020000: LUT(lookup table)

                                           0x00021000: FR_APP

                                                          (below address depends on size of app)

                                           0x00074000:  DCT Image    <-- sector 116

                                           0x00076000: File System    <-- sector 118

                                           0x00148000: APP 0            <-- sector 328

                            

                                  So I think as below operation for "Factory Reset"

                                   - Copy "FR_APP( 0x00021000)" to "APP 0(0x00148000)"

                                 Result: While copying and rebooting, module does not boot-up

  4. Work-around

      Because of this problem, I referred you thread( information at the forum ).  Your information seems to valid so

     I applied it. but while compiling and downloading the firmware. Module is not boot-up

     It makes booting problem in BCM4390 Module.

Thanks      

0 Likes
Anonymous
Not applicable

Hi,

The OTA is configured per platform. These configurations includes setting start sector and start address of your serial flash. OTA is configured for Broadcom boards. if your are not using a BCM94390WCD2 board, It is up to the board manufacturer to support (configure) the board  for OTA.

However, please post your logs, so that I can see what is happening.

Regards,

Bassem

0 Likes
Anonymous
Not applicable

Hi

We have tested with Broadcom board. It also have same problem.

I think that we are missing some of points.

1.  we made two project for easy tests

    1) snip.scan-BCM94390WCD2-FreeRTOS-LwIP  download download_apps WIPE=1 run

        - we modified .mk file for FR_APP and DCT as below

           FR_APP := $(OUTPUT_DIR)/binary/$(CLEANED_BUILD_STRING).stripped.elf

          DCT_IMAGE := $(OUTPUT_DIR)/DCT.bin

       ==> In console widnow, FR_APP seems to be written.

    2) snip.scan-BCM94390WCD2-FreeRTOS-LwIP  download 1 run

       - We put the some of print-out message to show changed firmware in scan.c

          added line : WPRINT_APP_INFO( ( "This is new firmware.\n" ) );

       - we compile it, downloaded it  and thought that we downloaded new firmware in APP 0

2. We are thinking that we have following flash image

      APP0      : Lastest downloaded F/W which has message output "This is new firmware"

      FR_APP : Factory Reset app is written.( Original F/W )

3. For the factory Reset test,

     1)  Pressing SW1

     2)  Power On

     3) Checking LED blinking for 5 seconds and Release SW1 button

     4) Waiting  for a while ( Let the MCU copt FR_APP to APP 0 area)

4. Conclusion

     Module does not boot-up

Can you duplicate  in your Lab ?

TKS

      

 

0 Likes
Anonymous
Not applicable

Hi

This is not the OTA  issue, this is "Factory Reset" issues.

TKS

0 Likes