cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE memory usage units (KB vs KiB) inconsistency

Hadi_sy3
Associate

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

12 REPLIES 12

The world uses it inconsistently:

  • RAM manufacturers use 1024
  • non volatile storage manufacturers use 1000 if the unit is Bytes (i.e. 1TB SSD)
  • non volatile storage manufacturers use 1024 if the unit is bits (i.e. 1kbit EEPROM)
  • Prior to 2009 Apple used 1024, after 2009 they use 1000
  • Windows and Linux use 1024
  • for network speed 1000 is used

In my code I always use KiB for 1024 to avoid ambiguity.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

"kiB" does not exist. KiB is the right symbol.

And mass storage manufactures use GB/TB because 1 TB SSD sells better than 960 GiB one although its exactly the same unit.

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

@gbm wrote:

"kiB" does not exist. KiB is the right symbol.


I never knew. In SI a kB has lower case k to distinguish it from Kelvin. In SI all preferences below 106 are lower case. But I guess binary prefix breaks consistency with SI here and instead has internal consistency by making them all upper case.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.