Confused about ifdef code, greyed out

New to XMOS and XCore? Get started here.
Post Reply
User avatar
Wavelength
Experienced Member
Posts: 76
Joined: Mon Sep 24, 2018 9:56 pm

Confused about ifdef code, greyed out

Post by Wavelength »

All,

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:

XCC_FLAGS = $(BUILD_FLAGS) -DI2S_CHANS_DAC=2 -DI2S_CHANS_ADC=0 -DNUM_USB_CHAN_OUT=2 -DNUM_USB_CHAN_IN=0 -DMIDI=0 -DSPDIF_TX=0 -DSPDIF_RX=0 -DADAT_TX=0 -DADAT_RX=0 -DDSD_CHANS_DAC=0 -DAUDIO_CLASS=2

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?

Thanks,
Gordon


User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Hi. Not an audio developer but study:

1) USB Audio Design Guide:

https://www.xmos.com/download/private/s ... rc1%29.pdf

Code: Select all

https://www.xmos.com/download/private/sw_usb_audio%3A-sw_usb_audio-%5Bdesign-guide%5D%286.15.2rc1%29.pdf
2) also the sample audio IP code - specifically the supplied makefiles and compare against yours:

http://www.xcore.com/viewtopic.php?f=37&t=6375

Code: Select all

http://www.xcore.com/viewtopic.php?f=37&t=6375
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm
Contact:

Post by johned »

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.

John
User avatar
Wavelength
Experienced Member
Posts: 76
Joined: Mon Sep 24, 2018 9:56 pm

Post by Wavelength »

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.

Thanks,
Gordon
Wavelength Audio, ltd.
User avatar
Wavelength
Experienced Member
Posts: 76
Joined: Mon Sep 24, 2018 9:56 pm

Post by Wavelength »

Mom2.

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 */
#ifndef XCORE_200_MC_AUDIO_HW_VERSION
#define XCORE_200_MC_AUDIO_HW_VERSION 2
#endif

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
Gordon
Wavelength Audio, ltd.
Post Reply