cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Wi-Fi Combo

GeEs_4724546
New Contributor II

On an STM32F4 based board...

When hitting ota2_bootloader.c::ota2_failsafe_app_load() the entry point is a flash address  0x800c3e5 but it hasn't been loaded into internal flash from SFlash.   I see ota2_failsafe_app_load() erasing (internal?) flash:

/* Erase the application area */
result = ota2_failsafe_app_area_erase( flash_location, &header );

Then reading into RAM from flash:

result = ota2_failsafe_app_read( flash_location, (uint8_t*)prog_header.physical_address, prog_header.data_offset, prog_header.data_size_in_file );

But danged if it's obvious how internal flash get's written!  It is quite clear in wiced_waf_common.c::wiced_waf_app_load():

result = platform_load_app_chunk( app_header_location, offset, (void*) prog_header.physical_address, prog_header.data_size_in_file );

Thanks!

Geoff

 

 

0 Likes
4 Replies
Charles_Lai
Moderator
Moderator

Hi,

Could you try to post your code or the complete log output? We need more information to identify the cause.

Best regards

0 Likes
GeEs_4724546
New Contributor II

I'm using WICED-SDK 6.4 and the stock ota2_bootloader.c and ota2_failsafe.c (which is stuffed into sflash).   The only change made was for test purposes, I added:

dct_ota2_config.boot_type = OTA2_BOOT_FAILSAFE_FACTORY_RESET;

Simply so I can verify it would load and run failsafe.  Previously, I had used ModusToolbox to run ota2_failsafe without any problem.   There's no output because the ota2_bootloader does select the failsafe path, but then jumps into a hardfault.   That led me to wonder how the sflash image was being copied into iflash.   Unless the ota2_failsafe image is supposed to run entirely out of SRAM, I couldn't follow the ota2_bootloader logic.

0 Likes
GeEs_4724546
New Contributor II

This is the fix... sorry not pretty:

uint8_t buff[ 64 ];
while ( size > 0 )
{
uint32_t write_size = MIN( sizeof(buff), size);

result = ota2_failsafe_app_read( flash_location, buff, offset, write_size );
platform_write_flash_chunk( (uint32_t) physical_address, buff, write_size );

The original code did not read into an SRAM buffer and then into iflash (with platform_write_flash_chunk).  The only way it might have worked is if the failsafe was linked to execute out of SRAM.

0 Likes
AditiB_81
Moderator
Moderator

Hi,

Just to ensure, have you followed section-8 "Adding OTA2 to a new platform" of WICED OTA2 Update Support provided in Wiced Studio? Location- 

43xxx_Wi-Fi\doc\WICED-OTA2.pdf

Thanks

Aditi

0 Likes