9 Replies Latest reply on Aug 1, 2013 5:47 AM by user_14586677

    bootloader

    marek.niemiec

      Hi

         

      I'm implemented example bootloader and it is not a bootloader(in my opinion). Here's the code

         

          BootLdrI2C_Start();
          BootLdrI2C_EnableSlave();
          BootLdrI2C_EnableInt();
          M8C_EnableGInt;

          while( 1 )
          {
          }

         

      You have to download full code, if there will be mistake you have to use programmer to program bootloader again.

         

      For example if i'll delete this line:

         

      BootLdrI2C_Start();

         

      there will be no option do communicate with bootloader again, it is in memory(secured from delete) but not started(no jump).

         

      I delete it specially but what if program will be send in half and there will be power down? bootloader will not start again.

         

      How to protect those function calls?

         

          BootLdrI2C_Start();
          BootLdrI2C_EnableSlave();
          BootLdrI2C_EnableInt();
          M8C_EnableGInt;

         

      In flashsecurity.txt there is a memory map can i add those lines to special part of memory ad secure it?

         

      I'm quite siure that someone have to solve this problem. :)

        • 1. Re: bootloader
          user_14586677

          Have you looked over this project ?

             

           

             

          http://www.cypress.com/?id=4&rID=60862

             

           

             

          Regards, Dana.

          • 2. Re: bootloader
            marek.niemiec

            Yes i worked for datasheet in psoc designer and I used bootloader v3.0, so there is no problems with proper work of example. I want to protect this example to always start bootloader. For exapmle if apps starts at 0xFA memory so i want to put start_bootloader at 0xFA and add it to protected space of memory. Thanks to that my app will always start a bootloader and even if update goes wrong i can communicate by ic2 to bootloader and send new application again.

            • 3. Re: bootloader
              user_14586677

              If you additionally look at the module datasheet you can see the memory map,

                 

              where BL code is protected and retained after an upgrade. There is also an

                 

              address you set for the start of API code for the target code, which insures BL

                 

              code against erasure.

                 

               

                 

              Note that the checksum controls invocation of BL, so if it is altered after a successful

                 

              upgrade the BL will be invoked again on startup. You can always modify this to be

                 

              triggered by other HW or SW.

                 

               

                 

              Regards, Dana.

              1 of 1 people found this helpful
              • 4. Re: bootloader
                marek.niemiec

                I think you not tested this app. You just seen datasheet. In BL there are just functions app do not start from bootloader. It start from int main(void) so if you do not add call fuctions bootloader will not be avaliable.

                   

                BootLdrI2C_Start();
                    BootLdrI2C_EnableSlave();
                    BootLdrI2C_EnableInt();

                   

                application starts from 0xAF not from bootloader and if i send correctly my program it will jump to those functions and everything work fine after reboot. But if I lost source of energy in middle time of sending there will be no call fuction in my "new" not fully upgradet application.

                   

                i want to start my app from BootLdrI2C_Start(); then jump to 0xAF.

                   

                Any ideas?

                • 5. Re: bootloader
                  user_14586677

                  "I think you not tested this app. You just seen datasheet."

                     

                   

                     

                  You are correct, I have not tested ap, so will refrain from further comment.

                     

                  There are people on this forum that should bve able to help you.

                     

                   

                     

                  Regards, Dana.

                  1 of 1 people found this helpful
                  • 6. Re: bootloader
                    marek.niemiec

                    Thanks anyway for support.

                       

                    Someone hava an idea?

                       

                    I want to change example bootloader to version where bootloader will start in background automatically without using call fuction bootloader_start(); Also i want to protect this space of memory against rewrite.

                    • 7. Re: bootloader
                      marek.niemiec

                      Partially i find a solution, If you use a build in module of bootloader in psoc designer it works in simple way(it is written in datasheet). It starts an aplication and it check control sum of flash user program if it is equal with that in memory program starts corectly but if not it starts only bootloader and wait in infinite loop to recieve a program.

                         

                      The conclusions is simple, i had avesome luck/unluck cuz i tested it and in the middle of sending application i removed power supply. After that it can't even start a bootloader. In final result it means that my previous application had the same control checksum or there was unexplained issue.

                         

                      Should I play a lotery or something with this luck?

                         

                      But still can I write a aplication and put function in specific place of memory? maybe in assembler? I don't know everyfing of c/c++ so it is possible there is some directive or command?

                      • 8. Re: bootloader
                        user_14586677

                        Some thoughts -

                           

                         

                           

                        1) To handle power loss or communication link fault during boot upgrade

                           

                        you can use combination of LVD interrupt and energy storage like super

                           

                        caps to hold up the processor long enough to finish a block/row write

                           

                        and "handle" controlled shutdown. Timer for communication link that goes

                           

                        dead. Failure to keep processor in normal operating conditions during

                           

                        block/row erase can yield completely unpredictable results. Possible

                           

                        corruption in other areas of FLASH not intended.

                           

                         

                           

                        2) Consider writing your own BL, or modify the project earlier referred to.

                           

                         

                           

                        3) In compiler manual there are directives to force variables/code into specific

                           

                        memory addresses/locations.

                           

                         

                           

                         

                        • 9. Re: bootloader
                          user_14586677

                          Computing C size for processor power loss intervention, attached.

                             

                           

                             

                          Regards, Dana.