Thursday, 6 March 2014

programming - Will my HEX file fit in my microcontroller?


I have a hex file with a size of 42 kB. Does the size matter while loading it in a microcontroller? Can I load 42 kB hex file in a ATMEGA32 chip which has a memory of 32 kB?



Answer



You can use avr-size to check the real size of your program:


[jpc@jpc sepack] avr-size sepack.elf 
text data bss dec hex filename
4396 6 277 4679 1247 sepack.elf

[jpc@jpc sepack] avr-size sepack.hex
text data bss dec hex filename
0 4402 0 4402 1132 sepack.hex

As you can see it works better with .elf files since it can also show you both how much ram you need (data+bss) and how much flash will be used (text+data). With the .hex file only shows you the second figure (labeling it data)


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...