cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Wi-Fi Combo

decac_1684766
New Contributor II

in the apps/waf/ota2_failsafe application that is built in by default for ota2 projects one of the first things it does is call wiced_ota2_image_extract_uncompressed_component to extract the APPS LUT.  This is in SDK 5.0.1

The first line in that function looks like this

    /* we only support LUT and OTA_APP */

    if ((component != WICED_OTA2_IMAGE_COMPONENT_LUT) && (component != WICED_OTA2_IMAGE_COMPONENT_OTA_APP))

    {

        OTA2_WPRINT_ERROR(("wiced_ota2_image_extract_uncompressed_component(%s) bad arg!\r\n", ota2_image_type_name_string[ota_type]));

        return WICED_BADARG;

    }

This looks incorrect as there is no way past this line unless component isn't LUT or OTA_APP, which is contrary to the comment.  Is this correct?

Should it instead be:

    /* we only support LUT and OTA_APP */

    if ((component != WICED_OTA2_IMAGE_COMPONENT_LUT) || (component != WICED_OTA2_IMAGE_COMPONENT_OTA_APP))

    {

        OTA2_WPRINT_ERROR(("wiced_ota2_image_extract_uncompressed_component(%s) bad arg!\r\n", ota2_image_type_name_string[ota_type]));

        return WICED_BADARG;

    }

Thank you!

1 Solution
PriyaM_16
Moderator
Moderator

My bad axel.lin_1746341 , devin_1684766 . I was wrong in my previous comment about the code. After carefully looking into the code, I found it is correct.

The explanation is:

if component == WICED_OTA2_IMAGE_COMPONENT_LUT , the condition will fail and it won't enter the if loop which implies no bad argument and

if component == WICED_OTA2_IMAGE_COMPONENT_OTA_APP, the condition will fail and it won't enter the if loop which implies no bad argument

Hence it supports only LUT and OTA_APP.

View solution in original post

3 Replies
PriyaM_16
Moderator
Moderator

It certainly seems incorrect. Thank you for pointing out the error. I have raised a ticket to take care of the matter.

Thank you.

0 Likes
AxLi_1746341
Honored Contributor

riya wrote:

It certainly seems incorrect. Thank you for pointing out the error. I have raised a ticket to take care of the matter.

Thank you.

Are you kidding? Please read the code.

0 Likes
PriyaM_16
Moderator
Moderator

My bad axel.lin_1746341 , devin_1684766 . I was wrong in my previous comment about the code. After carefully looking into the code, I found it is correct.

The explanation is:

if component == WICED_OTA2_IMAGE_COMPONENT_LUT , the condition will fail and it won't enter the if loop which implies no bad argument and

if component == WICED_OTA2_IMAGE_COMPONENT_OTA_APP, the condition will fail and it won't enter the if loop which implies no bad argument

Hence it supports only LUT and OTA_APP.

View solution in original post