P2 Compilers: PNUT, GAS, ??? Pros & Cons?
Cluso99
Posts: 18,069
I have been using PNUT for P2 PASM compiles (I know, its and assembler).
However, I would really like to use macros for the LMM code that I am using in my debugger for things such as call, ret, branch, jump, push and pop. David suggested GAS.
Where do I get it, how does it work, any restrictions?
Note I am a windoze only user.
Roy's OpenSpin compiler is currently only for P1.
What is the rationalle behind having two open compilers (GAS and OpenSpin) ? What are the differences?
BTW I understand pnut is a quick interim solution by Chip, so I have ignored this one.
However, I would really like to use macros for the LMM code that I am using in my debugger for things such as call, ret, branch, jump, push and pop. David suggested GAS.
Where do I get it, how does it work, any restrictions?
Note I am a windoze only user.
Roy's OpenSpin compiler is currently only for P1.
What is the rationalle behind having two open compilers (GAS and OpenSpin) ? What are the differences?
BTW I understand pnut is a quick interim solution by Chip, so I have ignored this one.
Comments
OpenSpin is a Spin compiler that does the full spin language and PASM.
PNUT can actually Spin also, it just hasn't been fixed to deal with the P2 fully. PNUT is Chips executable wrapper around the x86 ASM code that is the compiler/assembler. I ported the earlier version of this for P1. I will be bringing over the changes for P2 as well. However, I have to finish other things first.
Roy
Thanks for that
If possible some DOC on differences to PASM
There's the original, the Intel, the old PASM and the new PASM...
I think the old PASM threw some people because the program counter was in increments of "4" bytes instead of "1" long...
But, I could be way, way off..
Thanks,
David
Some of the GAS restrictions can probably be lifted, but it probably won't ever be 100% compatible with PASM. On the other hand a lot of programs can compile with either one.
Eric
(1) Unsure
(2) How do we embed a <cr> ?
(3) ???
(4) Can work around although I often use it
(5) Are these only the special concatenated operators? i.e. is <, <=, *, etc fine?
(6) Can work around
(7) OK
(8) No problems
(9) No problems - in fact preferred
(10) Agreed, no problems
I understand we can run a pre-processor. Could this handle (2) and (4) temporarily?
(1) and (3) are the huge features I think most of us require. Of course (2) is required for GCC.
I understand GAS also has INCLUDE ???
However, we have to use a linker. What is available and how easy is it to use? Presume both GAS and LINKERcould be placed in a .bat file in windows?
Perhaps best to explain what I do now (P2 only and on Windows7)...
Use PNUT to edit and create .OBJ file
Switch to DOS Commandline and run P2.BAT which does...
p2load -v -b 115200 -s XXX.obj -h -T
So I can easily modify the P2.bat file to run GAS, Linker and P2Load.
I agree it's inconvenient, but unfortunately gas is pretty serious about distinguishing between numbers (byte directive) and characters (ascii directive). We're looking at ways to preprocess this away, but it requires special handling beyond what the normal preprocessor can do.
Sorry, that was a bit terse! What I meant is that repeat counts in byte/word/long are not understood by GAS, so: won't work. I think there is a way around this. GAS has its own notion of repeat counts, and we can probably in a future release provide translation.
Right... GAS pretty much only understands the same operators as C.
It has a built in .include directive. It's also easy to run the assembly source through the C pre-processor (which can be invoked automatically by the gcc compiler driver). You can use either or both of GAS built in macros and C pre-processor macros; the GAS ones look more like assembler instructions and are more powerful than C macros (you can loop in a GAS macro, for example).
The linker is a command line program, so it could pretty easily go in a batch file. For compiling a typical P2 assembly program you'd do: Here p2binary.ld is a simple linker script that you can use for all programs, something like: This selects what kind of output to make, then says to link the code starting at 0 with the .text sections of all inputs first, then the .data sections, then .bss. Those are the typical sections in C code, although in a simple COG program you would probably only have the default .text section.
The linker allows either ELF output (contains symbol and other debugging information and a load map allowing propeller-load to place sections in different parts of memory) or simple flat binary output; you can select this in the linker script or on the command line.
Eric