3 Replies Latest reply on Apr 14, 2015 8:01 AM by christophe.fauvel

    CyFx3BootJumpToProgramEntry - Undefined ISR


      Hello everyone,


      We are designing an application to add SDCard boot support for the Cypress CyUSB301X chipset through a SPI bus (bitbang mode right now for simplicity). The idea behind this is to:


      1. boot in USB mode (PMODE to USB)


      2. upload a 2nd bootloader image at address 0x40087000


      3. jump to the 2nd bootloader


      4. read an application firmware (elf2bin) from the SDCard and copy it into RAM


      5. jump to the application firmware




      Right now, we are stuck at step five. The RAM content seems coherent with the application firmware disassembly code (see below). The application firmware, in standalone mode, only toggle the LED2 pin every seconds and works fine. The 2nd bootloader code by itself works flawlessly also until it reaches the last line:




      GDB tells us that we are now in an undefined interrupt UndefinedISR (see below).


      In the Cypress examples, it seems that no specific actions must be done before using the CyFx3BootJumpToProgramEntry() function however, there is obviously something wrong with our code.


      Have you ever experienced problem with the CyFx3BootJumpToProgramEntry() function or with jump between 2nd bootloader and application in your designs ?




      Best regards,








      # GDB trace
      Transfer rate: 4 KB/sec, 338 bytes/write.

      Breakpoint 1, main () at main.c:99
      99              ioCfg.isDQ32Bit = CyFalse;
      100         ioCfg.useUart   = CyFalse;
      n101        ioCfg.useI2C    = CyFalse;
      102         ioCfg.useI2S    = CyFalse;
      103         ioCfg.useSpi    = CyFalse;
      104         ioCfg.gpioSimpleEn[0] = 0;
      105         ioCfg.gpioSimpleEn[1] = 0;
      106         status = CyFx3BootDeviceConfigureIOMatrix (&ioCfg);
      107             if (status != CY_FX3_BOOT_SUCCESS)
      110             CyFxPrint("Jump to entry point: %08x\n\n", fwChunk.dAddr);
      112         asm("b 0x40006fa0");

      Program received signal SIGINT, Interrupt.
      UndefinedISR () at cyfx_armcc_startup.S:80
      80      cyfx_armcc_startup.S: No such file or directory.
      (arm-gdb)x /100x 0x40006fa0
      0x40006fa0:     0xe59f1034      0xe3e00000      0xe5810000      0xe59f102c
      0x40006fb0:     0xe2411008      0xe3a02a01      0xe3a000d3      0xe121f000
      0x40006fc0:     0xe0811002      0xe3c11007      0xe1a0d001      0xebffff7c
      0x40006fd0:     0xeb00042e      0xebffffc2      0xeafff009      0xfffff014
      0x40006fe0:     0x40001000      0xe92d4010      0xe1a04000      0xe3540000
      0x40006ff0:     0x1a000001      0xe3a00041      0xe8bd8010      0xe1a00004
      0x40007000:     0xeb001eda      0xe3500000      0x1a000001      0xe3a00040
      0x40007010:     0xeafffff8      0xe3a00000      0xeafffff6      0xe92d4010
      0x40007020:     0xe1a04000      0xe3a01000      0xe1a00004      0xeb001f34
      0x40007030:     0xe8bd8010      0xe92d4010      0xe1a04000      0xe3a01001
      0x40007040:     0xe1a00004      0xeb001f2e      0xe8bd8010      0xe1a01000
      0x40007050:     0xe351003d      0xaa000001      0xe3a00001      0xe12fff1e
      0x40007060:     0xe3a00000      0xeafffffc      0xe92d4070      0xe1a04000
      0x40007070:     0xe3a05000      0xe3540000      0x0a00000a      0xe3540001
      0x40007080:     0x0a000004      0xe3540002      0x0a00000e      0xe3540003
      0x40007090:     0x1a000010      0xea000007      0xe1a00000      0xeb001f2c
      0x400070a0:     0xe1a05000      0xea00000d      0xe1a00000      0xeb001f24
      0x400070b0:     0xe1a05000      0xea000009      0xe1a00000      0xeb001f2c
      0x400070c0:     0xe1a05000      0xea000005      0xe1a00000      0xeb001f24
      0x400070d0:     0xe1a05000      0xea000001      0xe1a00000      0xe1a00000
      0x400070e0:     0xe1a00000      0xe1a00005      0xe8bd8070      0xe92d4070
      0x400070f0:     0xe1a04000      0xe3a05000      0xe5d40000      0xe3500002
      0x40007100:     0xba000002      0xe5d40000      0xe3500010      0xda000001
      0x40007110:     0xe3a00040      0xe8bd8070      0xe5d40001      0xe3500000
      0x40007120:     0x1a000004      0xe5940004      0xe3500000      0x0a000009






      # Disassembly
      40006f94:   e3c11007    bic r1, r1, #7
      40006f98:   e1a0d001    mov sp, r1
      40006f9c:   e12fff1e    bx  lr

      40006fa0 <CyU3PFirmwareEntry>:
      40006fa0:   e59f1034    ldr r1, [pc, #52]   ; 40006fdc <CyU3PFirmwareEntry+0x3c>
      40006fa4:   e3e00000    mvn r0, #0
      40006fa8:   e5810000    str r0, [r1]
      40006fac:   e59f102c    ldr r1, [pc, #44]   ; 40006fe0 <CyU3PFirmwareEntry+0x40>
      40006fb0:   e2411008    sub r1, r1, #8
      40006fb4:   e3a02a01    mov r2, #4096   ; 0x1000
      40006fb8:   e3a000d3    mov r0, #211    ; 0xd3
      40006fbc:   e121f000    msr CPSR_c, r0
      40006fc0:   e0811002    add r1, r1, r2
      40006fc4:   e3c11007    bic r1, r1, #7
      40006fc8:   e1a0d001    mov sp, r1
      40006fcc:   ebffff7c    bl  40006dc4 <CyU3PSysSetupMMU>
      40006fd0:   eb00042e    bl  40008090 <CyU3PSysCheckBootState>
      40006fd4:   ebffffc2    bl  40006ee4 <CyU3PSetupStackPtrs>
      40006fd8:   eafff009    b   40003004 <CyU3PToolChainInit>
      40006fdc:   fffff014            ; <UNDEFINED> instruction: 0xfffff014
      40006fe0:   40001000    andmi   r1, r0, r0

      Disassembly of section i.CyU3PDeviceConfigureIOMatrix:

      40006fe4 <CyU3PDeviceConfigureIOMatrix>:
      40006fe4:   e92d4010    push    {r4, lr}
      40006fe8:   e1a04000    mov r4, r0

        • 1. Re: CyFx3BootJumpToProgramEntry - Undefined ISR
          Madhu Lakshmipathy



          I see that you have initialized UART in the firmware. Please call the CyFx3BootUartDeInit () api before calling the CyFx3BootJumpToProgramEntry API. Because calling the later requires al the serial interfaces like SPI, UART, i2c deinitalized.




          - Madhu Sudhan

          • 2. Re: CyFx3BootJumpToProgramEntry - Undefined ISR



            Thank you for your quick reply.


            I've disabled the uart block with CyFx3BootUartDeInit() but it failed to jump anyway ! I have executed the code step by step in assembly mode, thanks to GDB, and I was able to trace the execution:










                     CyFx3BusyWait()           <=  set $pc+=4 to end loop




                     CyFx3BusyWait()           <=  set $pc+=4 to end loop




                     CyFx3BusyWait()           <=  set $pc+=4 to end loop




                jump()                         <=  jump at cyfx_armcc_startup.S:186


                                                   cyfx_armcc_startup.S no such file or directory




            The $pc is then set to 0x40006fa0 (the same address returned by elf2img) and finally jumped in the UndefinedISR() interrupt after a few steps. As far as I can tell, when initializing the UART in CyU3PDebugInit(), $pc is set with the $fp value and $pc is set to 0x00000010.




            Best regards,



            • 3. Re: CyFx3BootJumpToProgramEntry - Undefined ISR

              Hello everybody,




              Finally, I found the problem in my software. Data copied from SDCard into RAM was not exactly the same (overlap of some instructions between image sections) causing the processor to do unexpected things. It's working now !




              Best regards,