Starting with Assembler

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Starting with Assembler

Post by DrFingersSchaefer »

I have programmed using assembler before on other processors but am looking to get started with the G4.

I have had a rummage through the IDE and development tools and am struggling to work out how to best get started with them.

The project I am working on is an assembler only project and therefore very minimalist, but the XDE toolset does'nt appear to have an assembler only mode/template ready to go. (although it does have C and XC)

Is there any chance of some direction on the best way to use the tool set for assembler only projects, together with some sample assembler code to use as a quick start template.

I think I would be happy to run up a "Hello world" assembler app to start with and then work it out form there.

Thanks in advance.

:ugeek:


"Dr Fingers Schaefer, The Lobotomy Kid"
Caesar ad sum iam forti
Brutus ad erat
Caesar sic in omnibus
Brutus sic in at
:ugeek:
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

Here is a simple program:

Code: Select all

	.text
	.file "test.S"

	.globl main
	.globl _start
	.globl main.nstackwords
	.linkset main.nstackwords, 0

main:
_start:
	entsp   0
loop:
	ldc     r0, 1
	ldc     r1, 2
	add     r2,r0,r1
	bu      loop
	retsp   0 
It assembles with this command run from the Desktop Tools prompt:

Code: Select all

xcc Test.S -g -nostdlib -nostartfiles -Xmapper --nochaninit -target=XC-5 -o Test.xe
I put it in a batch file called assemble.bat

This stuff doesn't seem to be documented anywhere. I needed some help on the Xlinkers forum from someone at XMOS, before I got the incantations correct.

Leon
User avatar
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Post by DrFingersSchaefer »

Thanks leon, much appreciated.

I will give that a go and see if I can expend it to hello world for the XC-1.

I am currently looking at hacking out Forth for the G4, but want to do it in assembler for speed/compactness. Plus I would prefer to use as much of the native hardware as possible. This is why I am currently avoiding a C forth as a start point. (Much as it's tempting)

You don't know of the top of your head if there is an assembler listing function for the XDE do you?? I think I could learn a bunch from running up the example UART C hello world prog and looking at the assembler listing/source if it could kick one out.

:ugeek:
"Dr Fingers Schaefer, The Lobotomy Kid"
Caesar ad sum iam forti
Brutus ad erat
Caesar sic in omnibus
Brutus sic in at
:ugeek:
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

Using the compiler from the command line with the -save-temps switch should work.

Leon
User avatar
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Post by DrFingersSchaefer »

Yup, Command line looks like it is going to have to be it.

Frustrating morning so far. The XDE IDE is taking up more time than it is worth. (FUBAR)

:evil:

Buttons not working with mouse, Tutorial examples that are not compiling binaries and giving no errors.

:evil: :evil:

If I can get as far as getting a forth up and running for it I will be able to bypass it all.

:ugeek:
"Dr Fingers Schaefer, The Lobotomy Kid"
Caesar ad sum iam forti
Brutus ad erat
Caesar sic in omnibus
Brutus sic in at
:ugeek:
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

It's probably compiling another program, rather than the one you think it is compiling. That's caught me out a couple of times. You need to check that you created a new project properly.

Leon
User avatar
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Post by DrFingersSchaefer »

No longer loosing the will to live. It uggered off a couple of hours ago. :roll:

Can't get the tools to run from the CLI what ever I do.

Tried the 9.9.2 64 bit
9.9.1 32 bit and 9.9.1 64 bit, all no go on Ubuntu Karmic.

I guess it explains why the IDE is failing if it won't run the compiler form the command line.

There must be something incredibly daft I am doing or have'nt installed as a prerequisite but am struggling to see what, at the moment.

Just loading up Centos in a Virtual Machine at least if that wont have it I can get some support or other from XMOS.

I have got a rudimentary makefile based IDE cobled together though. A touch pre ark but hey it's some progress.

Your right about documentation there looks to be a lot but it is a bit thin where you need it when starting off (Particularly if doing assembler). A detailed/good memory map wouldn't go amiss, the register descriptions are a touch sparse too. Something a bit more visual to aid visualisation would be great.

Off to open as bottle.

:ugeek:
"Dr Fingers Schaefer, The Lobotomy Kid"
Caesar ad sum iam forti
Brutus ad erat
Caesar sic in omnibus
Brutus sic in at
:ugeek:
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

I checked that that program compiled OK with that batch file before I posted them, as I originally used them with an earlier version of the tools. They worked fine for me! I am running WinXP, BTW, and not Linux.

Leon
User avatar
that_awesome_guy
Member
Posts: 10
Joined: Mon Dec 14, 2009 7:06 pm

Post by that_awesome_guy »

DrFingersSchaefer wrote:No longer loosing the will to live. It uggered off a couple of hours ago. :roll:

Can't get the tools to run from the CLI what ever I do.

Tried the 9.9.2 64 bit
9.9.1 32 bit and 9.9.1 64 bit, all no go on Ubuntu Karmic.
This of any use? http://www.xmoslinkers.org/forum/viewto ... ?f=4&t=698
User avatar
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Post by DrFingersSchaefer »

Leon, yeah I guessed what you suggested was certainly good which is why I tried the other software versions/items.

But "That Awesome Guy" certainly looks to be, the problem you flagged up is exactly the one I was getting so I will try that next.

What stars you all are, and it isn't just the red talking.

:ugeek:
"Dr Fingers Schaefer, The Lobotomy Kid"
Caesar ad sum iam forti
Brutus ad erat
Caesar sic in omnibus
Brutus sic in at
:ugeek: