10 Replies Latest reply on Feb 6, 2017 5:40 AM by content.librarian

    write protect flash question

    content.librarian

      I have a bootloadable project. 

         

      Select project --> Bootloadable_PROJ_NAME Resources to get the Bootloadable_PROJ_NAME.cydwr window.

         

      Using the bottom tab "Flash security".  I selected the flash space that is used by the boot loader 1..73.

         

      I programmed the boot loader then used the Bootloader host to load the application (the bootloadable)  It all works great.

         

      But we must be sure that the boot loader is safe, before we permanently install it into the sensor. 

         

      Is there an easy way to verify that the flash rows I assigned to write protect are actually assigned to write-protect in the device?

        • 1. Re: write protect flash question
          content.librarian

          I can set all flash rows to Write protected, program them with Control-F5.  Then (after switching cables) program over all of them  with the boot loader host.  Shouldn't this be disallowed by the flash protection?

          • 2. Re: write protect flash question
            user_1377889

            The write protect does not prevent the chip from erase and re-programming. It prevents partial erase and partial programming only. There is a last fuse that hinders erasing, but you will loose any further access to any chip internals, no debugging, no read-out, no checking and NO Return!

               

             

               

            Bob

            • 3. Re: write protect flash question
              content.librarian

              We are only concerned that the application will inadvertently corrupt the bootloader, thus effectively destroying the part.

                 

              Since we only bootload application updates, (and never do flash direct writes),  should we just protect everything (bootload and application rows).

              • 4. Re: write protect flash question
                user_1377889

                Datasheet pg.47 says

                   

                The bootloader application portion of flash should be protected in the Flash Protection tab of
                the design-wide resource file to make it only be overwritten by downloading via JTAG / SWD.

                   

                When the bootloadable area is protected, the bootloader will not be able to flash an update.

                   

                 

                   

                Bob

                • 5. Re: write protect flash question
                  content.librarian

                  I can't find the data sheet page 47 reference.  I have CY8C4245LQI, and I looked through all the documentation that I could find on it.    I can't find anything that directly says one way on the other.  Right  now I am afraid my write protect values, are not being written with my  1) Complete Build, 2) program sequence -- that I am using.

                     

                  I tried using the "System tab"  of the resources window (cydwr) to set the 'Chip Protection' bit to "Protected'.  Thinking  this may enable FlashWrite checks, but when I switch to the bootloader host I can download the application to the device with all protected flash rows no problem. (it says no successfully programmed, and displays a very convincing Green Progress bar, I didn't check the actual bytes.)

                  • 6. Re: write protect flash question
                    content.librarian

                    Here is something from (AN73854) PSoC 3,4 and 5LP Introduction to Bootloaders

                       

                    -----

                       

                    To protect the PSoC 4 device from external read operations, you must change the device protection settings to
                    “Protected” in PSoC Creator .cydwr system settings and use the PSoC Programmer software to program the device.
                    You must also enable “Chip Lock” from Options > Programmer Options before programming the device for these
                    settings to take effect.

                       

                    ----

                       

                    Now I can't find Options-> Programmer Options ->'Chip Lock' item in the IDE.

                    • 7. Re: write protect flash question
                      user_1377889

                      1st: I am reflecting to the bootloader datasheet pg 47.

                         

                      2nd: AN73854 handles all PSoCs 3,4 and 5 which are different internally. Difficult to sort out what applies to which.

                         

                      You can be sure: A chip programmed with a bootloader and flash security set for the area the bootloader occupies will not get overwritten accidentally by the bootloaded project.

                         

                      You can try that by building a project that exactly does that. You will run into the non-maskable ARM M0 hardware interrupt which (as a default) goes into an dead loop.

                         

                       

                         

                      Bob

                      • 8. Re: write protect flash question
                        content.librarian

                        From PSoc Creater 3.3, I used Flash Security to set the bootloader section (rows 0-72) 'W'rite protected and then clean build and program to the chip flash.

                           

                        But when I read the flash with the standalone programmer.  All the rows display at the end as 'U'nprotected!!. 

                        • 9. Re: write protect flash question
                          vsrs

                          Hi,

                          You can see the Chip Lock option in PSoC Programmer in the attached image.

                             

                          Best Regards,
                          VSRS

                             

                             

                          • 10. Re: write protect flash question
                            content.librarian

                             The reason that the Bootloader Flash Row Protection was not working is because an upgrade had moved the bootload*er* code to GCC 4.9.3.  But the 'bootloadable_1' component in the Bootload*able* project was still pointing to GCC 4.8.4.  So the loader -> loadable link was broken.  To get the bootloadable_1 component link, 1) go to the bootloadable project, right click the Bootloadable_1 component (or what ever it is named)  2) then select  Configure -> Dependencies -> Bootloader HEX file:  After changing GCC directory, The menu Project->PROJECTNAME Resources -> Flash Security correctly showed the flash row status specified in the Bootloader project. 

                               

                             

                               

                            Thanks every one for your help