Starting a slicekit project without reinventing the wheel

New to XMOS and XCore? Get started here.
Post Reply
Treczoks
Active Member
Posts: 38
Joined: Thu Mar 21, 2013 11:18 am
Contact:

Starting a slicekit project without reinventing the wheel

Post by Treczoks »

Hi!

I'm quite new to the XMOS world, and I just got my SliceKit. Now I'm in the process of setting up my first project and I'm wondering:

There is the SliceKit-L16.xn file which defines all the ports and produces a meaningful platform.h with the port definitions - or at least could, if one took the job and added all the necessary definitions to the .xn file.

Is there a way to tell the system that I have got an EtherSlice at the Circle Port, and it "includes" this into the .cn file somehow, placing e.g. the RXD signals to port P4E0? I played around with the xSOFTip Explorer, but that did not help, either.

According to XMOS, the documentation for the .XN file is in the xTIME Composer guide (x3766B). So far, what I have read was not really helpful with regards to defining ports.

NOTE TO XMOS: On page 228, there is a table (Fig 62: Hierarchy of XN elements) where the references are still undefined, i.e. there is a bunch of "§??". And the last page of the Rev. B document is "235/229" - Rev. A had 229 pages ;-)

Why do I have to define ports in the .xn twice? There is Network->Package->Node->Port with Location and Name, and ExternalDevices->Device->Attribute with Name and Value (which contents are identical, which adds to the confusion over whether this is necessary, and for what).

Maybe I'm missing something big, but so far the .xn file only seems to add complexity to things without a benefit I can see.

Yours,
Christian Treczoks


User avatar
TSC
Experienced Member
Posts: 111
Joined: Sun Mar 06, 2011 11:39 pm

Post by TSC »

You're not supposed to define all ports and slices in the .xn file.

The .xn file is mainly for defining things like how multiple tiles are connected, boot configuration and labels for some ports (like onboard LEDs and buttons, etc).

The slot for the ethernet slice is defined in ethernet_conf.h which should be in your app_xxxxxx src folder. E.g. #define ETHERNET_USE_CIRCLE_SLOT 1

The actual port definitions for the Ethernet slice are in sc_ethernet\module_ethernet_board_support\SLICEKIT-L2 or the relevant path for whatever board you are using.
Treczoks
Active Member
Posts: 38
Joined: Thu Mar 21, 2013 11:18 am
Contact:

Post by Treczoks »

Hi!

Thanks for answering.
TSC wrote:You're not supposed to define all ports and slices in the .xn file.
The .xn file is mainly for defining things like how multiple tiles are connected, boot configuration and labels for some ports (like onboard LEDs and buttons, etc).
Hmm, where does one draw the distiction between "just some ports" and "not all ports"?
TSC wrote:The slot for the ethernet slice is defined in ethernet_conf.h which should be in your app_xxxxxx src folder. E.g. #define ETHERNET_USE_CIRCLE_SLOT 1
The actual port definitions for the Ethernet slice are in sc_ethernet\module_ethernet_board_support\SLICEKIT-L2 or the relevant path for whatever board you are using.
There is no such file in my source directory (I started with a new, empty project). Additionally, a search for the files in Programs\XMOS turns up empty.

Any idea where they would hide in a newly set up xTIMEcomposer?

Yours, Christian
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Post by Bianco »

Treczoks wrote:Hi!

Thanks for answering.
TSC wrote:You're not supposed to define all ports and slices in the .xn file.
The .xn file is mainly for defining things like how multiple tiles are connected, boot configuration and labels for some ports (like onboard LEDs and buttons, etc).
Hmm, where does one draw the distiction between "just some ports" and "not all ports"?
TSC wrote:The slot for the ethernet slice is defined in ethernet_conf.h which should be in your app_xxxxxx src folder. E.g. #define ETHERNET_USE_CIRCLE_SLOT 1
The actual port definitions for the Ethernet slice are in sc_ethernet\module_ethernet_board_support\SLICEKIT-L2 or the relevant path for whatever board you are using.
There is no such file in my source directory (I started with a new, empty project). Additionally, a search for the files in Programs\XMOS turns up empty.

Any idea where they would hide in a newly set up xTIMEcomposer?

Yours, Christian
The defining of port names are much like using #define macro's in C/XC.
They will be handled by the preprocessor. It is up to you when it is a good moment to use them or not and whether to define them in source files or XN files.

If you start a new project for the slicekit you will not have the configuration files that TSC mentions. Basically you have to implement your own system or copy how its done in existing projects that do support slicekit configurability.
User avatar
TSC
Experienced Member
Posts: 111
Joined: Sun Mar 06, 2011 11:39 pm

Post by TSC »

If you're getting started with Ethernet, I'd recommend using the sc_xtcp project. It implements a TCP stack, so you only have to do things on a high level without worrying about all the low level stuff.

It you use sc_xtcp, you will also need sc_ethernet and sc_otp. These are also on github.com/xcore.

Try running one of the demo apps included with sc_xtcp, then you might be able to modify it to do what you want to do. All the configuration files will be in either sc_xtcp or sc_ethernet, either in working form or as an example.

You probably won't have to deal with the .xn file at all unless you use a custom board or want to chain multiple boards together, so don't worry about that for now.

As Bianco said, the port definitions in an .xn file are just labels for convenience. For example, if your board has a built-in LED, the .xn file should contain a definition so that your code could use LED1 instead of XS1_PORT_1J. Because the SliceKit doesn't really have any onboard peripherals, the only definitions in SLICEKIT-L16.xn are for SPI flash. Any #define ports you need should be put in your code if it's not already taken care of in a module.
Treczoks
Active Member
Posts: 38
Joined: Thu Mar 21, 2013 11:18 am
Contact:

Post by Treczoks »

TSC wrote:If you're getting started with Ethernet, I'd recommend using the sc_xtcp project. It implements a TCP stack, so you only have to do things on a high level without worrying about all the low level stuff.
Thanks for your answer. But I don't want a TCP/IP stack. My application is located somewhere between ISO layer 1 and 2 (proprietary bus, ethernet PHY to transfer the data with preamble, data, and gap, but not even a MAC or something - all the data from end of preamble to dropping TransmitEnable is mine, Mine, MINE!), so stripping down a TCP/IP protocol stack would be like stripping down a car to get a light switch ;-)
The link is only point-to-point, there are no switches involved, so abusing
I will have another look or two into the TCP/IP code samples, though, but only to deal with some odd data receiving problems I encountered.

Yours, Christian
Post Reply