Eventhough the bootloader hex file contains the entire flash space, space after first 4% should be filled with zeros.
If not, are you looking at the bootloadable hex file?
That's right I am looking at the hex file. Perhaps I must explain what I want to do.
I have a project which has a bootloader. Now I want to update the bootloader without recalling all devices I have already sent to users. My intention is go create a bootloadable project , which has the bootloader's image inside as a C array and upon programming it to update the bootloader with the new version. That's why I need smaller hex file. i.e. without the zeroes.
Any help ?
I assume your application is to update bootloader via flash writes from bootloadable firmware - please confirm.
Instead of storing the entire hex file (mostly zeros), bootloadable needs to keep and update only the valid bootloader region (~4% of flash). To further reduce this, can you compare both bootloader hex files and observe how much do they vary? What are the modifications in the latest bootloader project?
Yes, idea is to have a bootloadable which updates the bootloader.
Your observation regarding the bootloader is correct , however the question is how to make difference between areas which should be zero and those which are just filling space.
At the moment I have a regular bootloader , but I want to replace it with dual-app bootloader.
Flash memory in PSoC 5LP is programmed in rows. Each flash row has 256 code bytes. When the bootloader project is built, the PSoC Creator Output window shows the amount of flash used. For example, if the new version of Bootloader project output window says, Flash used: 9250 of 65536 bytes (14.11 %).
Thus, bootloader uses 9250 bytes and occupies 37 rows of flash (9250/256). ie., flash locations used are from 0x0000 to 0x2400. For hex file organisation, refer to Appendix 1 of PSoC 5LP Programming Specifications.
Unfortunately it is not that easy. The bootloader's image is not linear i.e. there some fragmentation, which prevents me to do that.
Any way I managed to generate a C file which contains the bootloader by using cyelftool.exe.