Can a Debug Session run on AN75779 AVC code using EZ USB Suite and CYUSB3KIT-003?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GrCa_1363456
Level 6
Level 6
50 likes received Beta tester First comment on KBA

If it’s possible to run a debug session into an RTOS; on the AVC code that accompanies AN75779, what’s the process to get past the first couple instructions in Main then follow function call CyU3PKernelEntry into the ThreadX RTOS?

As soon as the code gets out of Main, I can no longer seem to track it. Any help is appreciated.

Steps:

  1. Copy and unzip AN75779.zip and AN75779 How to Implement guide to PC
  2. Connect two USB connectors on CYUSB3KIT-003 to two USB ports on PC
  3. Start TeraTerm & Setup as Serial Port to new Com Port at 115200 baud
  4. Start Cypress’ EZ USB Suite
  5. Import AN75779 project UVC
  6. Build UVC_AN75779 project – select “Debug(Debug Configuration)”
  7. Set Debug Configuration for UVC_AN75779 project
    1. Select GDB OpenOCD Debugging
    2. Leave Main tab untouched
    3. On Debugger tab, ensure
      1. Executable = C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\JTAG\OpenOCD\Windows\openocd.exe
      2. Config options = -f "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\JTAG\OpenOCD\Config\arm926ejs_fx3.cfg"
    4. On Starup tab, de-select “Enable ARM semihosting” and “Pre-run reset”
    5. Select “Apply” then “Debug”
  8. Notice when progress bar in lower right corner completes uvc.c fills center window with first command in main highlighted.

At this point, I don’t foresee where the code’s going so I decide to step over and into – but get lost after CyU3PKernelEntry command. ???

Main

CyU3PDeviceInit <– Step Over

CyU3PDeviceCacheControl <– Step Over

CyU3PDeviceConfigureIOMatrix <– Step Over

Dozen io_cfg settings <– Step Over each one

  1. CyU3PKernelEntry <-- I don’t know how to debug at this point. Resuming or stepping into causes program to run, a window for 0x0 pops up over the uvc.c window with red text, “No source available for “0x0”
  • [View Disassembly…] <-- clicking on this radio button opens a Disassembly window that shows address lines for code followed by the text, “Unable to retrieve disassembly data from backend.”

and Tera Term displays the following output:

Error: Reading Sensor ID failed!

UsbEventCB: Detected SS USB Connection

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

USBSetupCB:In SET_FTR 0::1

UsbEventCB: SUSPEND encountered...

Entering USB Susp

Notes:

- Code does appear to be halted @ fffffff8, which is highlighted green in the Disassembly window.

- ‘Step Return’ causes information in the Console to update and the Disassembly code to refresh.

- ‘Step Into’ and ‘Step Over’ appear to have no effect.

-------------

I did find some existing posts and attempted various modifications with no success:

A) UVC Troubleshooting Guide – KBA226722 @ https://community.cypress.com/docs/DOC-17227 appears to be related to a running application. It’s possible the code locks up without a data stream.

B) I uncommented the #define USB_DEBUG_INTERFACE line in uvc.h then ran a build then the debugger.

  • There isn’t any additional output, which makes sense as the code didn’t go to area where the Debug comments are located.

C) There is a section in the readme.txt file in the UVC_AN75779 directory:

    4. Updating to a new FX3 SDK version:

    -------------------------------------

    The cyfxtx.c and cyfx_gcc_startup.S files used here are taken from the FX3 SDK release. This version of the application makes use of FX3 SDK release version 1.3.3.

    When updating the application to work with a new SDK version, you need to copy the latest cyfxtx.c and cyfx_gcc_startup.S files from the new SDK into this project. You will also need to follow the instructions for porting to the new SDK that are included in the "Getting started with the FX3 SDK" document.

Looking at copies of cyfxtx.c and cyfx_gcc_startup.S files in EZ USB SDK files and UVC_AN75779, I see no difference.

D1) Mention of running Profile Debug for RTOS in response to Community Post “debug and release mode” @ https://community.cypress.com/message/156326. I’ll try it.

  • Re-build using Profile Debug option
  • Change C/C++ Application in Main tab of Debug configuration by using [Search Project…] button and selecting Profile version.
  • No difference

D2) More information on Profile Debug in the post “Profiling support of ThreadX” @ https://community.cypress.com/community/usb/usb-superspeed-peripherals/blog/2018/12/23/profiling-sup...

  • Still no difference in my inability to follow debug after start of RTOS
0 Likes
1 Solution

Greg,

KernelEntry() function is a non return function. There is no way to debug it.

You can use the RTOS APIs to check the thread performace. For this, you need to build the firmware with Profile Debug or release mode

Check this out: debug and release mode

Sridhar

View solution in original post

0 Likes
5 Replies
GrCa_1363456
Level 6
Level 6
50 likes received Beta tester First comment on KBA

Side Note: Since this post is focused on tips and tricks to getting started with a debug session;

I started a separate post related specifically to issues debugging AN75779 @ https://community.cypress.com/message/199158

Debugging AN75779 is complicated by the presence of multi-thread RTOS.

0 Likes

Greg,

KernelEntry() function is a non return function. There is no way to debug it.

You can use the RTOS APIs to check the thread performace. For this, you need to build the firmware with Profile Debug or release mode

Check this out: debug and release mode

Sridhar

0 Likes

Sridhar,

Thank you for the clarification that the KernelEntry() function can't be debugged in the standard way and providing a link to a method that may be used.

The discussion at the link debug and release mode has an open question from geethanjali, "where i can i find these information completly." I would also like any supporting information describing the "Profile Debug" and "Profile Release" processes. I'll state the same on the linked thread and mark this thread complete as my initial question has been answered.

0 Likes

Greg,

The KernelEntry function can't be debugged even you use profile debug and release builds. Therefore, there is no way to debug the KernelEntry function.

The use of Profile debud and release is: There are some APIs whose library is not included in default debug and release mode.

If you wanna to use such APIs, you need to build the code with Profile debug or release.

However, why you want to debug KernelEntry function?

Example APIs are CyU3PDeviceGetCpuLoad, CyU3PDeviceGetDriverLoad, CyU3PDeviceGetThreadLoad, CyU3PThreadPerfGet and etc., Search for profilling in API guide for other APIs.

0 Likes

Please create a new thread for a new query.

Sridhar

0 Likes