7 Replies Latest reply on Jul 13, 2018 2:46 AM by GyanC_36

    Debugging OTA bootloadable


      While developing, it's pretty important to have native debugging, yet with OTA bootloading, there are lots of dependencies which make it difficult to just disable. 


      Is there a reasonable way to partition the project so that you can switch from debug to release mode and automatically enable the bootloader in the process?

        • 1. Re: Debugging OTA bootloadable

          In OTA Bootloading, it is not possible to debug, as it will be disabled by default because of the reason mentioned int the thread below: No Debug Capability when Project set up with Bootloadable for OTA?


          However you can debug only if you attach it to the target for which you need to change some configurations as mentioned in the application notes below:

          1) http://www.cypress.com/file/198301/download  in Section 8.2 Page no 34.

          2) http://www.cypress.com/file/45346/download  in Appendix B.3 Page no 28.




          • 2. Re: Debugging OTA bootloadable

            I understand debug is not available when bootloadable, but that is not what I asked.  I have for too much work to do  to live without SWD while developing the app, so I want to temporarily disable bootloading.  When I did other projects with USB bootloadable, you could just disable the bootloader component and recompile to get debug functionality while developing, then enable it for release.


            But for an OTA Bootloader this does not work because there are numerous dependencies between the bootloader component, the BLE component, shared stack, link scripts, etc.  If you disable just the bootloader, you get:

            ADD: pft.M0117: error:       Components have been set to import shared code in a non-bootloadable design.


            So it seems like the whole project would have to be recreated separately instead of just toggling a switch. I tried putting the Btle and bootloader on a page in the design and disabling the page, but got many other errors.  Ideally I'd like to keep  BTLE in the project, and just disable bootloading. I could probably live with disabling BTLE all together because it is not an essential feature of this project. But I need to be able to merge it back in easily without a bunch of error prone cut and pastes in TopDesign each release.


            I am hoping there is an easier way, that is why I asked. If there isn't please consider this a feature request.

            • 3. Re: Debugging OTA bootloadable

              Hello Mike,


              For debugging the OTA bootloadable project, please make use of attach to the target (Debug > Attach to Running Target). However, user will not be able to start the execution from start of main.c. User can add following piece of code to deliberately control the firmware flow.


              #include "stdbool.h"

              volatile bool DebugFlag = true;


              int main()








              Later user can Attach to Running Target and code will be blocked at while(1).  Change the value of DebugFlag to 0 in Watch Window so that you can debug similar to Debug mode. Please let me know whether this helps.


              Best Regards,

              Geona Mary

              • 4. Re: Debugging OTA bootloadable

                I tried something similar, but it's really not very useful, especially if you have a hard fault. My quotation still stands, what is the easiest way to leave the bootloader inside the project, but disabled?

                • 5. Re: Debugging OTA bootloadable

                  Hello Mike,


                  For debugging OTA projects, please makes use of any of these approaches;


                  (1) If the SWD interface is enabled, attach to the target (Debug > Attach to Running Target).


                  If the SWD interface is not available for debugging,

                  (2) Use GPIO toggles

                  (3) Use any serial communication interface or protocol such as UART to send messages through communication interface.


                  Please note that, it is not recommended to disable and debug OTA bootloadable projects similar to basic bootloaders (UART,I2C,USB etc.,).


                  Best Regards,

                  Geona Mary

                  • 6. Re: Debugging OTA bootloadable

                    :-( Disappointing, this is a major drawback of the platform.  As I mentioned, attaching is really useless to debug low level issues.


                    We will end up doing main development without OTA then adding it at the end of project then which is not ideal. I hope cypress will look at this closer, it seems like the tools should at least be able to disable the OTA bootloader without needing a whole new project.

                    • 7. Re: Debugging OTA bootloadable



                            In USB devices the Bootloader is a part of ROM code and it does not share any code/functions dependencies  with the application code while  application is executing whereas in PSoC  BLE devices OTA Bootloader is not a part of ROM code and it shares the codes/functions with Application.

                      Because of this dependency, it is not possible to debug the stand alone application if we disable the bootloading feature. Even we would not be  able to program the application with Bootloadable component disable because of code dependency.

                      The Bootloader and Bootloadable (Application ) are two different projects and not a single project and they switch between by software Reset on Power CyCle/Program Cycle/ External Reset  and hence no SWD debugging is possible.


                      So, in  current PSoC BLE ( 128 KB /256 KB ) OTA bootloader applications, SWD debugging is not possible.


                      You could debug your application without OTA  and later can add the OTA functionality or use UART Debug logs.