Small tip to help XTCP debugging

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
BEBDigitalAudio
Experienced Member
Posts: 82
Joined: Thu Nov 11, 2010 7:45 pm

Small tip to help XTCP debugging

Post by BEBDigitalAudio »

Hi all,

as I am fighting a lot with the XTCP stack (on which UDP seems to have serious problems), I quickly became quite irritated about the "standard" debugging way proposed in the XTCP is based on UIP_LOG, printstr() and printintln.

By default, the XTCP module is built without debugging informations for the C modules, and even if you activate the debug mode in your project, XTCP module uses its own configuration.

So, here is the tip that I use in order ot be able to see what is happening within all uip modules written in C, being able to break anywhere in the code (even in the uip source code)

Since it took me around 30 minutes to find where the makefile configuration data is defined for XTCP (and what is the good setup for debugging), I hope this may help somebody in the XCore community (just to make me think that I am no the only one fighting with the TCP/IP stack source code :D )

In the module_xtcp_sockets.1v3 module, locate the file named "module_build_info"
You just have the change the optimization level from -Os to nothing, and activate debug information for C source file, using the -g flag.

Here are the lines I am using for debugging (yes, I know, I should better set them in conditionnal section, selecting the correct block depending on the configuration I am using (debug or release)

Code: Select all

# Original configuration from XMOS
#$(call SET_XCC_XC_FLAGS, $(XTCP_SOURCE_DIRS), $(XCC_FLAGS) -g -Os)
#$(call SET_XCC_C_FLAGS, $(XTCP_SOURCE_DIRS), $(XCC_FLAGS) -Os)
# Enable source code debugging for xtcp_sockets
$(call SET_XCC_XC_FLAGS, $(XTCP_SOURCE_DIRS), $(XCC_FLAGS) -g)
$(call SET_XCC_C_FLAGS, $(XTCP_SOURCE_DIRS), $(XCC_FLAGS) -g)
Hope this can help some of you ;)

Benoît