6 Replies Latest reply on Jul 3, 2018 4:09 AM by GeonaP_26

    Custom bootloader for CY8C58LP

      Hello everyone,


      I'm trying to create a custom bootloader for CY8C58LP using the PSOC Creator.

      Both the bootloader and the application work fine individually.

      However, when the execution jumps from the bootloader to the application, the application doesn't behave as expected.



      As UDB modules the bootloader uses mainly the UART and SPI which are used by the application as well.



      1. I've tried first to create the bootloader without any knowledge of the application UDB - modules. I wanted it to be generic.

      However, nothing was working when I was launching the application, not even the UART which was obviously the same.



      2. Then I decided to have the exact configuration for the bootloader as for the application, at least to have something working.

      Basically I copied the application project with all its settings in the TopDesign.cysch, so the same blocks are shared by the bootloader.

      Now jumping to the application works much better: UART works fine, interrupts are OK (I see the time tick incrementing OK).



      However, SPI is dead (it is not using interupts). I have noticed that the SPI module doesn't even show under PSOC Debug->Components.

      Also, from time to time I get a surious interrupt and execution gets stuck in the Cm3Start.c::CY_ISR(IntDefaultHandler)



      I've traced the code from the application Cm3Start.c::Start_c() and it goes through the __libc_init_array and everythin, cyfitter.c and

      initialize_psoc(that's where the interrupts are properly setup and the vector is moved into RAM belonging to the application).



      Most likely something is missing, but not sure what.

      Any help would be greatly appreciated.

        • 1. Re: Custom bootloader for CY8C58LP

          Yes, something seems to be wrong. Difficult to tell what, can you share the projects, Bootloader and Bootloadable? Use Creator -> File-> Create workspace bundle (minimal) and upload the resulting .zip.


          from time to time I get a spurious interrupt and execution gets stuck in the Cm3Start.c::CY_ISR(IntDefaultHandler) This is mostly caused by a clobbered stack or bad pointer handling leading to accessing non-existing memory etc.



          • 2. Re: Custom bootloader for CY8C58LP

            Hi Bob,

            Thank you for your reply. I'll try to create a simpler project that exhibits this behavior (my app is pretty complex) and post the project so that yo can take a look.

            It will take few days until then, I have to finish something else meanwhile.

            • 3. Re: Custom bootloader for CY8C58LP

              While trying to create a simple version of a custom bootloader and application I've run into another issue:

              The PSoC Creator 4 "Flash Security" has all the rows grayed out, so I cannot change them.

              The comment at the top of the .cydr screen says:

              "This can only be set in the referenced bootloader project. Bootloadable projects inherit the value from the  associated bootloader"

              And the build fails with the message:

              "ADD: fit.M0013: error: Invalid flash security level. The last flash row in 'Bootloader/Bootloadable' and last two rows in 'Multi App Bootloader/Bootloadable' projects must be writable by the CPU (U, F, or R) since it is used for application metadata."


              But this project is for a regular application, I don't have any "Bootloadable" component in the project, or at least I don't see it (although I might have played with it at some time).

              Probably some file/setting remained hidden in there and no matter what clean up procedure I've tried, no success.

              Is there anything I can try other that re-creating the project?


              Thank you for any suggestion.


              • 4. Re: Custom bootloader for CY8C58LP

                Your bootloader's flash security settings seem to lead to a conflict. Again: Post the workspace containing the bootloader and bootloadable projects.



                • 5. Re: Custom bootloader for CY8C58LP

                  I've attached the workspace containing 2 simple projects: test_app and test_boot (the bootloader is custom, not based on the PSoc Creator Bootloader module).

                  Hopefully it has all the needed files.

                  Basically the test_boot waits for a command and then launches the application - this is where my problems are, the application when launched like that does not run properly.


                  I wanted to create a single hex from both but I did not succeed.

                  When I wanted to add a "Bootloadable" component to the test_app (the only way I have found to mention the custom bootloader hex dependency) I ran into all sorts of other issues.


                  Is there a way to create a single hex file from these 2 projects in the workspace so that I can download both the app and the bootloader the same time?


                  If not, I'll think of creating a "merge" tool and I can post the resulting hex, if needed.


                  Thanks for your help.

                  • 6. Re: Custom bootloader for CY8C58LP

                    Hello Alden,


                    Please share the bootloader project as well to recreate the issue.


                    Best Regards,

                    Geona Mary