cancel
Showing results for 
Search instead for 
Did you mean: 

Wireless stack and FUS image addresses for upgrading

YWor.1
Associate III

Hello.

I'm planning a project that will use large amount of flash memory, therefore, I will need to be cautious with memory saved for app updates.

I'm using STM32WB55VGQ6 with 1MB of flash memory on custom designed board. my current application is about 300KB and it will grow larger.

I read in AN5185 document that when I send FUS_FW_UPGRADE command, there is an option to add address for image location and image destination. When I started to check this option, I have read @Remi QUINTIN in https://community.st.com/s/question/0D53W00001MwMvLSAV/shcic2fusfwupgrade-usage that this option is not used and FUS knows to locate the image address by finding some magic word and it finds the destination by itself. I wanted to know if this feature is optionally and can I use it by sending these 2 parameters with FUS_FW_UPGRADE command?

Another question, if I'm deleting current BLE stack before updating, will the FUS move the SFSA address forward and make some more user space in the flash memory?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Remy ISSALYS
ST Employee

Hello,

The formula in the AN5185 will be updated soon. According to this update, use the following formula to calculate the most optimized download address:

1/ When the update is larger that the running wireless Firmware:

Download Addr = OldStackAdd(=SFSA) - NewStackSize(4Kb aligned) - 1 Sector

2/ When the update is smaller that the running wireless Firmware:

Download Addr = OldStackAdd(=SFSA) - NewStackSize(4Kb aligned)

I have perform some tests and there isn't any problem to update wireless stack between v1.10 and v1.13.

  • Full stack v1.10 to full stack v1.13, see formula 2 :
    • Download Addr = OldStackAdd(=SFSA) - NewStackSize(4Kb aligned) = 0x080CB000 - 0x00024000 = 0x080A7000

  • Full stack v1.13 to full stack v1.10, see formula 1:
    • Download Addr = OldStackAdd(=SFSA) - NewStackSize(4Kb aligned) - 1 Sector = 0x080D0000 - 0x00029000 - 0x00001000 = 0x080A6000

Best Regards

View solution in original post

13 REPLIES 13
Remy ISSALYS
ST Employee

Hello,

The FUS is not using the source address (nor the destination address) as it looks for some magic word starting from the beginning of the Flash memory, so you can't use FUS_FW_UPGRADE command with these 2 parameters, this feature isn't available.

For your second question, indeed when you delete your current BLE stack, the FUS will move the SFSA address forward in order to protect only the FUS and make more user space in the flash memory.

Best Regards

Thanks. I have another question about the upgrade procedure.

After FUS finds this magic word, where will it install this new FW? will it be installed in the same address it finds it, or will it somehow move this image up the flash memory to an optimal address. my experience with stm32cubeProgrammer and Nucleo board, it seems that FUS installs this image in the same address it finds it and SFSA is set to the the address written in "Start address".

Remy ISSALYS
ST Employee

Hello,

After FUS finds this magic word, there is two cases:

> If there is only the FUS, the new FW will be installed in the same address the FUS finds it and set the SFSA at this address.

> If there is already a wireless stack, the new FW will be installed at the optimal address

Best Regards

So in order to keep as much free space as possible, I will need to receive the new FW and save it somewhere, then delete the current FW, move the new one to the correct place and begin the upgrade procedure. Is it correct?

What happens with FUS upgrade procedure, where do I need to place it in memory and will it be installed in the address it is placed (like stack FW) or that in FUS upgrade, FUS itself knows to move this image and place it in the correct space?

Thanks.

Remy ISSALYS
ST Employee

Hello,

For wireless stack, we can do this but you can simplify the procedure:

> Receive the new FW and save it somewhere between the end of your application and the start of secure part (SFSA)

> Send FUS_FW_UPGRADE command, this command allows to check the new FW and delete the current FW and install the new FW at the optimal address instead of old FW.

For FUS upgrade, download and save the new FUS FW between the end of your application and the start of secure part (SFSA), then the FUS knows itself the right place to move the image and install it.

Best Regards

Hi.

Thanks for clarifying both, stack and FUS, update procedure.

Just one more issue. I was trying to test the procedure with some test cases. Using ST OTA application with some changes I made so the update procedure will start when button 3 was pressed. All tests was working as you described except for the case when the new FW size was bigger than current image size (for example BLE_Stack_full_fw vs BLE_Stack_basic_fw or 1.13 version vs 1.10 version). In those cases, no matter what was the address I loaded the new image to, new image was kept in memory at the same address it was loaded to, SFSA stayed as before and wireless stack was working as before, like nothing happened.

Any idea what may be the reason and how can I solve this problem?

Thanks again.

Yair.

Remy ISSALYS
ST Employee

Hello,

Can you describe a bit more your test ? Can you give the address where the new image is loaded and the third digit of the stack version and SFSA value ?

Best Regards,

Remy

The relevant tests are when BLE stack is already installed at several different addresses, 0x080A2000 (arbitrary address) ,0x080D1000 (for 1.13  BLE_Stack_basic_fw) and 0x080CB000 (for 1.10  BLE_Stack_full_fw). New image to be updated was loaded to address calculated with formula written in AN5185 document:

(current_FW_address - (2 * new_image_size - current_FW_size)).

It was also tested with some lower arbitrary addresses like 0x08070000.

SFSA was set according to current stack installed, like detailed above, and did not changed after update procedure was ended.

Thanks for helping.

Yair.

Remy ISSALYS
ST Employee

Hello,

Have you perform a flash erase of memory regions between the end of your application and SFSA, in order to clean the flash memory before loading the new image ?

Best Regards