lib_xud compilation error

If you have a simple question and just want an answer.
Post Reply
karthik
Member
Posts: 8
Joined: Wed Nov 17, 2021 4:39 am

lib_xud compilation error

Post by karthik »

I am trying to move my project to lib_xud from module_xud. When compiling, I get an error 'unsafe specified on non-pointer type', and 'local variable c has type chanend'. From the XMOS documentation, I figured out that the datatype chanend can be replaced by unsigned int/int. I did try that and the error was resolved but again, the variable had to be passed to another inbuilt function that takes chanend as an arguement and thus I get another error. Can someone help me debug this error.

XUD_PowerSig.xc:

Code: Select all

case flag0_port when pinseq(0) :> void: // inverted port
                // TODO debounce?
                unsafe chanend c;
                asm("getr %0, 2" : "=r"(c)); // XS1_RES_TYPE_CHANEND=2 (no inline assembly immediate operands in xC)
    
                if (g_curSpeed == XUD_SPEED_HS)
                {
                    // start high-speed switch so it's completed as quickly as possible after end of resume is seen
                    unsafe {
                        write_periph_word_two_part_start((chanend)c, USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM,  XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0);
                    }
                }
XUD_USBTile_Suppor.xc

Code: Select all

void write_periph_word_two_part_end(chanend tmpchan, unsigned data)
{
    /* Send last byte of data to bring the write to effect */
    outuchar(tmpchan, data);
    outct(tmpchan, XS1_CT_END);
}
I am using lib_xud 1.2.0 as I am using xs1 series.
Attachments
error.png
(49.57 KiB) Not downloaded yet
error.png
(49.57 KiB) Not downloaded yet


User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

The tools no longer support this short cut of "unsafe resources". You should change to something like chanend * unsafe c or use a previous version of the tools.
Post Reply