I am working with an STM32F103C8 which has a flash size of 64kBytes.

Now i am using ChibiOS 2.6 and the build file is a binary file of 82kBytes.

Using ST-Link Utility, the program is getting dumped into the microcontroller's flash.

My question is how come a 82kB code fits in the 64kB Flash?

How is the size of that .bin calculated? I am attaching a picture of the display.

I did a compare ch.bin with device memory and it doesn't report any errors found.

All parts of the code work just fine, i don't see any problems anywhere tried all the features of the code, nothing breaks or behaves abnormally.

Could someone please explain this?


STM32 ST-Link Image


1 Answer 1


I see that the STM32F103x8 has 64 KB of Flash + 20 KB of SRAM = 84 KB of memory -- is it a coincidence that your build file is close to that size?

Many microcontroller development systems store the final compiled executable in a "binary" file in Motorola S-record format or Intel HEX format or some other format that uses 2 byte of disk space to store 2 hexadecimal digits in the file for each byte of programmable memory in the chip, plus a little more metadata overhead. An executable file that almost completely filled 64 KB of Flash would, when stored in any of those hexadecimal formats, use close to 128 KB disk space. Does your build system perhaps use such a hexadecimal format?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.