how to disable the compiler’s disjointness checks of variabl

If you have a simple question and just want an answer.
jigneshprajapati
Member
Posts: 10
Joined: Tue May 13, 2014 12:54 pm

how to disable the compiler’s disjointness checks of variabl

Post by jigneshprajapati »

I want to run Keypad and Display in parallel using task communication. Both keypad and Display communicating to xmos with i2c protocol. so according to rules of parallel thread we can not use i2c ports in both thread of keypad and display. so i want to disable compiler's disjointness rule check . can I ? if yes then how? and if no, please tell me another way...


User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

In short, you cannot disable the compiler disjointedness checks with a switch. There are ways to workaround most of them, often using inline assembler or moving to C, but you can get into a lot of trouble very quickly when you work around parallel usage/disjointedness checks. So not reccomended unless you love bare metal and know the architecture inside out!

There are much safer legitimate ways of achieving what you want. For example, there is a "shared" I2C component available here, suitable for differnt cores on the same tile to access a single I2C master. 

https://github.com/xcore/sc_i2c/tree/ma ... i2c_shared

It uses a hardware lock to guard access to the I2C port, to ensure you never have a clash when two different cores are trying to gain access. If I2C is already busy, the other task waits until it's free.. It's basically a C wrapper with the lock code that calls I2C simple.

There are lots of other ways to do this safely and even do it across tiles (if you have a multi-tile system) by using the interfaces feature in tools 13..

However, if you are on a single tile, I reccomend starting with module_i2c_shared