6 Replies Latest reply on Aug 31, 2018 5:20 AM by Petar Penchev

    why bootloader's hex file is so big ?

      I am working on a bootloader project and I noticed that there is a discrepancy between what PSOC Creator states and the hex file. The Creator say my bootloader is using about 4% from the FLASH. And the hex file has the entire FLASH in it i.e. upto adrress 3FFFF.


      Is there a way to reduce bootloader's hex file ?

        • 1. Re: why bootloader's hex file is so big ?

          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?

          • 2. Re: why bootloader's hex file is so big ?

            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 ?

            • 3. Re: why bootloader's hex file is so big ?

              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?

              • 4. Re: why bootloader's hex file is so big ?

                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.




                • 5. Re: why bootloader's hex file is so big ?

                  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.

                  • 6. Re: why bootloader's hex file is so big ?

                    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.