Confused about ifdef code, greyed out

New to XMOS and XCore? Get started here.
Posts: 9
Joined: Mon Sep 24, 2018 9:56 pm

Confused about ifdef code, greyed out

Postby Wavelength » Sat Sep 29, 2018 9:00 pm


So I am debugging my XU208 hardware and I am really confused about what should be greyed out and what is. For instance I am crashing on a DFU call which is bogus because it is not enabled. So I opened endpoint0.xc which is were the call came from. I have in my make file flags:


NUM_CHANS_OUT = 2, but in endpoint0.xc the code is greyed out for input and output.

I also have in my customdefines AUDIO_CLASS=2, but in main.xc if ifdef for that indicates a default back to UAC1??? So I added that switch statement -DAUDIO_CLASS=2 on the build flags but it's still greyed out.

The DFU is totally greyed out so I am not sure what is going on. I think the crash is basically that my flags or make or something is enabled in one source file and not enabled in another and that is causing the problem.

Any ideas or is greyed out display just something to ignore?

User avatar
XCore Legend
Posts: 1358
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Mon Oct 01, 2018 1:42 pm

Hi. Not an audio developer but study:

1) USB Audio Design Guide: ... rc1%29.pdf

Code: Select all

2) also the sample audio IP code - specifically the supplied makefiles and compare against yours:


Code: Select all
User avatar
XCore Addict
Posts: 164
Joined: Tue Mar 26, 2013 12:10 pm

Postby johned » Mon Oct 01, 2018 3:55 pm

Hello Gordon,

One quick observation on the greying of conditional code is that Eclipse gets confused with complex conditions and also can not resolve conditions defined in makefiles.
I always ignore the greying in the IDE and rely on a visual analysis of the conditions as enabled in makefiles and header files.

Posts: 9
Joined: Mon Sep 24, 2018 9:56 pm

Postby Wavelength » Mon Oct 01, 2018 4:47 pm

Mom2 & John,

Thanks but really this is going off the deep end. So with the debugger enabled and walking through main.xc I get through the parallel for usb_audio_core which enables XUD (still not sure if it is UAC1 or 2) and endpoint0. But I really can't get any further than that as it crashes. But here is the weird thing, DFU is not enabled yet look at the crash info on the threading:

xCORE Debugger (10/1/18, 11:41 AM) (Suspended)
tile[0] core[0] (Suspended)
tile[0] core[1] (Suspended)
tile[0] core[2] (Suspended)
tile[0] core[3] (Suspended: Signal 'ET_LOAD_STORE' received. Description: Memory access exception.)
5 GetDFUFlag() dfu.xc:32 0x00043d48
4 DFUReportResetState() dfu.xc:340 0x00043d48
3 Endpoint0() endpoint0.c:286 0x000402a5
2 _Susb_audio_core_0.task.Endpoint0.2() main.xc:386 0x00041b89
1 __start_core() 0x00047390
tile[0] core[4] (Suspended)
xgdb (10/1/18, 11:41 AM)

How did thread 4 & 5 even get started? Well 5 is crash so I guess how did 4 get started?

I am going to write some debug code now to enable some real breakpoints as all this threading is causing problems.

Posts: 9
Joined: Mon Sep 24, 2018 9:56 pm

Postby Wavelength » Mon Oct 01, 2018 7:29 pm


So I am going to give the source code in the link above a look at. But I am really confused between what I see in that project and the items mentioned in the AN1027 app note:

/* Default to board version version 2.0 */

No mention of this in the customdefines.h

/* Tile defines */
#define AUDIO_IO_TILE 0
#define XUD_TILE 0
#define MIDI_TILE 0
#define SPDIF_TX_TILE 0

No tile mention at all in the customdefines.h

BUILD_FLAGS = -DFLASH_MAX_UPGRADE_SIZE=64*1024*3 -fcomment-asm -Xmapper --map -Xmapper MAPFILE -O3 -report -fsubword-select -save-temps -g -DXUD_SERIES_SUPPORT=4 -march=xs2a -DUSB_TILE=tile[0] -DQUAD_SPI_FLASH=1 -lquadflash

There is not one switch variable in these build flags that is mentioned in the AN1027???

Please advise, thanks

Who is online

Users browsing this forum: No registered users and 0 guests