cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE memory usage units (KB vs KiB) inconsistency

Hadi_sy3
Visitor

Dear STM32CubeIDE Support Team,

while analyzing the memory usage of my STM32 project, I noticed a potential inconsistency in how memory units are displayed in STM32CubeIDE.

Both the Build Analyzer and the memory overview label the values as “KB”, but the reported numbers clearly correspond to KiB (1024 bytes) rather than kB (1000 bytes). This behavior matches the output of arm-none-eabi-size, which reports sizes in bytes.

For example:

  • arm-none-eabi-size reports Flash usage as:

    • text + data = 64824 + 148 = 64972 bytes

  • Converted to kB (1000 bytes), this would be:

    • 64.972 kB

  • However, STM32CubeIDE displays:

    • 64972 / 1024 = 63.45 KiB, while labeling the unit as “KB”

As a result, summing RAM and Flash values only produces consistent results when interpreting the displayed “KB” values as KiB. The current labeling can therefore be confusing, especially when documenting or comparing memory usage.

I have attached two images that illustrate this behavior and show the comparison between arm-none-eabi-size and the STM32CubeIDE memory analysis.

I wanted to report this observation and ask whether the use of the “KB” label is intentional or if a clarification or correction is planned.

Thank you for your time and support.

Best regards,
Hadi Althiab

9 REPLIES 9
Souhaib MAZHOUD
ST Employee

Hello @Hadi_sy3 

Thank you for highlighting this issue.!

I will check this internally with the dedicated team and get back to you ASAP.

KR, Souhaib

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Andrew Neil
Super User

Many people are still not aware of KiB, and still use KB for 1024B (and kB for 1000B)

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
gbm
Principal

Please add my vote for coherent migration to the proper units - KiB/MiB in the whole ST ecosystem.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice

>Many people are still not aware of KiB, and still use KB for 1024B

...as i do.

+

AI says:

1 KB (Kilobyte) = 1024 Bytes 

+

"1 KB" means 1024 bytes (as Windows would report it, traditional usage) 

"1 kB" means 1000 bytes (as Mac OS would report it, IEC usage) 

"1 KiB" means 1024 bytes (unambiguous, but perhaps unfamiliar terminology)

 

So whats the problem then, if IDE uses KB = 1024B ? is correct.

If you feel a post has answered your question, please click "Accept as Solution".
TDK
Super User

I don't think it should be changed, especially here. If you have 128 kB of RAM, and it says "127.99" used, you know where that is. Memory capacity on ST chips is done by 1024, not 1000. As it is on most (all?) other microcontroller manufacturers.

Are we going to modify every single technical document that ST has made? No, this not a worthwhile endeavor.

TDK_0-1766416957420.png

Not a fan of people re-defining terms. kB has been 1024 for a long time.

 

The "KiB" term is just not commonly used. If the industry adopts it, then it makes sense to change. But that hasn't happened.

TDK_1-1766417221505.png

 

If you feel a post has answered your question, please click "Accept as Solution".
Andrew Neil
Super User

The title says, "inconsistency" - but it seems to be consistently using K (uppercase) = 1024 ?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
gbm
Principal

The binary multiples are standard for over 12 years. We, engineers, should follow the standards. The technical documents should use proper, formal and standard units of measure. KB does not exist in standard world; it's just old and definitely bad convention. And MB used as 2**20 Bytes is even worse.

Binary multiples are definitely a way to go to avoid further confusion. Everywhere - in all the newly-created documents at least.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice

That is correct when using the distinction between lowercase k and uppercase K as described by @AScha.3. I did not know that there is a difference between "k" and "K". 


@TDK wrote:

kB has been 1024 for a long time.

 

 No, the lowercase k has been 1000 for the longest time (think km, kg - 18th century).

The uppercase K for 1024  was introduced only in the age of digital computers - when powers of 2 came to prominence (mid/late 20th century).

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.