cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55RG : Flash memory available for user application

Steven.D
Associate II

Hi all,

I'm trying to determine how much FLASH memory will be available for my user application. I'm using an STM32WB55RG. I don't do this quite often so I could use some help

I got clues from different sources but i'm not sure which one is correct :

  • Given from the "stm32wb5x_FUS_fw.bin" + "stm32wb5x_BLE_Stack_fw.bin" files size, 186kB should be occupied. So I deduc that 838kB are available for user app.
  • In the MOOC for the STM32WB workshop, it's said that the size allocated for the upper block of flash depends on the technology and the addons used (they say 80kB for BLE stack, and 160-170 for BLE+OTA). This seems weird as the size for the BLE stack file is 162kB.
  • Inside AN5185, the Table 5. Device information table tells us that both the FUS and the wireless stack can use up to 65535 sectors of 4K -> For me, this means that they could take 256kB each, leaving us with 512kB for the user application. If this is true, I guess there is not many cases in which this will happen.

If someone is willing to explain to me what is the correct procedure and what is wrong with the others, that would be really valuable for me!

4 REPLIES 4
Vyacheslav
Senior II

Hi, Steven.

The easiest way: if there is a stack, then the first secure sector indicates the maximum size of user space.

Get SFSA register and multiply by 0x1000.

Assuming a stack update, subtract the stack size and bootloader size from this value.

This will be what you need.

Regards,

Vyacheslav.

Steven.D
Associate II

Thanks for the answer Vyacheslav ! :)

Ok so I have SFSA = 0xCB, given your calculation this gives me 812kB available. This is close to what I found by adding the size of the files : FUS + stack_ble (838kB availaible). Just for the info, do you have any idea what is missing in this calculus ?

Also, assuming a stack update. Do you know how much flash size should be reserved for the stack so we have a safe way to be sure there will be no future conflic with our user app ?

Vyacheslav
Senior II

For first question - answer by link from Remi Quintin begins as "A 1MB Flash device has a specific context: ...".

There is a strange memory situation in 1M chip :)

About second question: use AN5185 #2.1.1 "Operation instructions". My answer to Remi at the specified link.

If you read the whole thread, can it help you?

Personally, I use the algorithm as described in AN5185 #2.1.1 "Operation instructions" and everything works for me.

Remi QUINTIN
ST Employee

​Hi Steven

Your calculation is correct for the BLE stack alone => SFSA = 0xCB (BLE stack + FUS). This means indeed 838kB available for a user application.

Then if you want to use a BLE + Thread Stack , which is the biggest one (493KB => 496 KB for the 4K alignment = 0x7C000), a minimum of 56KB (0xE000 for the FUS) + 496 KB (0x7C000 for the RF stack) is required. This leads to a total 0x8A000 bytes to be reserved at the top of the Flash memory => 0x08100000 - 0x8A000 = 0x08076000 => Start address SFSA = 0x76. So this let a total of 0x76000 x 4KB = 483328 Bytes for a user application.

For any of the RF stack used, if you want to add the OTA feature, then you have to add the OTA application size (loaded at the begining of the 1MB Flash memory) which is 0x7000 = 28672 KBytes. The user application targeted to be updated through OTA should be loaded at address 0x7000. And so the maximum size allowed for it if you use the biggest RF stack (BLE + Thread) is 483328 KB - 28672 KB = 454656 KB (0x6F000).

Hope those calculations clarify your view.