1 Reply Latest reply on Jun 24, 2020 11:41 PM by DheerajK_81

    CYBLE-416045-02 App1 Failure To Start

    EdHa_4455331

      For a good while now I've been working on getting an Over-The-Air (OTA) Device Firmware Update (DFU) working on a CYBLE-416045-02 module. And I am ALMOST there.

       

      In the attached stripped down demo, if I build the Blinky app as a garden variety App-0, it works fine (it just blinks the LEDs on the 416045 development board).

       

      But.... if I change Blinky to a signed App-1 suitable for use with DFU I still have issues. If I first download the App0-Bootloader, then the boot loader and the CySmart 1.3 appear to work correctly and indicate that App1-Blinky successfully downloads to the module. The App0-Bootloader will successfully verify it. But when App0-Bootloader tries to transfer control to App1-Blinky, the system goes off the rails and dies.

       

      Using the debugger, I can track the code sequence through App0-Bootloader/cmp_cm0p.c all the way to

       

      SwitchToApp(stackPointer, resetHandler);

       

      in Cy_DFU_SwitchToApp(uint32_t appId).

       

      But that's as far as I can get. The debugger will not let me a trace through a switch from App0 to App1. So I am blocked at that point from trying to trace onward to the actual crash-out place.

       

      I've also tried various hacks to bypass OTA in the App-0 and just let the App-0 immediately transfer control to App1. I then download both App-0 and App-1 out of the Pos6 IDE . This also produces similar results, which kinda sorta maybe indicates that I haven't completely mastered the art of configuring/locating things correctly for an App1. Or maybe I just don't correctly understand how to transfer control from App-0 to App-1.

       

      I've been banging my head against this one for over a week now and my deadlines are looming. Can anybody spot the defect in either my  linker/post-build scripts or my implementation that would explain the problem?

       

      Thanks,

       

      Ed H.

        • 1. Re: CYBLE-416045-02 App1 Failure To Start
          DheerajK_81

          Hello Ed,

           

          For debugging you can add while(stop); at the beginning of the application that you want to start and attach to the running target. If App was successfully started you should see that App is in a while loop, then you can change the value of stop variable in the debugger and do step by step debugging. If you could not reach the while loop, you need to check if the start address of App 1 is correct and check if CM0 core of App1 is started. Then check the start address of CM4.

          int main(void)
          {
              
              volatile int stop = 1;
          
          
              while(stop);
          

           

          In your project, I verified the linker scripts. I don't see any problem. In main_cm0p.c of App1, I see that you have written:

          Cy_SysEnableCM4(CY_CORTEX_M4_APPL_ADDR);     // This equates to 0x10080000

           

          In the linker script, the Core1 address of App1 is as follows:

          flash_app1_core1  (rx)  : ORIGIN = 0x10070000, LENGTH = 0x70000

           

          So you need to change this to:

          Cy_SysEnableCM4((uint32_t)(&__cy_app_core1_start_addr));

           

          Please change this and check if the code reaches core1 of App1. Let me know your observations.

           

          Regards,

          Dheeraj