Compiler crashes with I2C combinable example

Technical questions regarding the XTC tools and programming with XMOS.
robertxmos
XCore Addict
Posts: 169
Joined: Fri Oct 23, 2015 10:23 am

Post by robertxmos »

Hi Al,
It looks like the compiler is emitting incorrect assembler directives.
I have not got to the bottom of this yet and if there is a neat workaround.

However a quick workaround is to delete them.
With "XCC_FLAGS = -g -O2 -report -fxscope -save-temps" in the Makefile run:
  • xmake clean
    xmake
    # Error: Undefined reference to 'i2c_master.select.y.enable.cases'
    grep -v "i2c_master.select.y.enable.cases" < .build/main.s | xas -march=xs2a -o ".build/src/main.xc.o" "-g"
    grep -v "i2c_master.select.y.enable.cases" < .build/i2c_master.s | xas -march=xs2a -o ".build/_l_i2c/src/i2c_master.xc.o" "-g"
    xmake


User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Post by Folknology »

robertxmos wrote:Hi Al,
It looks like the compiler is emitting incorrect assembler directives.
I have not got to the bottom of this yet and if there is a neat workaround.

However a quick workaround is to delete them.
With "XCC_FLAGS = -g -O2 -report -fxscope -save-temps" in the Makefile run:
  • xmake clean
    xmake
    # Error: Undefined reference to 'i2c_master.select.y.enable.cases'
    grep -v "i2c_master.select.y.enable.cases" < .build/main.s | xas -march=xs2a -o ".build/src/main.xc.o" "-g"
    grep -v "i2c_master.select.y.enable.cases" < .build/i2c_master.s | xas -march=xs2a -o ".build/_l_i2c/src/i2c_master.xc.o" "-g"
    xmake
Thanks Robert I tried this with ENABLE_STAGED_BUILD=0 and it works as a hack for the example, I am hoping there aren't any side effects. Have you worked out anything about the other stages problems?

I haven't tried this technique on a larger project yet BTW as would require tweaking I imagine

Looking forward to you findings

Regards
Al
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Post by Folknology »

BTW are the entries for 'i2c_master.select.y.enable.cases.*' just being used for tests/checks or analysis by the tools rather than actual functional parts of the code?
robertxmos
XCore Addict
Posts: 169
Joined: Fri Oct 23, 2015 10:23 am

Post by robertxmos »

There is a compiler bug so whilst creating '.build/i2c_master.s' the compiler failed to emit the line:
.globl i2c_master.select.y.enable.cases
along with the line:
.set i2c_master.select.y.enable.cases,0

The easiest workaround is to add a file to the project viz: 'src/globl_bug_fix.s'
With the contents:
.set i2c_master.select.y.enable.cases,0
.globl i2c_master.select.y.enable.cases

robert
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Post by Folknology »

robertxmos wrote:There is a compiler bug so whilst creating '.build/i2c_master.s' the compiler failed to emit the line:
.globl i2c_master.select.y.enable.cases
along with the line:
.set i2c_master.select.y.enable.cases,0

The easiest workaround is to add a file to the project viz: 'src/globl_bug_fix.s'
With the contents:
.set i2c_master.select.y.enable.cases,0
.globl i2c_master.select.y.enable.cases

robert

Thanks Robert I can confirm that this works with the example locally, I tried this with ENABLE_STAGED_BUILD=0

regards
Al
User avatar
data
Active Member
Posts: 43
Joined: Wed Apr 06, 2011 8:02 pm

Post by data »

I have applied this workaround in a similar situation involving three combined tasks. In each case I set the *.enable.cases value to 0. Is this safe to do for working code?

(Thanks for working through this and posting this workaround -- it appears that this bug has been affecting several of our projects, preventing us from using combined where needed.)
robertxmos
XCore Addict
Posts: 169
Joined: Fri Oct 23, 2015 10:23 am

Post by robertxmos »

The fix is safe.
User avatar
data
Active Member
Posts: 43
Joined: Wed Apr 06, 2011 8:02 pm

Post by data »

As of 14.2.0, it seems that I no longer need the workaround -- in fact I had to remove it. It looks like the bug has been fixed. Many thanks!