2) Making PASM code universally usable across all languages as binary blobs no matter if it was written in a Spin object or in GAS or whatever. Does Spin wrap address that ?
Heater,
I missed this bit earlier - I think you have nailed it. One of the main problems with the P1 is that PASM was never quite flexible enough to be used as a stand-alone assembler, and therefore was never quite flexible enough to be used as the basis for languages other than SPIN.
It certainly can be done (as has been demonstrated by Catalina and others), but it requires some extensions to PASM (as implemented in Homespun and BSTC) - and even so it still needs quite a bit of messing about.
If SPIN2 were to extend the PASM part of the language just slightly, then stand-alone PASM could be used not only in SPIN2, but also for portable objects, as well as for implementing higher-level languages that can use those same objects.
And it wouldn't even take much - syntax-wise, PASM2 could be a simple superset of PASM so that P1 PASM code could still compile and run on the P2 (except where instruction semantics or the hardware changes, of course - but these cases can be easily documented, and the language could even warn you automatically of any such cases).
While I think it would be a shame for existing P1 users if Parallax ditched the current PASM syntax and went with GAS, it would at least be workable (provided of course that GAS was also used as the assembler built into SPIN2).
And at least we would all have a common foundation for all future P2 work.
One of the main problems with the P1 is that PASM was never quite flexible enough to be used as a stand-alone assembler, and therefore was never quite flexible enough to be used as the basis for languages other than SPIN.
That's because SPIN + PASM is one unified thing. And doing that is part of the magic which brought many of us here. To be honest, I find the idea of breaking it offensive. There is no way I want GAS mixed in with the core SPIN+PASM implementation.
There is no reason to go breaking SPIN + PASM!
Had something like plugging GAS into SPIN been the setup here when I arrived, I very likely would have moved on.
Know what got me? I downloaded the data sheet and said, "Wow! This is crazy!" After looking around a little, I also thought, "bet it's hard to use too" Let's take a look...
One quick download later and I was looking through the samples in the Prop Tool. What I saw was genius, simple, flexible, and something a person could grok right away. Bought a Demo Board that day. When it arrived, I was stunned at the number of things I really didn't need to know in order to make stuff happen. And all that power in one place. Simple! Just write it, hit F10 and go!
Few things are that simple and powerful. Arduino makes the basics simple, but really doing magic takes considerable effort, and they've done a fine job with it all too. But, it's nothing like SPIN+PASM is. Frankly, nothing else is. Chip took a lot of the hassles out of this stuff, and that makes it fun as well as educational and productive.
But there is more...
C advocates here often ask what the deal is. Discussions like this really don't help the C cause. Not one bit. Ever wonder why people will just author killer things in SPIN+PASM? Did it ever occur to you guys that the reason why we get the contributions we do has something to do with how great, fun, productive, flexible, potent SPIN+PASM really is?
I've gone and advocated we make sure C is excellent, and actually said awesome on the Propeller 2. I want that to be true. Lots of us do. I think it's going to rock hard on P2, and the size and capability of the P2 will make for a great fit. Features were added to the P2, at some significant expense mind you, just to make sure C has a great shot at the awesome.
Going forward, we've all recognized the need for "standard" or "pro" type tools. It's been recognized by Parallax, and very significant efforts are underway to deliver those too. And Ross has done a perfectly fine job with Catalina. Not only do we have one C option, but two! And they are fine options!
What else do you guys really need? How much is enough?
Maybe if we make SPIN+PASM suck more, C might be more attractive?
Nothing wrong with GAS, mind you. It's just not unified with SPIN, and that matters a lot. Ever wonder about the attractiveness of Apple computers? Same deal. They do the whole thing, and they do what it takes to optimize that experience, standard or not too. People pay a lot, sometimes double for the same basic hardware due to that value add, and people have paid a LOT over time to get at the same value associated with the Propeller, and for many of the same kinds of basic reasons.
If "pro" or "standard" tools are needed, those really should be based off of OpenSpin. Leave the core SPIN+PASM as one unified thing. It can be put on chip for a self-hosted environment, it's great for knocking out quick projects, and it's fun as all get out too. Among many other things, like when we get to inline, it will be a simple, lean, common sense syntax that will just work and do the obvious things in the obvious ways...
Just understanding the discussion about how to inline in C takes more time than it took to get going on SPIN+PASM. Same goes for gcc and friends too, and that says a lot.
What it says most is that "pro" or "standard" tools have a lot of options needed for bigger projects, code reuse, integration into other tool chains, and so forth. We need that stuff. None of my comments should be taken as a negative about C and friends, or that we don't need it, etc...
It's not about that at all.
It is all about making sure we get the benefit of one unified design, just like we had with P1.
Like I said, the idea that we need to kill off the excellent SPIN+PASM environment is offensive really. If the one we should have had needs to be written, so be it. Seriously.
What we will and should have is the choices people need to maximize their use of the Propeller chip. That's what we should have.
Let's preserve the awesome, not break it.
Roy has it right. Let's get the core environment done, and likely see Chip port it to the P2 chip for a self-hosted environment. He's gonna get help doing that, because people want that. Done. Once that is done, it's gonna be mostly done and that's because the whole thing is simple to begin with. Lean.
Once Roy gets OpenSpin done, all the C and other HLL efforts can build off of that. And instead of breaking something pretty great, we can author tools to help people, who want to reuse or contribute to reuse, and get that done in ways they find productive and useful.
From there it's center of gravity and here's another basic thing to consider: What Chip did rocks hard. Those of us that like it, grok it, really like it for reasons already given. If all those standard, pro tools really can't compete reasonably, it seems to me that's a problem with those tools, not SPIN+PASM.
Good grief!
There won't be a common foundation because the use cases and motivations are orthoginal. I suppose there might be just one foundation if it gets ugly enough, and then a bunch of people just go away. Unified community at that point. Nice thoughts huh? I sure don't want to think 'em.
And I'll put it another way. When I'm on the free gig, having a good time, learning stuff, building stuff I want to build, you know enjoying how Parallax "powers your genius", SPIN+PASM makes a lot of sense a lot of the time. And it makes sense because of how it was made and why it was made too.
Pay me, and I'll be perfectly happy to deal with the standard, pro tools and write reusable code for you all the time. See how that works?
That's because SPIN + PASM is one unified thing. And doing that is part of the magic which brought many of us here. To be honest, I find the idea of breaking it offensive.
No-one is advocating breaking SPIN + PASM. But neither SPIN nor PASM are usable on the P2 in their current form - so change in this space is both inevitable and necessary.
All I am saying (and I believe Heater is thinking the same way) is that by extending PASM slightly, it can be used not only in SPIN + PASM, but also in C + PASM, BASIC + PASM, FORTH + PASM, etc etc - or just as plain old PASM!
What's notto like about that? It doesn't undermine SPIN at all, as far as I can see.
I don't really understand why this should be such a controversial issue.
I'm totally with you. I love Spin for all the reasons you sited. It's simple and quick to get started with, especially for non-expreience programmers. Having integerated PASM makes transitioning to assembler a doddle. The PASM syntax and P1 architecture are the simplest nicest assembly language programming environment I have ever seen. And so on.
I am not advocating breaking Spin/PASM, especially not for the P1.
So imagine the PII is out for two years and there are now a couple of hundred objects with assembly language drivers in the OBEX and floating around the forum. tens of thousands of man hours of work will have gone into creating them. They will have been written in both Spin and C.
Problem is those juicy assembler language drivers, are not usable between languages. Which seems kind of crazy and wasteful. Getting such code into peoples hands easily is what the Propeller ecosystem thrives on. It should be made friction free.
That is the problem we are discussing here. Perhaps you do not feel that is a problem.
One solution is my proposal for breaking the linkage between PASM and Spin by introducing the "PASM" section and a few simple rules around it. I don't believe this is a big hardship for Spin users. Most new users would probably accept the new syntax and not even notice the semantic differences.
Another solution is Roy's answer, get the tools to do the work. Open spin may be able to expose what linkage there is between PASM and Spin in such a way that C programmers could easily use the PASM binaries extracted from Spin objects.
Does that solution help going the other way? Assembler language drivers written by C programmers migrating to Spin programs ?
My feeling is that the "no-linkage" binary blob approach is the most universal way.
These ideas are worthy of more exploration. Or do we just let the problem persist into the PII world?
I really want to make my own tools function holistically with the hardware, without a bunch of stifling accommodations made for other paradigms.
However, I'm sure a mode of writing Spin and PASM code could be formalized, as has already been brought up here, that would enable inter-operability with C.
I totally agree. No stifling for me. I'm stifled enough already.
But there we have a contradiction, yes a mode of writing Spin and PASM code could be formalized, it would also be totally ignored by those "unstifled" programmers who don't know and/or care why there is such a formalism. We can almost be sure this will happen as such a formalism has been discussed on the P1 forum for years and even documented by RossH. It has all been ignored.
Would the introduction of a "PASM" section be stifling? Or just a neat way to organize code in the spirit of the Spin language?
However, I'm sure a mode of writing Spin and PASM code could be formalized, as has already been brought up here, that would enable inter-operability with C.
Yes, I think so too. But what Heater and I are proposing here is something even simpler - essentially, just "loosening" the tight coupling between SPIN and PASM, to facilitate using PASM either by itself, or in conjunction with languages other than SPIN.
It is already possible to do this - but so difficult that few bother to do so.
Perfectly understandable. I feel the same way myself.
Yes, I think so too. But what Heater and I are proposing here is something even simpler - essentially, just "loosening" the tight coupling between SPIN and PASM, to facilitate using PASM either by itself, or in conjunction with languages other than SPIN.
It is already possible to do this - but so difficult that few bother to do so.
Ross.
But that difficulty is what makes it not so appealing, isn't it?
I know you listed a few things that would have to be done. Would you mind listing them here (again) so that they could be contemplated? I know this stuff exists in another post, or posts. The simpler you can keep the guidelines, the better we can think about it.
I think that to enable Spin programmers to create PASM code that is usable outside of Spin, with C say, would require only slight modification to the Spin language:
1) Introduce a PASM section. This is basically a DAT section with some extra rules...
2) Any PASM code to be launched into a COG has to be in a PASM section.
3) Code in a PASM section cannot access any variables defined in Spin, VAR blocks or DAT sections, by name. This removes dependency of PASM from Spin data layout.
4) Spin code cannot write any locations in a PASM section, at least by name. This prevents initializing of LONGs and such prior to loading to COG. Data that C or other languages would not know about.
5) Due to 4) all parameters passed to PASM prior to launch go through pointers passed via PAR.
6) All communication between a running PASM code and Spin go through shared HUB as normal, using pointers passed through PAR.
The basic idea is to decouple the PASM and Spin. Then the PASM can be compiled and extracted as a usable "binary blob" or "firmware" by openspin or BST etc and used in other language systems.
This is not to onerous is it? It's even good practice, makes for nice clean code. In the same way a Spin object cannot see a sub-objects variables or PRI's.
Note: This works both ways. Such "binary blobs" created by C or whatever can be used in Spin by including them via a file statement. It's a win-win.
Yes discussions in the past got overly complex what with mailboxes, registries, etc. What is proposed here though is dead simple.
RossH has indeed converted drivers, he is not all talk. Others have done so as well. Even I adapted a couple of drivers back in the Zog C days. We don't want to do that again, and again, and again.
I also really don't want PASM and SPIN separate. That is not what is being proposed here.
Gas has nothing to do with this. It's not in the picture. That's for the C guys to suffer
The nice expressive DAT section can remain. The proposed PASM section is a DAT section, all the same expressive cool ways to express data remain in there.
But that difficulty is what makes it not so appealing, isn't it?
I know you listed a few things that would have to be done. Would you mind listing them here (again) so that they could be contemplated? I know this stuff exists in another post, or posts. The simpler you can keep the guidelines, the better we can think about it.
Getting over most of the difficulties and complexities could be done with a few simple conventions, plus a few simple changes or extensions to SPIN/PASM. For instance (this is just the first one that springs to mind) - why does a Spin object have to have at least one PUB segment to compile? All this does is force you to include a dummy method, which generates code that has to later be stripped out when all you want is the compiled PASM.
Heater has already summarized some of the conventions. I'll try and put a few more together this weekend and post them for wider discussion. I'd suggest we start a new thread (perhaps Heater would like to do so, since he started the discussion) so as not to clutter this one unduly.
No, of course not. If you are creating PASM objects that are only intended to operate withing your own SPIN program, or with other SPIN programs, you are free to use whatever conventions you want - and the interface to such objects is generally a set of SPIN methods anyway, with the PASM code nicely encapsulated.
But sometimes you just want to submit a chunk of generally useful PASM code, exposing some other interface - and there is currently no way to do so. You have to wrap it in SPIN because that is currently the only accepted convention - we have no convention to enable that code to be called from any cog, unless that cog is running SPIN. This has nothing to do with C - this code cannot even be called from another cog within the same SPIN program that is running PASM!
For that to be true Ross, we would need to ADD this PASM section and have the rules apply there, but not actually change how DAT works today.
I'm in favor of doing that. Maybe we should just call the new section BLOB. And I'm serious! Leave SPIN as is today and add BLOB to the list of section definitions and behaviors. In the BLOB section, do these reuse things so that we make sure a BLOB works well. That's a good thing!
This:
The whole idea of a binary blob for PASM is obsolete. We have HUBEXEC now.
Does anyone here really want to tell me that my hubexec PASM code is not allowed to see my labels in HUB?
Honestly. This is HUMBUG.
Is true and precisely why DAT and how SPIN+PASM works right now needs to be left alone. A lot of things will be possible, and yes not all that easy to reuse, but again, that's not always the primary case. Frankly, I think Chip has already seen this in that Pnut doesn't currently require any SPIN at all to build. It can assemble only.
Adding BLOB would provide for that intent, and we could very easily publish a lot of good stuff for people to use in the BLOB section when they have the intent to publish for reuse, or where people do conversions. Since the result is MIT, if published for sharing here in the traditional way we've done, doing that stuff is not only encouraged, but expected.
Re: Not all talk.
Heater, of course! Ross has done a fine job as have others. I'm sorry I implied otherwise. Wasn't my intent.
Re: No other convention.
Right now, Pnut works without having a PUB of any kind. Pretty easy to have that continue. And it's got SPIN 2 in there, but it's early and kind of broken at the moment too.
We can make a nice BLOB on P2 right now. If that isn't changed, would it not work for this purpose? One could use DAT in whatever way makes sense, and if Chip sees the core rules for a BLOB section and implements them, wouldn't that more or less reach the goals everyone has here?
Perhaps this discussion is really early, save for the idea of the BLOB section specifically intended for reuse, both directions even. If we do that, we could then package up something in C and bring it over. All good.
Adding something to SPIN for this purpose is good. We need it. Preventing things isn't something I'm a fan of, for reasons already given.
msrobots is right about it too. With HUBEX, making PASM BLOBS is not always going to happen now. And the unified SPIN+PASM is perfect for how HUBEX will end up working. Which, by the way, is precisely why I'm vocal about this right now.
And that means making a BLOB is something people will have a specific intent to do, which makes an addition aimed at making that happen nicely perfectly sensible.
Seriously, how about we work to define BLOB so that it's a total win for the reuse case? Split the middle, so to speak.
CON ' for the BLOB
...
BLOB ' just like DAT, but enforces certain rules... ie no access to labels outside of this BLOB section, but exports 'par' and 'start' as long aligned hub addresses
par LONG ....
' more parameters, each with a label
' BLOB could export:
' - a .h with a struct for C/C++ for accessing the parameters
' - a .spin automatically generated interface (would be nice if Spin supported struct's)
start ' where the cog entry point is
I think that is all we really need.
It could export an object file, with the first long encoding relative par&start in the fashion COGRUN/COGRUNX needs.
NOTE:
Normal current expected Spin/Pasm would not change at all.
I don't know what any of You need possibility of ASSEMBLE without invoke SPIN part.
BUT I need that to that type of programing.
' Portable Low Type Driver
' I don't know what You will call it.
DAT
orgh @XXX
DriveTable
jmp @Init
jmp @SD_read_sector
jmp @SD_read_Dir
jmp @SD_write_sector
jmp @SD_write_Dir
......... and so on
ret ...... end table
Init
xxx xxx,xxx
ret
SD_read_sector
xxx xxx,xxx
ret
SD_read_Dir
xxx xxx,xxx
ret
SD_write_sector
xxx xxx,xxx
ret
SD_write_Dir
xxx xxx,xxx
ret
BTW, when I say leave SPIN as it is today, I don't mean it literally. New things are needed for P2. We discussed object pointers, larger memory space, now BLOB, inline, tasks, etc...
Almost...It's not the PropTool that was born to simple it was the Spin language itself. Spin + included PASM that is.
The structure of which you speak, "spin in one side and pasm in other having a fixed interface" is not a function of the tool used for editing but the very language definition. Don't forget there are many other Spin compilers that do not depend on any GUI tool to use.
Aside: I have noticed many times that users of IDE's, and especially VB, cannot tell the difference between a programming language and the tool they use to edit it.
Now, about those rules or structure...
I think that to get Spin programmers to create PASM code that is usable outside of Spin, with C say, would require only slight modification to the Spin language.
1) Introduce a PASM section. This is basically a DAT section with some extra rules...
2) Make it a requirement that any PASM code to be launched into a COG has to be in a PASM section.
3) Code on a PASM section cannot access any variables defined in Spin VAR blocks or DAT sections by name. This removes dependency of PASM from Spin data layout.
4) Spin code cannot access any locations in a PASM section, at least by name. This prevents initializing of LONGs and such prior to loading to COG. Data that C would not know about.
5) Due to 4) all parameters passed to PASM prior to launch are to go through pointers passed in PAR.
6) All communication between a running PASM code and Spin go through shared HUB as normal, using pointers passed through PAR.
With this in place there is no symbolic linkage between PASM and Spin, except for the starting address which Spin needs. With no linkage the resulting code can be compiled buy tools such as openspin, or BST into a binary blob that is usable by any language.
However, I suspect the Spin community would hate this idea.
Heater, sorry ... I do not agree ... perhaps is due to my lack of knowledge.
Take a class for example. I don' t want to introduce classes/istances as their real meaning, it is only an example of a file that exists in the ide, part of the project.
In classes you declare properties, methods and these are exposed to other part of program. Classes on the development system are files on the filesystem, with a known structure, part of the project.
Now if a pasm section instead of residing in dat will be a class (not in its real meaning, just in the way it is written) some longs can be properties. This mean they will be saved with a known structure. Spin can initialize these longs because they are exposed as properties. The same can happen for C.
A pasm "class" can be imported in a spin project or in a c project.
Perhaps you can even mix all. If you have a pasm class , a spin class a c class perhaps pasm and c can run natively while c-xmm and spin will be executed through their kernel/interpreter in a separate cog and they can communicate to each-other through the exposed properties, well known for everyone of them or better said well known for the ide that have to compile/link/assemble it with the right tools. Inside every single kind of class the rules will pretty remain the same for every single language. The only difference is that one class can be only written in one language.
You can have a project choice (spin/pasm/c) that defines the primary application language. Than classes can be of any choice (spin/pasm/c/forth ...) and everything cooperates.
Why can't this concept work?
Now change the name, don't call it class ... it was to explain the idea with my poor english.
Now we have hubex mode, I was wondering if it might be nice to have a simple hook in the Rom Monitor to jmp/call a user monitor extension in hub.
ozpropdev and I have both been working on p2 debuggers - different but complimentary. I expect theremay be others too later.
What ifthey could be simply hooked (by a single command) into the monitor. This way our code could become extensions to the monitor.
I'm not opposed to it. Actually, maybe it's the right or a very good thing to do.
Seems to me, having the monitor check the very first two longs or maybe even the first one of HUB RAM for a signature and address, a debug package could just be uploaded right through whatever terminal people use. Have it always check this when a command is entered that isn't one of it's own, and if the package is there, pass the current command and address to it, and the user is off to the races.
The upload can be a file copy to the serial port, or a paste through the terminal. Either way, the package can specify those or that long, then any other addresses and data needed to place whatever extension makes sense, where it makes sense.
Early on, I was making heavy use of the copy / paste function to upload lots of data, and it worked very well. The way addresses work is either one specifies an address with a line of data, or a colon ":" and that makes relocating things, or even just specifying where things go super easy. The package would specify the low address long, or longs, then specify a start address, all the data for the package, another start address, all the data, if desired, etc...
A simple copy package.txt > COM8 gets it done! (documented in the monitor PDF, which I will update this time around)
BTW, doing this wouldn't really require HUBEX mode. It's just simpler.
Another thing: If that same check is always done in the monitor, a person who wants the integrated debugger can just include it, parking it at whatever address they feel makes sense given how their program works, then launch the monitor on a COG as part of their ordinary program startup too.
One question: How would an extension understand multiple monitors could be running, and do we care?
Why, because PII will have inline PASM and hub exec PASM which I don't think should be included in this scheme.
So long as the current function of DAT is unchanged, adding the BLOB scheme with the intent of helping to create reusable PASM is good. Otherwise, ALL PASM should remain as is in DAT, including that PASM targeted at a COG.
Comments
Heater,
I missed this bit earlier - I think you have nailed it. One of the main problems with the P1 is that PASM was never quite flexible enough to be used as a stand-alone assembler, and therefore was never quite flexible enough to be used as the basis for languages other than SPIN.
It certainly can be done (as has been demonstrated by Catalina and others), but it requires some extensions to PASM (as implemented in Homespun and BSTC) - and even so it still needs quite a bit of messing about.
If SPIN2 were to extend the PASM part of the language just slightly, then stand-alone PASM could be used not only in SPIN2, but also for portable objects, as well as for implementing higher-level languages that can use those same objects.
And it wouldn't even take much - syntax-wise, PASM2 could be a simple superset of PASM so that P1 PASM code could still compile and run on the P2 (except where instruction semantics or the hardware changes, of course - but these cases can be easily documented, and the language could even warn you automatically of any such cases).
While I think it would be a shame for existing P1 users if Parallax ditched the current PASM syntax and went with GAS, it would at least be workable (provided of course that GAS was also used as the assembler built into SPIN2).
And at least we would all have a common foundation for all future P2 work.
Ross.
That's because SPIN + PASM is one unified thing. And doing that is part of the magic which brought many of us here. To be honest, I find the idea of breaking it offensive. There is no way I want GAS mixed in with the core SPIN+PASM implementation.
There is no reason to go breaking SPIN + PASM!
Had something like plugging GAS into SPIN been the setup here when I arrived, I very likely would have moved on.
Know what got me? I downloaded the data sheet and said, "Wow! This is crazy!" After looking around a little, I also thought, "bet it's hard to use too" Let's take a look...
One quick download later and I was looking through the samples in the Prop Tool. What I saw was genius, simple, flexible, and something a person could grok right away. Bought a Demo Board that day. When it arrived, I was stunned at the number of things I really didn't need to know in order to make stuff happen. And all that power in one place. Simple! Just write it, hit F10 and go!
Few things are that simple and powerful. Arduino makes the basics simple, but really doing magic takes considerable effort, and they've done a fine job with it all too. But, it's nothing like SPIN+PASM is. Frankly, nothing else is. Chip took a lot of the hassles out of this stuff, and that makes it fun as well as educational and productive.
But there is more...
C advocates here often ask what the deal is. Discussions like this really don't help the C cause. Not one bit. Ever wonder why people will just author killer things in SPIN+PASM? Did it ever occur to you guys that the reason why we get the contributions we do has something to do with how great, fun, productive, flexible, potent SPIN+PASM really is?
I've gone and advocated we make sure C is excellent, and actually said awesome on the Propeller 2. I want that to be true. Lots of us do. I think it's going to rock hard on P2, and the size and capability of the P2 will make for a great fit. Features were added to the P2, at some significant expense mind you, just to make sure C has a great shot at the awesome.
Going forward, we've all recognized the need for "standard" or "pro" type tools. It's been recognized by Parallax, and very significant efforts are underway to deliver those too. And Ross has done a perfectly fine job with Catalina. Not only do we have one C option, but two! And they are fine options!
What else do you guys really need? How much is enough?
Maybe if we make SPIN+PASM suck more, C might be more attractive?
Nothing wrong with GAS, mind you. It's just not unified with SPIN, and that matters a lot. Ever wonder about the attractiveness of Apple computers? Same deal. They do the whole thing, and they do what it takes to optimize that experience, standard or not too. People pay a lot, sometimes double for the same basic hardware due to that value add, and people have paid a LOT over time to get at the same value associated with the Propeller, and for many of the same kinds of basic reasons.
If "pro" or "standard" tools are needed, those really should be based off of OpenSpin. Leave the core SPIN+PASM as one unified thing. It can be put on chip for a self-hosted environment, it's great for knocking out quick projects, and it's fun as all get out too. Among many other things, like when we get to inline, it will be a simple, lean, common sense syntax that will just work and do the obvious things in the obvious ways...
Just understanding the discussion about how to inline in C takes more time than it took to get going on SPIN+PASM. Same goes for gcc and friends too, and that says a lot.
What it says most is that "pro" or "standard" tools have a lot of options needed for bigger projects, code reuse, integration into other tool chains, and so forth. We need that stuff. None of my comments should be taken as a negative about C and friends, or that we don't need it, etc...
It's not about that at all.
It is all about making sure we get the benefit of one unified design, just like we had with P1.
Like I said, the idea that we need to kill off the excellent SPIN+PASM environment is offensive really. If the one we should have had needs to be written, so be it. Seriously.
What we will and should have is the choices people need to maximize their use of the Propeller chip. That's what we should have.
Let's preserve the awesome, not break it.
Roy has it right. Let's get the core environment done, and likely see Chip port it to the P2 chip for a self-hosted environment. He's gonna get help doing that, because people want that. Done. Once that is done, it's gonna be mostly done and that's because the whole thing is simple to begin with. Lean.
Once Roy gets OpenSpin done, all the C and other HLL efforts can build off of that. And instead of breaking something pretty great, we can author tools to help people, who want to reuse or contribute to reuse, and get that done in ways they find productive and useful.
From there it's center of gravity and here's another basic thing to consider: What Chip did rocks hard. Those of us that like it, grok it, really like it for reasons already given. If all those standard, pro tools really can't compete reasonably, it seems to me that's a problem with those tools, not SPIN+PASM.
Good grief!
There won't be a common foundation because the use cases and motivations are orthoginal. I suppose there might be just one foundation if it gets ugly enough, and then a bunch of people just go away. Unified community at that point. Nice thoughts huh? I sure don't want to think 'em.
And I'll put it another way. When I'm on the free gig, having a good time, learning stuff, building stuff I want to build, you know enjoying how Parallax "powers your genius", SPIN+PASM makes a lot of sense a lot of the time. And it makes sense because of how it was made and why it was made too.
Pay me, and I'll be perfectly happy to deal with the standard, pro tools and write reusable code for you all the time. See how that works?
No-one is advocating breaking SPIN + PASM. But neither SPIN nor PASM are usable on the P2 in their current form - so change in this space is both inevitable and necessary.
All I am saying (and I believe Heater is thinking the same way) is that by extending PASM slightly, it can be used not only in SPIN + PASM, but also in C + PASM, BASIC + PASM, FORTH + PASM, etc etc - or just as plain old PASM!
What's not to like about that? It doesn't undermine SPIN at all, as far as I can see.
I don't really understand why this should be such a controversial issue.
Ross.
I'm totally with you. I love Spin for all the reasons you sited. It's simple and quick to get started with, especially for non-expreience programmers. Having integerated PASM makes transitioning to assembler a doddle. The PASM syntax and P1 architecture are the simplest nicest assembly language programming environment I have ever seen. And so on.
I am not advocating breaking Spin/PASM, especially not for the P1.
So imagine the PII is out for two years and there are now a couple of hundred objects with assembly language drivers in the OBEX and floating around the forum. tens of thousands of man hours of work will have gone into creating them. They will have been written in both Spin and C.
Problem is those juicy assembler language drivers, are not usable between languages. Which seems kind of crazy and wasteful. Getting such code into peoples hands easily is what the Propeller ecosystem thrives on. It should be made friction free.
That is the problem we are discussing here. Perhaps you do not feel that is a problem.
One solution is my proposal for breaking the linkage between PASM and Spin by introducing the "PASM" section and a few simple rules around it. I don't believe this is a big hardship for Spin users. Most new users would probably accept the new syntax and not even notice the semantic differences.
Another solution is Roy's answer, get the tools to do the work. Open spin may be able to expose what linkage there is between PASM and Spin in such a way that C programmers could easily use the PASM binaries extracted from Spin objects.
Does that solution help going the other way? Assembler language drivers written by C programmers migrating to Spin programs ?
My feeling is that the "no-linkage" binary blob approach is the most universal way.
These ideas are worthy of more exploration. Or do we just let the problem persist into the PII world?
However, I'm sure a mode of writing Spin and PASM code could be formalized, as has already been brought up here, that would enable inter-operability with C.
I totally agree. No stifling for me. I'm stifled enough already.
But there we have a contradiction, yes a mode of writing Spin and PASM code could be formalized, it would also be totally ignored by those "unstifled" programmers who don't know and/or care why there is such a formalism. We can almost be sure this will happen as such a formalism has been discussed on the P1 forum for years and even documented by RossH. It has all been ignored.
Would the introduction of a "PASM" section be stifling? Or just a neat way to organize code in the spirit of the Spin language?
It is already possible to do this - but so difficult that few bother to do so.
Ross.
But that difficulty is what makes it not so appealing, isn't it?
I know you listed a few things that would have to be done. Would you mind listing them here (again) so that they could be contemplated? I know this stuff exists in another post, or posts. The simpler you can keep the guidelines, the better we can think about it.
1) Introduce a PASM section. This is basically a DAT section with some extra rules...
2) Any PASM code to be launched into a COG has to be in a PASM section.
3) Code in a PASM section cannot access any variables defined in Spin, VAR blocks or DAT sections, by name. This removes dependency of PASM from Spin data layout.
4) Spin code cannot write any locations in a PASM section, at least by name. This prevents initializing of LONGs and such prior to loading to COG. Data that C or other languages would not know about.
5) Due to 4) all parameters passed to PASM prior to launch go through pointers passed via PAR.
6) All communication between a running PASM code and Spin go through shared HUB as normal, using pointers passed through PAR.
The basic idea is to decouple the PASM and Spin. Then the PASM can be compiled and extracted as a usable "binary blob" or "firmware" by openspin or BST etc and used in other language systems.
This is not to onerous is it? It's even good practice, makes for nice clean code. In the same way a Spin object cannot see a sub-objects variables or PRI's.
Note: This works both ways. Such "binary blobs" created by C or whatever can be used in Spin by including them via a file statement. It's a win-win.
You mean force right?
Yes discussions in the past got overly complex what with mailboxes, registries, etc. What is proposed here though is dead simple.
RossH has indeed converted drivers, he is not all talk. Others have done so as well. Even I adapted a couple of drivers back in the Zog C days. We don't want to do that again, and again, and again.
I also really don't want PASM and SPIN separate. That is not what is being proposed here.
Gas has nothing to do with this. It's not in the picture. That's for the C guys to suffer
The nice expressive DAT section can remain. The proposed PASM section is a DAT section, all the same expressive cool ways to express data remain in there.
Getting over most of the difficulties and complexities could be done with a few simple conventions, plus a few simple changes or extensions to SPIN/PASM. For instance (this is just the first one that springs to mind) - why does a Spin object have to have at least one PUB segment to compile? All this does is force you to include a dummy method, which generates code that has to later be stripped out when all you want is the compiled PASM.
Heater has already summarized some of the conventions. I'll try and put a few more together this weekend and post them for wider discussion. I'd suggest we start a new thread (perhaps Heater would like to do so, since he started the discussion) so as not to clutter this one unduly.
Ross.
The whole idea of a binary blob for PASM is obsolete. We have HUBEXEC now.
Does anyone here really want to tell me that my hubexec PASM code is not allowed to see my labels in HUB?
Honestly. This is HUMBUG.
Enjoy!
Mike
No, of course not. If you are creating PASM objects that are only intended to operate withing your own SPIN program, or with other SPIN programs, you are free to use whatever conventions you want - and the interface to such objects is generally a set of SPIN methods anyway, with the PASM code nicely encapsulated.
But sometimes you just want to submit a chunk of generally useful PASM code, exposing some other interface - and there is currently no way to do so. You have to wrap it in SPIN because that is currently the only accepted convention - we have no convention to enable that code to be called from any cog, unless that cog is running SPIN. This has nothing to do with C - this code cannot even be called from another cog within the same SPIN program that is running PASM!
Ross.
I'm in favor of doing that. Maybe we should just call the new section BLOB. And I'm serious! Leave SPIN as is today and add BLOB to the list of section definitions and behaviors. In the BLOB section, do these reuse things so that we make sure a BLOB works well. That's a good thing!
This:
Is true and precisely why DAT and how SPIN+PASM works right now needs to be left alone. A lot of things will be possible, and yes not all that easy to reuse, but again, that's not always the primary case. Frankly, I think Chip has already seen this in that Pnut doesn't currently require any SPIN at all to build. It can assemble only.
Adding BLOB would provide for that intent, and we could very easily publish a lot of good stuff for people to use in the BLOB section when they have the intent to publish for reuse, or where people do conversions. Since the result is MIT, if published for sharing here in the traditional way we've done, doing that stuff is not only encouraged, but expected.
Re: Not all talk.
Heater, of course! Ross has done a fine job as have others. I'm sorry I implied otherwise. Wasn't my intent.
Re: No other convention.
Right now, Pnut works without having a PUB of any kind. Pretty easy to have that continue. And it's got SPIN 2 in there, but it's early and kind of broken at the moment too.
We can make a nice BLOB on P2 right now. If that isn't changed, would it not work for this purpose? One could use DAT in whatever way makes sense, and if Chip sees the core rules for a BLOB section and implements them, wouldn't that more or less reach the goals everyone has here?
Perhaps this discussion is really early, save for the idea of the BLOB section specifically intended for reuse, both directions even. If we do that, we could then package up something in C and bring it over. All good.
Adding something to SPIN for this purpose is good. We need it. Preventing things isn't something I'm a fan of, for reasons already given.
msrobots is right about it too. With HUBEX, making PASM BLOBS is not always going to happen now. And the unified SPIN+PASM is perfect for how HUBEX will end up working. Which, by the way, is precisely why I'm vocal about this right now.
And that means making a BLOB is something people will have a specific intent to do, which makes an addition aimed at making that happen nicely perfectly sensible.
Seriously, how about we work to define BLOB so that it's a total win for the reuse case? Split the middle, so to speak.
I like the BLOB way
Suggestion:
I think that is all we really need.
It could export an object file, with the first long encoding relative par&start in the fashion COGRUN/COGRUNX needs.
NOTE:
Normal current expected Spin/Pasm would not change at all.
Suggestion:
New Obex category - BLOBS
I don't know what any of You need possibility of ASSEMBLE without invoke SPIN part.
BUT I need that to that type of programing.
Nope,
BLOB = Binary Large Object
or
BLOB = Blitter Object
http://www.acronymfinder.com/BLOB.html
http://en.wikipedia.org/wiki/Binary_large_object
However I think BLOB is actually a better name for that new Spin section than my suggested PASM.
Why, because PII will have inline PASM and hub exec PASM which I don't think should be included in this scheme.
Parallax would not be the first one to reference loadable... Like you say, it's a good fit anyway.
I mean the basic syntax and how DAT works.
Heater, sorry ... I do not agree ... perhaps is due to my lack of knowledge.
Take a class for example. I don' t want to introduce classes/istances as their real meaning, it is only an example of a file that exists in the ide, part of the project.
In classes you declare properties, methods and these are exposed to other part of program. Classes on the development system are files on the filesystem, with a known structure, part of the project.
Now if a pasm section instead of residing in dat will be a class (not in its real meaning, just in the way it is written) some longs can be properties. This mean they will be saved with a known structure. Spin can initialize these longs because they are exposed as properties. The same can happen for C.
A pasm "class" can be imported in a spin project or in a c project.
Perhaps you can even mix all. If you have a pasm class , a spin class a c class perhaps pasm and c can run natively while c-xmm and spin will be executed through their kernel/interpreter in a separate cog and they can communicate to each-other through the exposed properties, well known for everyone of them or better said well known for the ide that have to compile/link/assemble it with the right tools. Inside every single kind of class the rules will pretty remain the same for every single language. The only difference is that one class can be only written in one language.
You can have a project choice (spin/pasm/c) that defines the primary application language. Than classes can be of any choice (spin/pasm/c/forth ...) and everything cooperates.
Why can't this concept work?
Now change the name, don't call it class ... it was to explain the idea with my poor english.
I have been tiling and painting at my son's house all day so expected to be cheared up by some amazing discoveries
ozpropdev and I have both been working on p2 debuggers - different but complimentary. I expect theremay be others too later.
What ifthey could be simply hooked (by a single command) into the monitor. This way our code could become extensions to the monitor.
Thoughts ?
Seems to me, having the monitor check the very first two longs or maybe even the first one of HUB RAM for a signature and address, a debug package could just be uploaded right through whatever terminal people use. Have it always check this when a command is entered that isn't one of it's own, and if the package is there, pass the current command and address to it, and the user is off to the races.
The upload can be a file copy to the serial port, or a paste through the terminal. Either way, the package can specify those or that long, then any other addresses and data needed to place whatever extension makes sense, where it makes sense.
Early on, I was making heavy use of the copy / paste function to upload lots of data, and it worked very well. The way addresses work is either one specifies an address with a line of data, or a colon ":" and that makes relocating things, or even just specifying where things go super easy. The package would specify the low address long, or longs, then specify a start address, all the data for the package, another start address, all the data, if desired, etc...
A simple copy package.txt > COM8 gets it done! (documented in the monitor PDF, which I will update this time around)
BTW, doing this wouldn't really require HUBEX mode. It's just simpler.
Another thing: If that same check is always done in the monitor, a person who wants the integrated debugger can just include it, parking it at whatever address they feel makes sense given how their program works, then launch the monitor on a COG as part of their ordinary program startup too.
One question: How would an extension understand multiple monitors could be running, and do we care?
Amiga blitter objects was called BOBs. and not BLOBs.
And this:
So long as the current function of DAT is unchanged, adding the BLOB scheme with the intent of helping to create reusable PASM is good. Otherwise, ALL PASM should remain as is in DAT, including that PASM targeted at a COG.