Creating a C based Projekt on XMOS

Technical questions regarding the XTC tools and programming with XMOS.
Mahagon
Member++
Posts: 24
Joined: Thu Mar 07, 2013 4:24 pm

Creating a C based Projekt on XMOS

Post by Mahagon »

Cheerz guys,

I have some questions, that might sound quiet stupid, but honestly i'm stucked at the moment and i need some help or some hints, to get me into the right direction.

First thing is: I want (well actually i must) create a project, that did not use the XC programming language. It's only supposed to use C, but it's still the target to profit from XMOS pros like multithreading and so on.

In my opinion, there will be many different problems. That's some i've got right now:

a) If i build a C-Project (exactly the XK-1A example project for the LED's) instead of an xTIME composer project in xTIME studio, i cannot use that nice funtions for target hardware and so on, while creating the project (just not existent). I can see that fast when i try to compile my C Project, i got the error:

"xmake: *** No rule to make target `all'. Stop."

After a lot of googling and so on i found out, that the reason is, that i got no makefile (i used makefiles once some years ago with AVR, not very familiar with that). After trying to read some facts and Tutorials about that and so on, my brain got cracked :-D . Well so my question here is: Are there any existing makefiles for xCore Projects; especially with XK-1A? And what else would i need (Toolchains ...) to build a C based Project with xTIME... ?


b) Another problem with a totally different nature is, that i cannot benefit from the XC programming extensions (like par-function; chanends and so on ...). Do i understand that correctly, that i have to find a way to port that functionalities into C ? Or is there another way? Are there any further workings on that?


Well... that's just some of my thoughts at the moment. You don't have to answer exactly to everything, maybe just giving your opinion to my thinkings.

Please do not blame to hard, it's just before weekend and im honestly a bit tired now after 8 hours reading of things like "makefiles" and soooo on ... :-D

Greetings :)


User avatar
franksanderdo
Experienced Member
Posts: 69
Joined: Sat Apr 30, 2011 6:19 pm

Post by franksanderdo »

Hi Mahagon

Let jump over item a) and go directly to Item b) ;-)

Please don't take it wrong or offensive, but if you have already trouble to create a makefile, I believe you will end up in a Truckload of issues rebuilding the Code Base for parallel processing and channels.

In fact I believe XMOS has put a lot of efforts to produce a C like language extension. Most probably many man years of work in there in addition to the sweat, nerves and (some times) tears.

Here are some people with much deeper knowledge about XMOS CPUs and XC. But I believe they will ask the same Question:
Why do you want to use XMOS CPU without using XMOS Development tools?

Best regards
Frank
Mahagon
Member++
Posts: 24
Joined: Thu Mar 07, 2013 4:24 pm

Post by Mahagon »

Hiho,

well, the reason is, i want to get some "old" code on that architecture from XMOS. Problem is, that Code is completely written in C... and its not like 10 lines or so ... there are thousands. The plan was not to change the code to XC, because that would be really crazy ... there are so many pointers and so on... and XC doesn't support things like that. So at the moment i try to find out, what the lesser problem is: changing code to XC or getting special XMOS functions into C Code. My thought was,that there are maybe other guys thinking of that problems or so :) But it doesnt look like, well, and my time is quiet limited.

But thanks for your answer anyway!
User avatar
pstnotpd
XCore Addict
Posts: 161
Joined: Sun Jun 12, 2011 11:47 am

Post by pstnotpd »

Mahagon wrote:there are so many pointers and so on... and XC doesn't support things like that.
If pointers are involved you might also want to consider the fact that standard memory allocation, as far as I'm aware, only applies to the 64K per tile internal.

To "address" for instance the memory slice you'll have to use/create a memory manager. If your code uses pointers that much you're into a world of hurt anyway.