Arduino libraries.
Martin Hodge
Posts: 1,246
Now that we are beginning to have a workable build environment with some c++. Is it time to discuss this?
Comments
I do feel we need to make some sort of library that handles some of the IO of the propeller to ease the transition from Spin and other implementations of C on micro-controllers.
I agree with this. Would be nice to make a PBASIC-like library. Your thread already mentions some of the functions required. Please continue.
I've gotten as far as cloning the Arduino source from github and starting the build. It doesn't really build anything. It seems to simply launch a Java VM and bring up the GUI. From there, if I'm reading right, the GUI simply calls avr-gcc and links in various libraries. (avr-gcc is installed from rpm/deb on most distros.)
Right now I'm having some problems with git wanting to load up over 900MB of unknown "stuff" the /.git directory.
The repo is here
Build instructions here
What the Arduino does to build a sketch, here
What is the prototype code? Would it be to take an Arduino sketch that reads a pushbutton and lights a led, and take that code and drop it into another IDE (or the Arduino IDE) and plug in the Propeller ASC and the circuit works exactly the same?
If you could do that, then it would open up many more potential customers to the propeller.
Martin, sorry that I haven't had any time to work on it yet.
Jazzed, you have more important things to do right now. No need to apologize. I'm surprised to learn that you had considered working on it at all actually.
I'm going to be spending a lot of time playing catch up to you guys on the coding. If there is anybody doing work on it (Kevin?) I'd only ask that a repo be set up, on your choice of host, so that I can watch and learn. I can supply a free ASC to up to five individuals who're seriously considering working on it. A good candidate for testing and development might be the Danger Shield, which is a conglomeration of basic IO devices like pots, light & temp sensors, buttons, LEDs and a shift register. It's cheap and exercises all of the ASCs digital and analog IO.
Just tossing up ideas.
What you propose is intriguing. As I am developing the "PBasic" style library I see a lot of functions that could easily be ported over to the Arduino Library. It gets tricky though when you start dealing with the differences between the Propeller and AVR chips. For example how will we do AttachInterrupt to the Propeller chip? On the flip side many of the Arduino functions will be deterministic since there are no interrupts to slow down timing loops.
Since the libraries are set up for interrupts we would probably have to "hide" the cog operations from the user. This may give the illusion of having no big advantage since the user won't see how the cogs improve things. Also we would have to determine which routines would actually be in cogs. Some like serial communications would most definitely be in a cog but would we really need to put the Tone function into a cog?
I'm very interested in this project but I first need to get the library I started done and I probably wouldn't be able to get involved until shortly after the holidays.
Anyways, I guess the main question to answer at this point is what is / would be the scope of the project? My understanding is that the Arduino environment is a fork of the Wiring environment, modified for the Arduino hardware (more info...). So are the plans to create a new fork of either environment, or to develop the functionality that can be merged back into the source project?
Here's why I say this. From much reading, I surmise that the Arduino project isn't very interested in stuff that isn't an Arduino. This has led to a few different projects forking the Arduino code, such as with MPLAB. If we were to fork Arduino or Wiring, we would either need to maintain everything that our fork supports (including non-Propeller stuff), or strip out everything non-Propeller, and maintain that ourselves. We would lose the support of an already established project.
If we collaborate with the Wiring project, we should only need to contribute & maintain the Propeller stuff. This would give us access to a project that, for lack of a better way of saying it, knows what they're doing. I think that guidance at this stage would be a big help. The Wiring project seems intent on supporting multiple processors, and have plans to add ARM, PIC, and TI's 430?? chip, etc.
As for comparability with PropASC... I don't think it would be an issue. There's already a certain amount of work that would need to be done to account for the Propeller vs Atmel hardware differences. Stuff from the Arduino project, license permitting, could always be backported to Wiring if needed, or most likely, we could develop an analogous library. Wiring does currently support the Arduino, but not to the extent that Arduino does.
The other benefit I see for supporting Wiring is that we could develop a process to add other Propeller boards, such as the demo board, C3, etc., to Wiring.
I think that the biggest negative to Wiring is that it's not as popular as Arduino, so there's some name recognition lost there. I don't think that would matter much. We would still end up with a similar "system". And if for some reason down the road forking became necessary, that option would still be there.
Anyways, as I said, I'm still wiling to work with you, whatever your thoughts or decision. I'm planning to contact the Wiring folks for some feedback, and if it's positive, I'll go from there.
My plan was to create a set of functions / classes that followed the Wiring or Arduino syntax, but weren't necessarily compatible. Sketches would maybe run, but at minimum the setup()...loop() syntax would need to be rewritten into a proper C++ program.