9 years, 3 months ago.

Unreasonable filesize after compulation?

The problem I have is that the file I get after compiling becoming too big to fit to my memory. The blinky example generates a HEX file of 239kb.

I have tried compiling different files with the same result.

/media/uploads/kezoo/capture1.png Build details

/media/uploads/kezoo/capture2.png Resulting file

(I am new to mbed and might very well have done something wrong)

Thankful for help!

Edit: I have a nRF51 Dongle with PCA10031 board and nRF51422 chip

Turns out it works all along, I just have to reboot after installing. The help I got in understanding the relationship between HEX and BIN was really helpful, thanks a lot :)

posted by Robin Savelid 14 Sep 2015

1 Answer

9 years, 3 months ago.

Most mbed systems use a .bin file which should be the exact size of the binary data.

It looks like the Nordic nRF51-Dongle is different in that it uses a .hex for programming. A hex file is a text file rather than raw binary data, it's going to be several times larger than the binary data. I'm not quite sure why it's so much larger than the compiler reports, that seems excessive, but I get the same result here.

I don't have the same board as you here so I can't test it further but I don't think you've done anything wrong with your setup.

P.S. In future posts it helps if you say which mbed board you are using in your post.

Accepted Answer

The compiler build summary reports the binary size, not the hex size. The compiler generates hex for all nRF platforms as far as I have seen. I think there is also an issue with the precompiled BLE stack that takes up a chunk of memory which is not included in the compiler build window information,

posted by Wim Huiskamp 11 Sep 2015

Thank you for your answer. I thought I might try to convert the .hex file to a .bin before transferring. Could that be a possibility? Anyway it will have to wait for Monday :)

posted by Robin Savelid 12 Sep 2015

You could convert the hex to a bin file but what is the point? I think the onboard programmers on the mbed nRF platforms will only accept hex files. The hex file is just an intermediate format that only takes up some space on your PC. The onboard or external programmer (eg jlink) will do the necessary conversions from hex to bin and in the end only the bin will be flashed into the device memory.

posted by Wim Huiskamp 12 Sep 2015