Shop OBEX P1 Docs P2 Docs Learn Events
Prop 2 Languages, C/C++, Arduino IDE — Parallax Forums

Prop 2 Languages, C/C++, Arduino IDE

tryittryit Posts: 72
edited 2017-01-28 04:43 in Propeller 2
Been following the specs, but have not seen much lately on languages, specifically C/C++. I have extensive libraries in that language. I use it extensively at work. Will Parallax, Inc. support C/C++ as it does Basic and Spin? Will it be programmable with the Arduino IDE? Why not reach out at that customer base. It's been successful for the Teensy people - the 3.5 & 3.6 is arguably outshining the Arduino Due.
«1

Comments

  • cgraceycgracey Posts: 14,152
    edited 2017-01-28 06:39
    Most of our customers want C/C++ and some are involved in making it happen. I think it's going to happen, but I'm not sure on the who/when/how part.
  • The Arduino IDE is not suited to the P2 architecture.
    The compiler would have to be extensively modified to accommodate the P2 instruction set.
    Then a boot loader would have to loaded into the P2.
    I believe the Arduino loader currently runs @ 19200 baud so a fill P2 program (512K) would take >4.5 minutes to load.
    I can't see this happening.
  • ozpropdev wrote: »
    The Arduino IDE is not suited to the P2 architecture.
    The compiler would have to be extensively modified to accommodate the P2 instruction set.
    Then a boot loader would have to loaded into the P2.
    I believe the Arduino loader currently runs @ 19200 baud so a fill P2 program (512K) would take >4.5 minutes to load.
    I can't see this happening.
    The Arduino IDE just uses GCC underneath so it would be possible to wrap it around PropGCC or PropGCC2 once that exists. I don't think the baud rate of the loader is an issue either. I imagine different targets can use different baud rates. However, I'm not sure why people like the Arduino IDE so much. It doesn't offer much in the way of features. I think SimpleIDE has it beat in that regard.

  • RaymanRayman Posts: 14,641
    I'd love to have PropGCC2 inside Visual Studio...
  • RaymanRayman Posts: 14,641
    edited 2017-01-28 15:33
    Actually though, thanks to hubexec, PTRx and the ALTx instructions, I can actually see writing whole applications in assembly.

    Well, ones that don't require floating point math, that is...
  • David Betz wrote: »
    However, I'm not sure why people like the Arduino IDE so much. It doesn't offer much in the way of features. I think SimpleIDE has it beat in that regard.

    I've been wondering this too. My best guess is familiarity. And they already have the ArduinoIDE downloaded and installed (but of course, they would need to download a new version to get Prop support).

    I think providing an Arduino-compatible HAL would benefit Parallax significantly. My guess is that moving to a new IDE is not as difficult as porting code to a new HAL. Aiming for Simple Library v2.0 to be Arduino compatible would be a very good goal, rather than carrying forward the C interface from Simple Library v1.
  • Heater.Heater. Posts: 21,230
    edited 2017-01-28 16:47
    David Betz,
    However, I'm not sure why people like the Arduino IDE so much.
    Me too.
    It doesn't offer much in the way of features.
    Ah, that is why it is.

    Not many features means not many option which means a lot less confusion. Just fire it up, type and go. Ideally suited to beginners and casual programmers as the Arduino was intended.

    Which is what I thought SimpleIDE was intended to be before in became ComplexIDE :)

    My impression is that if people want a complex, feature packed IDE it's probably better to use an existing one rather than build a new one.

    I'm not the idea of supporting Visual Studio, closed source monster that it is, but I'd be all over using MicroSoft's open source and cross-platform Visual Studio Code to program the P2.
  • Heater. wrote: »
    David Betz,
    However, I'm not sure why people like the Arduino IDE so much.
    Me too.
    It doesn't offer much in the way of features.
    Ah, that is why it is.

    Not many features means not many option which means a lot less confusion. Just fire it up, type and go. Ideally suited to beginners and casual programmers as the Arduino was intended.

    Which is what I thought SimpleIDE was intended to be before in became ComplexIDE :)

    My impression is that if people want a complex, feature packed IDE it's probably better to use an existing one rather than build a new one.

    I'm not the idea of supporting Visual Studio, closed source monster that it is, but I'd be all over using MicroSoft's open source and cross-platform Visual Studio Code to program the P2.

    Have you written any C/C++ in VSCode? Does it give you type-based/context-sensitive auto-completion for C/C++ programs? It is certainly possible I didn't have the write plugins or was just using too old of a version, but from what I remember from trying it after it was first released, it was only capable of providing the most basic string-based auto-completion... which was a real bummer.
  • RaymanRayman Posts: 14,641
    edited 2017-01-28 18:22
    Visual Studio Code for PASM2 looks pretty good. Seairth's work made that look pretty easy to implement.

    I'm still using the Prop Tool for PASM2 though.
    Think I've grown used to the background shading.
    Also, my test codes have become pretty big and the "Summary" view makes navigation easy.
    This last thing is the reason I can't imagine switching to anything else...
    I add in extra "DAT" lines with comments all throughout my codes so I can find my way with the Summary view...

    Re: PropGCC2, I remember now that PropGCC is easy to work with in Visual Studio without any extensions. That should be the case for PropGCC2 as well.
    So, I'll probably use that.
    One thing I don't see in Visual Studio Code is a the dropdowns that let you quickly navigate a big file to the function or class you want to look at.
    When you have a big file, that helps a lot...

  • Yes, a function/class selector would be very nice but I don't think VSCode can do it. It also doesn't have the ability to print either. I still use it but have had to conjure up a workaround for the selector deficiency and just keep multiple tabs open for each include file.
    #include "simpletools.h"
    #include "simpletext.h"
    #include "fdserial.h"
    #include "propeller.h"
    #include "mcp3208_separate_din_dout.h"
    #include "pgccefi.h"
    #include "pgccefi_main.c"
    #include "pgccefi_ign_inj.c"
    #include "pgccefi_decoder.c"
    #include "pgccefi_wheel_sim.c"
    #include "pgccefi_pd_ptr.c"
    #include "pgccefi_readadc.c"
    #include "pgccefi_cnt64gen.c"
    #include "pgccefi_calc.c"
    
  • Heater.Heater. Posts: 21,230
    DavidZemon,
    Have you written any C/C++ in VSCode?
    Not more than a few hundred lines.
    Does it give you type-based/context-sensitive auto-completion for C/C++ programs?
    It did not. But the I have not installed any plugins that might do that. I don't miss such things much.

    However it looks like MS is on the case: https://code.visualstudio.com/docs/languages/cpp

  • Heater.Heater. Posts: 21,230
    pmrobert,
    It also doesn't have the ability to print either.
    Perhaps because nobody prints out source code anymore. It must be to decades since I have felt the need to do so. The printer in our office gets precious little use.
  • potatoheadpotatohead Posts: 10,261
    edited 2017-01-28 21:03
    >Not many features means not many option which means

    I agree with this. There is just get it done, get it done better, get it done really well, etc...

    The "just get it done" really benefits from a "low friction" path to getting there.

    Once people see success, they become invested, max out on those options and seek more and better. Today, a whole lot is done "in motion" just learn while doing. In depth understanding comes, when or if it's needed.

    That R&D project I've been working on for a while has played out this way. I applied P1 and the basic Prop Tool. We have enough objects to "just get it done" and that is exactly what happened.

    I've got the stuff in motion, doing things. Could be done a lot better, but it's happening right now. Two parts to that project, one is basic tech needed to explore the more important one, which is the dynamics and physics related to the purpose of the tech. Can't share that right now. Wish I could. A lot of you would like it. :D

    "just getting it done" took me and the team right to the physics. We've got some pros involved, building very complicated, technical things. They are in the "get it done well" camp, but the interesting bit happened to be the big stall:

    All that stuff doesn't get to the physics and dynamics very quickly, and those things impact what is needed. There is a cycle in play here, and turning the crank on it is most important. Until I just jumped in, the thing was stalled big with no real assurances the path was a good one with a viable end game. Functional prototype.

    The other interesting thing was me simply not knowing much or better. I just worked as if it must be possible, did that quickly and it turned out it is! I didn't spend a lot of time asking. Just did it. Let the smoke out once or twice. Didn't pay attention to basic theory related to inductive loads. Oh well. And there are issues. I know what those are now, and have moved a step or two down that road. Factored out a whole design path on the way.

    So, the team working on my "just get it done with the hobby chip" test bed knows a ton now! It's impacted that "pro" design and tools a few times, and those things have never actually driven the tech either. Always changes, plans, changes for plans, etc... I did the enabling thing, let them do the harder science. And there is a whole lot to be said for just watching the world interact with what you've got, the rules become clear, as do many of the dynamics. One can feel their way to good places, and the math and detail can come in parallel, or afterword when it's easier to understand.

    I'm not poo-pooing all that higher complexity and knowledge stuff. It's totally valid, necessary. But, I am validating keeping it simple, lean, potent. We've got that in the P1 and the basic PropTool. And I took what I've learned from people here and applied it too.

    Works! None of the project is in my core competency / comfort zone. Didn't matter. Did the minimum, then observed, then hit the books! It made finding and consuming / understanding the basic theory related to the project much easier. I could study, come to some ideas, walk right over, test, measure, and validate or not. Either was fine, as that's knowledge.

    The "Chip Gracey" way, seen in a lot of this stuff, has it's merits! Ordinary people, or people who just lack experience, can make great contributions, do real stuff. They don't have to know as much as they would like to either. But they can very quickly come to know what they need to.

    Given my positive experiences, the idea of a lean system, where people don't have to know so much to make it happen, has very serious merit. It can always get serious, or pro. But, it may not happen at all too! That's my experience so far.

    However we go forward, and I'm thinking new / better tools, I am saying it's worth it to maintain a "lean" type option. The reason is constants:

    At any given time there are very experienced people needing advanced tools, flexibility, options, and all that comes with said experience. At any given time there are hobby / casual / tinkerer users too.

    Serving both is not a contradiction. It's a benefit. But, it's hard to see and talk about.

    "Parallax is a hobby company" totally got said. "What can you really do with 32K / 80Mhz, interpreted SPIN?" Turns out you can just make it work, that's what. :D Count me as a fan on a new level above and beyond what I may have said earlier. They asked for debug, gave 'em SimpleSerial and a basic way to evaluate / tweak. They wanted more, so I dropped in a real time display with some old junker screen we had laying around. They wanted to move beyond direct signaling with pins, I dropped in SPI / I2C. Still have adequate RAM, have great performance, no glitches as those things were added. Half the time, I took their code written on my test bed, merged in the stuff they wanted while they were watching and then walked away after, "need anything else?"

    But guess what also happened? We are into the science, and getting that early matters. The overall design is gonna be impacted, and we know that now, not next year.

    They don't say that stuff much now, and are asking, "So, when is this P2 chip gonna happen?"

    When indeed. But, what we've got is no junk. Not at all.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2017-01-28 21:04
    Heater. wrote: »
    DavidZemon,
    Have you written any C/C++ in VSCode?
    Not more than a few hundred lines.
    Does it give you type-based/context-sensitive auto-completion for C/C++ programs?
    It did not. But the I have not installed any plugins that might do that. I don't miss such things much.

    However it looks like MS is on the case: https://code.visualstudio.com/docs/languages/cpp

    Very promising :) I'm not about to switch away from CLion, but VSCode sure is looking good! Combined with this extension, it should make a nice pairing for PropWare.
  • potatoheadpotatohead Posts: 10,261
    edited 2017-01-28 21:07
    Put another way, there are two ways to look at this:

    One way is a move. Time to pull everyone up a level, and abandon the basics as a sort of legacy. This way, ignores the constants I put in my post above. Perfectly good code, people, libraries, objects, get left behind. It's a waste really.

    The other way is more like a merge, or incorporation. Make pro stuff available, merge capability where possible, but the easy path is always there. Anyone needing more or pro can get it. And there isn't waste like we often say there is. "how will we convert all those objects?" or "When new ones are written, how can we make sure they work everywhere?"

    I say don't worry so much about that. The people who need stuff will do the work, or write what is needed. We get more and better code, not necessarily in that order, but who cares?

    Seems to me, we get stuck on this distinction. We shouldn't. There are always newbies and they will always benefit from basic, lean, capable stuff too.

  • Re: Apps in assembly

    My experiences are good so far. PASM got a bit more verbose and complex, but the basics are solid. It's not hard to write bigger chunks of code. Definite win here.

    Whatever we end up doing with SPIN, that thing should include direct, in line PASM. It's gonna rock. :D We will have the modern, speedy, potent system that looks very similar to what the Apple and Acorn guys did long ago. Sure, that's not on the beaten path, but we will have that stuff too. No worries.

    Plenty of people will benefit from that "not beaten path" option, and it's important we don't leave that out of the equation.

  • Heater. wrote: »
    pmrobert,
    It also doesn't have the ability to print either.
    Perhaps because nobody prints out source code anymore. It must be to decades since I have felt the need to do so. The printer in our office gets precious little use.
    Understood, makes sense. It's no issue at all for me, copy and paste to something that can print works just fine. Sometimes I like to print a function or two that may be misbehaving in some odd way, wait a couple of hours, sit poolside with the 'ole papyrus and sometimes the issue or solution becomes visible.

    Mike R...

  • Heater.Heater. Posts: 21,230
    I used to be into printing out code back in the days of wide fan-folder line printer paper. You, know, the stuff with the green stripes on it and sprocket holes down each edge. One could print out a few feet of ones program, unfold it, stand back and admire the beauty (or otherwise) of ones creation. It was great to get an overall view.

    Since we don't have that anymore, only little A4/letter size scraps of paper it's hardly any advantage to print out code. You still can't get that birds-eye view.

    Although some years back I had to reimplement a large x86 assembler program in C. That is assembler with few comments and all labels in Swedish! Ended up printing out large junks of it, taping the sheets together into a long strip. Then I could get that overall view. I could start drawing lines on that strip linking all the JMPs and CALLs to their target labels, which often spanned many pages. It was the only way I could fathom how the control flow was going on in there.

    It's amazing the lengths people go to to get that over all view of their code. For example I found Chip has two 4K monitors, standing up in portrait mode side by side, and uses a tiny font so that he can get a good view of his P2 VHDL source.

    Most of the time I feel like I'm squinting at my code through a key hole.
  • I will sometimes print in columns, small font 4pt or something, then just use reader type glasses. This works better than I expected. I still archive some things to paper. Just works, not hard to manage. I print it small, in similar fashion, usually 6 to 8 pages to one. It's readable in a pinch.

    Another thing I picked up recently works well too. It's a USB second display. Basically an LCD with some processor built in. Runs on USB 2 and up. USB 3 is fast enough for dynamic tasks. USB 2 is enough for office / text work. It will run on USB 1, but it's kind of text only at that point, and one has to hack the driver.

    Anyway, stand it up in portrait mode, and it's a nice text / code display, similar to what Chip is doing with the 4K screens. When I use a smaller, non-proportional font, I get a lot of lines. Enough. Sure beats the wide format display we are pretty much stuck with otherwise.

    Once drivers are setup, I can just plug one or two of those things in and go. Best part is they go in my backpack. Those, plus a nice laptop really don't weigh much, and I can setup three screens in a pinch, anywhere.

    https://www.asus.com/us/Monitors/MB169BPlus/

    I get the non-touch ones, they are cheap and fast. (well as fast as a serial stream to display is)

  • Heater. wrote: »
    It's amazing the lengths people go to to get that over all view of their code. For example I found Chip has two 4K monitors, standing up in portrait mode side by side, and uses a tiny font so that he can get a good view of his P2 VHDL source.

    Most of the time I feel like I'm squinting at my code through a key hole.

    I too see the value of an overall view of code files, in the early days I did the same "print for review", but now with IDE's (Arduino) and fast scroll, that became less of a necessity.

    Recently, due to working on larger projects (and code complexities) I have starting exploring the "PlatformIO IDE", which has a very nice "small font" scroll bar on the right side of all code files. So now, I have the "quick" overview of the project file as a standard item on the screen. I like it !

    BTW: PlatformIO seems to have a lot more to offer than most other IDE's that I have used: File Manager, Atom Editor, git Integration, and much-MUCH more.

    Note: I am not associated with PlatformIO, I am just a new and excited user.

    Eldonb
  • RaymanRayman Posts: 14,641
    It's funny, I was a little shocked at first to hear you can't print from VS Code.
    But then, realized that it's probably been 10 years since I ever printed out any code...
  • kwinnkwinn Posts: 8,697
    I really don’t think there is any way to get a good overview of any sizeable program or technical document by printing it, using a large screen, or multiple screens to display it. So far the best methods I have used have been in HTML based documents where moving back and forth is much faster and simpler. What I would like to see is an updated two pane view of the program using some of the ideas in the Propeller Tool.
    The left pane would have a “code view” pane in addition to the current “file view” that would allow you to view a list of the various blocks ( CON, VAR, OBJ, PUB, PRI, DAT ) that make up the program. Selecting one of them would result in a drop down list of those types of blocks similar to what the “Summary” function does in the Propeller Tool and allows you to select an individual block for viewing in the right pane.
  • cgraceycgracey Posts: 14,152
    kwinn wrote: »
    I really don’t think there is any way to get a good overview of any sizeable program or technical document by printing it, using a large screen, or multiple screens to display it. So far the best methods I have used have been in HTML based documents where moving back and forth is much faster and simpler. What I would like to see is an updated two pane view of the program using some of the ideas in the Propeller Tool.
    The left pane would have a “code view” pane in addition to the current “file view” that would allow you to view a list of the various blocks ( CON, VAR, OBJ, PUB, PRI, DAT ) that make up the program. Selecting one of them would result in a drop down list of those types of blocks similar to what the “Summary” function does in the Propeller Tool and allows you to select an individual block for viewing in the right pane.

    Neat idea! I've been thinking a lot about how, with these bigger-resolution screens, real estate can be used for all kinds of alternate-view perspectives on the same code, both static and running. I was hoping another cheap WalMart 4k TV would arrive today, as I'm ready to hook it up, to join my two current 4k TV monitors. My desktop will be 6480x3840 then, which is equivalent to 12 HDTV's. It's really neat. The more views you could get of your code, the better you can know it and the less has to be mentally spooled in your mind.
  • Heater.Heater. Posts: 21,230
    Wow, PlatformIO IDE looks really nice. It's based on the Atom editor which I love and have used a lot. Odd that I never heard of PlatformIO.

    Now who is up for adding Propeller support to PlatformIO?

    I seem to recall that Sublime also has such a "small font" scroll bar.
  • kwinnkwinn Posts: 8,697
    cgracey wrote: »
    kwinn wrote: »
    I really don’t think there is any way to get a good overview of any sizeable program or technical document by printing it, using a large screen, or multiple screens to display it. So far the best methods I have used have been in HTML based documents where moving back and forth is much faster and simpler. What I would like to see is an updated two pane view of the program using some of the ideas in the Propeller Tool.
    The left pane would have a “code view” pane in addition to the current “file view” that would allow you to view a list of the various blocks ( CON, VAR, OBJ, PUB, PRI, DAT ) that make up the program. Selecting one of them would result in a drop down list of those types of blocks similar to what the “Summary” function does in the Propeller Tool and allows you to select an individual block for viewing in the right pane.

    Neat idea! I've been thinking a lot about how, with these bigger-resolution screens, real estate can be used for all kinds of alternate-view perspectives on the same code, both static and running. I was hoping another cheap WalMart 4k TV would arrive today, as I'm ready to hook it up, to join my two current 4k TV monitors. My desktop will be 6480x3840 then, which is equivalent to 12 HDTV's. It's really neat. The more views you could get of your code, the better you can know it and the less has to be mentally spooled in your mind.

    Must admit I am a little envious of your setup. It must be great for what you are doing. There are times I wish I could do something similar but I do not have the space. I tried using a 42" HD TV at one point but it took up too much space without adding much in the way of flexibility. To be honest, for the amount of coding I do it was not really needed. Between a cheap 19" flat screen TV and my laptop I can do what I need to accomplish.
  • Chip,
    I have three 28 inch 4K monitors on my setup at home. One rotated into portrait mode on the side, and the other two centered and stacked one above the other. I got a big multi-monitor arm/stand thing to hold them all, so I can swing them around and put them at comfortable angles for working.

    I often have multiple windows of code open across them all so that I can just glance up or to the side to see another source file that the main one I am working on calls/uses. Really helps with the flow. Much less stopping to jump to another file and back in the same window. Even switching tabs can be an interruption.

    As for languages on the P2, It's going to be much easier to get many different languages up and running on the P2. The bootstrap setup and hubexec pave the way for just about anything.
  • RaymanRayman Posts: 14,641
    I just remembered how NVidia now lets you extend your game screen onto side monitors...
    This is perfect! I can say it's for looking at code...
  • tryittryit Posts: 72
    edited 2017-02-25 04:43
    Would it be correct to say that future prop2 customers will prefer to program in C/C++ rather than Spin?

    My guess is yes. C/C++ is huge in the microcontroller community, the tech industry, the scientific community, etc. So it makes sense to be proficient in this language.

    Additionally, if GCC is in fact implemented for the prop2, then one can use the Eigen library to perform matrix operations as with Matlab and Octave and program Kalman filters as with this:

    -https://youtube.com/watch?v=Xmt67HTI2Hg
  • It's likely correct to say both. We've a body of existing users who will jump on SPIN. Over time, and perhaps fairly early on, the C user base should grow nicely. This chip will have a lot to offer, IMHO.

    Good times ahead for all.
  • Heater.Heater. Posts: 21,230
    Wow, that "Falling Up" robot has to be the biggest, clumsiest, inverted pendulum bot ever.

    Works very well though.

    One does not need a kalman filter to do that. Although I'm sure it helps.

    One does not need Eigen to do a few matrix multiplications.

    But, yes, give me C on the P2.
Sign In or Register to comment.