Size of firmware is more than 512kb, where does it go?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Size of firmware is more than 512kb, where does it go?

555 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by khmtambi on Sun Sep 21 10:40:26 MST 2014
Hello guyz!

I have a board similar to keil 1700mcb board. Among one of the examples I have a hex file that is 702Kb and I know that flash in my MCU is 512Kb. When I program the flash via J-link it programs successfully and the firmware is working just fine with all the routines. I want to ask where does the firmware get stored if the size of the firmware exceeds the size of flash. I have a 2MB SPI flash connected on the hardware. Perhaps the image gets stored there?

Your replies and shared info are all welcomed and appreciated.

Thanks
Labels (1)
0 Kudos
2 Replies

530 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by khmtambi on Mon Sep 22 00:15:04 MST 2014
Thanks for the reply, it was really helpful. Though I havent tried the hextobin like software but I did some research on internet and found someone saying exactly as you said:

"Well, there is an important factor at play, here.
A hex file it at least 2X larger than the flash byte size. That is because it uses 2 ASCII characters per BYTE (and a character is the same size as a byte) PLUS another 10% or so "overhead" (byte addresses and such)."

Ok I think this answers my question but I would like to ask one more thing while this discussion is open. How do i load firmware in the SPI flash that i have connected via SPI? and boot the firmware from the same SPI flash.

Thanks again!
0 Kudos

530 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Sun Sep 21 10:59:54 MST 2014
The size of the hex file is not equal to the size of the flash.
In a hex file each byte is represented by 2 printable bytes.
But there is also additional info before and after the data.

Therefore the real size is (usually? *1*) smaller than half of the size of the hexfile.
E.g. for your example the 702 kBytes get down to a size of around 351 kBytes.

Note *1*: There could also be a gap in the data in a hex file,
e.g. if there is an area, which is not used, so a very small hexfile
can also result in a big binary file.

If you want to see the real data and size, you can try one of the hex2bin
programs, if you don't have one, there are various available downloadable from the internet.

Or generate a *.map file and look where your code has been located to.

Also see
http://support.code-red-tech.com/CodeRedWiki/FlashRamSize
http://stackoverflow.com/questions/9725268/why-does-arm-none-eabi-size-report-the-data-section-to-be...
http://carrierwave.wordpress.com/2009/08/15/how-arm-is-compiled/
0 Kudos