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

Post by DrFingersSchaefer »

WooooHoooo

:shock:

Thanks guys, the XDE compiles demos now.

The ia32libs did the trick. I will have a play with Leon's assembler snippets and see if I can get an ASM script out of the CLI tomorrow evening.

My Ubuntu is 64 bit, and I had tried the 64 bit XDE 9.9.1 and 9.9.2 both. Shame they are not 64 bit realy.

There is a fair chance that the download and flash utils may work now too.

: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
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Post by DrFingersSchaefer »

Made quite a bit of progress with setting up the structure and file for the G4th project, including m4 preprocessing.

Haven't managed to get it to successfully assemble the test snipet yet. The XDE command line tool now look to be running fine so the fixes you guys have suggested I think are great.

The assembler/XCC halts with an error claiming that the xc-5 target isn't recognised. I tried xc-1 as well as a just in case.

Next stop probably to pester XMOS for some form of documentation for assembling.
"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
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am

Post by paul »

DrFingersSchaefer wrote: Next stop probably to pester XMOS for some form of documentation for assembling.
A good place to start are these two documents:

XS1 Assembly Language Manual
The XMOS XS1 Architecture

There is also a nice interrupts example on XMOS linkers - http://www.xmoslinkers.org/forum/viewto ... 2416#p2416
Paul

On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
User avatar
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Post by DrFingersSchaefer »

Paul

Thanks for the links, I have already read the first two.

The assembler manual is targeted at those who might write an assembler or compiler and specifies grammar etc.

The second is targeted at those who have an assembler tool they can successfully wield so as to start and mess with the hardware on a processor. It describes what sort of machine code sequences are best to work with certain of the features on silicon.

The hole is the bit in the middle. It's a bit like being given a video recorder with two manuals. The first specifies how you might design a video recorder. The second tells you how to work the TV connected to the video recorder.

What you really need is a manual on how to work the video recorder and what features it has/hasn't got. Where we know what the beast, is, and can do, we can work around the rest if it is necessary.

Questions like:-

What command line parameters does it recognise and what do they do ??
Does the Assembler do any types of optimisation ?
Is it piccy about file extensions ?
etc etc etc.

In our case I am given to understand that the assembler is not a macro assembler so I am preprocessing with m4. (Problem + workaround).

Leon has been good enough to provide an example invocation that works for him. Very few of us are aware of what other options are open to us though. I think Leon needed to get what he had from XMOS.

Your last link looks to be great I hadn't spotted that one. I will go and have a rummage now.

(BTW nice vt100, or it the 101 ??, used to run SCO Xenix 286 with a couple of those connected.)
"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
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Post by DrFingersSchaefer »

Just found something that might be useful in the back of the tools guide. Appendix B4 page 53. It is really describing the CLI interface for the XCC tool and is by necessity of course looking at it form a C perspective but there appears to be some useful notation on some of the parameters for XCC. It also says which xml file the target descriptions should be in.

As I am currently trying to get XCC to do assembly it could be useful.

Off to have a play.

Dropped XMOS a message as king for more info on assembler.
"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
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Post by DrFingersSchaefer »

OK

After more rummaging about in the XDE folders etc something has become apparent.

xas is the assembler app -v --help shows the options and the target arch options (-march) are xs1a or xs1b, anyone know which we should use for which silicon ????

xmap is the linker/mapper --help shows the options again -march is looking for either xs1a or xs1b output types look to be various multinode special boot types and XE or XB bootable.

I am at the moment wondering why go through xcc to use these tools ??????

I guess it could be much simpler with some targeted docs, it also looks like the XDE could be paired down savagely for my project.
"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 »

xcc simply runs xas if it is used on a .s or .S file.

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

Post by DrFingersSchaefer »

Quite...

xcc though adds in a bunch of extras that are necessary for C. Using parameters to xcc that don't quite map to both xas and xmap correctly causes one or other to fail but your never quite sure which one or how because some of the failures are obscured by what xcc chooses to pass back. I tried a whole bunch of combinations which ones worked and which ones didn't appeared to be a touch random (they weren't really I just didn't know what I was doing, and was making it up as I went along)

I have achieved assembly and am now left with sorting out xmap.

Code: Select all

  27 main:
  28 _start:
  29 00000000 : 40 77       entsp 0  # revb_ENTSP_u6
  30 loop:
  31 00000002 : 01 68       ldc r0 , 1  # revb_LDC_ru6
  32 00000004 : 42 68       ldc r1 , 2  # revb_LDC_ru6
  33 00000006 : 21 10       add r2 , r0 , r1  # revb_ADD_3r
  34 00000008 : 04 77       bu loop  # revb_bu_BRBU_u6
  35 0000000a : C0 77       retsp 0  # revb_RETSP_u6
That's your wonderful snippet, that is.
"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
DrFingersSchaefer
Experienced Member
Posts: 65
Joined: Fri Dec 18, 2009 1:27 pm
Location: The Interzone

Post by DrFingersSchaefer »

On the differences between -march=xs1a and xs1b.

This is getting a touch confusing xs1b appears to be supported but not xs1a. See the responses below.

Code: Select all

fingers@quicksilver:~/Data/Common/development/G4th$ make all
rm -f G4th.o G4th.o.txt G4th.xb G4th.asm *.tar.gz *~ 
m4 forth.masm >G4th.asm
xas G4th.asm -l -v -march=xs1a -o G4th.o
G4th.asm:29: Error: A00004 Unknown opcode 'entsp'
G4th.asm:31: Error: A00004 Unknown opcode 'ldc'
G4th.asm:32: Error: A00004 Unknown opcode 'ldc'
G4th.asm:33: Error: A00004 Unknown opcode 'add'
G4th.asm:34: Error: A00004 Unknown opcode 'bu'
G4th.asm:35: Error: A00004 Unknown opcode 'retsp'
make: *** [G4th.o] Error 1

fingers@quicksilver:~/Data/Common/development/G4th$ make all
rm -f G4th.o G4th.o.txt G4th.xb G4th.asm *.tar.gz *~ 
m4 forth.masm >G4th.asm
xas G4th.asm -l -v -march=xs1b -o G4th.o
xmap G4th.o -save-temps --report --bootable -march=xs1a -o G4th.xb
xmap: Error: Unrecognised flag "-march=xs1a".
make: *** [G4th.xb] Error 1

fingers@quicksilver:~/Data/Common/development/G4th$ make all
rm -f G4th.o G4th.o.txt G4th.xb G4th.asm *.tar.gz *~ 
m4 forth.masm >G4th.asm
xas G4th.asm -l -v -march=xs1b -o G4th.o
xmap G4th.o -save-temps --report --bootable -march=xs1b -o G4th.xb
xmap: Warning: No platform specified; using default (XS1-G4B-FB512). This behavior is deprecated.
xmap: Error: Cannot location default platform xn because XCC_DEVICE_PATH is not set.
make: *** [G4th.xb] Error 1
Looking at the platform error and comparing the processor designator on my xc-1 prompts some questions.

My xc-1 appears to have a XS1-G4A-FB512 soldered in.

As you can see from the excerpt above I tried the xs1a option from -march and it doesn't look to be supported.

Is this a problem ??
Is the code for the A and B versions of the G4 compatible ??
What is the difference if any from a coding view point. ??

Methinks some of these questions are going to need answers from XMOS.

Hmmm moff to play some more.
"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
trousers
Active Member
Posts: 44
Joined: Fri Dec 11, 2009 10:20 am

Post by trousers »

Stick with xs1b. Everything except very early XDKs have rev B chips.

Yes, the chip markings are confusing.
Best friends with the code fairy.