SDK 3.5.2 and SDK 3.7.0 error (OTA)

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

cross mob
Anonymous
Not applicable

static wiced_result_t wiced_dct_load( const image_location_t* dct_location )

{

    elf_header_t         header;

    elf_program_header_t prog_header;

    uint32_t             size;

    uint32_t             offset;

    uint32_t             dest_loc = PLATFORM_DCT_COPY1_START_ADDRESS;

    uint8_t              buff[64];

    /* Erase the application area */

    wiced_dct_erase_non_current_dct( dest_loc );

    /* Read the image header */

    if (wiced_apps_read( dct_location, (uint8_t*) &header, 0, sizeof( header ) ) != 0)

    {

        return WICED_ERROR;

    }

    if ( header.program_header_entry_count != 1 )

    {

        return WICED_ERROR;

    }

    if (wiced_apps_read( dct_location, (uint8_t*) &prog_header, header.program_header_offset, sizeof( prog_header ) ) != 0)

    {

        return WICED_ERROR;

    }

    size   = prog_header.data_size_in_file;

    offset = prog_header.data_offset;

    while ( size > 0 )

    {

        uint32_t write_size = MIN(sizeof(buff), size);

        //if (wiced_apps_read( dct_location, buff, offset, write_size) != 0)                {

        if (wiced_apps_read( dct_location, buff, offset, write_size) == 0)//Darius - if read ok, so need write

        {

            if ( platform_write_flash_chunk(dest_loc, buff, write_size ) != 0)

            {

                return WICED_ERROR;

            }

        }

        offset   += write_size;

        dest_loc += write_size;

        size     -= write_size;

    }

    return WICED_SUCCESS;

}

0 Likes
1 Reply
AxLi_1746341
Level 7
Level 7
10 comments on KBA 5 comments on KBA First comment on KBA

FYI, similar issue was reported here:

https://community.cypress.com/thread/7562

BTW, even with your change, the code does not return error if wiced_apps_read() fails.

0 Likes