Shop OBEX P1 Docs P2 Docs Learn Events
SimpleIDE is dead. Long live SimpleIDE. - Page 5 — Parallax Forums

SimpleIDE is dead. Long live SimpleIDE.

12357

Comments

  • SRLMSRLM Posts: 5,045
    Of course, David and I have this thing about code in headers... https://github.com/libpropeller/libpropeller/wiki/Inline-Code-in-Headers-Justification
  • SRLM wrote: »
    Something like mraa and upm for the Intel Edison would be a good example of a company maintained library that has community contributions.

    https://github.com/intel-iot-devkit/mraa

    Woh.... I know what I'm doing tonight.
  • SRLM wrote: »
    Of course, David and I have this thing about code in headers... https://github.com/libpropeller/libpropeller/wiki/Inline-Code-in-Headers-Justification
    I have no control or even input into the libraries that Parallax provides so I don't think that will be an issue. :-)

  • SRLMSRLM Posts: 5,045
    @David Betz: Sorry, I meant David Z. Although I'd be interested to hear your opinion on the subject.
  • SRLM wrote: »
    @David Betz: Sorry, I meant David Z. Although I'd be interested to hear your opinion on the subject.
    I'm not in favor of code in headers either. However, I can't say I've thought through the issue all that carefully. Maybe I could be convinced. :-)

  • David Betz wrote: »
    SRLM wrote: »
    @David Betz: Sorry, I meant David Z. Although I'd be interested to hear your opinion on the subject.
    I'm not in favor of code in headers either. However, I can't say I've thought through the issue all that carefully. Maybe I could be convinced. :-)

    The only work I've seen from you is helping others on the forum and PropGCC... so maybe I'm completely off-base... but you don't usually write C++ on the Propeller do you? SRLM's point is specific to C++ classes
  • David Betz wrote: »
    SRLM wrote: »
    @David Betz: Sorry, I meant David Z. Although I'd be interested to hear your opinion on the subject.
    I'm not in favor of code in headers either. However, I can't say I've thought through the issue all that carefully. Maybe I could be convinced. :-)

    The only work I've seen from you is helping others on the forum and PropGCC... so maybe I'm completely off-base... but you don't usually write C++ on the Propeller do you? SRLM's point is specific to C++ classes
    Yes, I know he's talking about C++ classes. One thing I'd like to know though is what happens if I include the same header in multiple C++ source files. Do I get a separate copy of the code from the header for each source file that includes it or is the linker smart enough to delete the duplicate instances? Also, you say that Propeller programs aren't big enough that compilation speed is an issue but if you have headers with huge numbers of functions and also if you consider that the P2 will have 512K of hub memory that may not really be true.
  • I just tested a .h file in C with SimpleIDE. It worked, and had the same memory footprint as the its precompiled library equivalent. It really seems like it could save contributors and users a lot of steps if all they have to do is put code in a .h file and put that in the same folder with the project. Are there caveats in C?
  • I just tested a .h file in C with SimpleIDE. It worked, and had the same memory footprint as the its precompiled library equivalent. It really seems like it could save contributors and users a lot of steps if all they have to do is put code in a .h file and put that in the same folder with the project. Are there caveats in C?
    I would think you'd want to teach C and C++ the way it is commonly used and putting code in headers is not the way most people write in C nor the way most employers will want their employees to write C code. Also, please verify that this scheme works with programs that contain multiple files. If it doesn't scale well to larger projects it probably isn't a good idea.

  • edited 2015-10-19 21:47
    Hmm, interesting. Job skills can be documented with additional tutorials, but scaleability could be more of a hurdle. Is it possible to incorporate PASM code with the header-only approach?
  • David Betz wrote: »
    I just tested a .h file in C with SimpleIDE. It worked, and had the same memory footprint as the its precompiled library equivalent. It really seems like it could save contributors and users a lot of steps if all they have to do is put code in a .h file and put that in the same folder with the project. Are there caveats in C?
    I would think you'd want to teach C and C++ the way it is commonly used and putting code in headers is not the way most people write in C nor the way most employers will want their employees to write C code. Also, please verify that this scheme works with programs that contain multiple files. If it doesn't scale well to larger projects it probably isn't a good idea.

    It works correctly for projects with multiple object files. The caveat is that if you have static member variables that need to be initialized at runtime (such as a variable based on CLKFREQ), it needs to be defined outside the class definition. At that point, you need to put it in a .cpp file or else it will cause problems come link time. That then ruins the point of single-compilation-unit optimization though, so I sometimes find myself using preprocessor macros in those cases. Or local static variables.
  • David BetzDavid Betz Posts: 14,516
    edited 2015-10-19 21:51
    <deleted>

  • Hmm, interesting. Job skills can be documented with additional tutorials, but scaleability could be more of a hurdle. Is it possible to incorporate PASM code with the header-only approach?

    Only inline assembly. Drivers need to be in their own object file because drivers can't be classes (though when I write drivers these days, it simply contains "#include <driver.h> void main () {Driver myDriver(); myDriver.run();}")
    I use inline assembly in my SPI header here.
  • Thanks for the example. I will try it.

    Andy
  • Andy

    Your preaching to the choir here. I'm a loyal fan of the bs2 and prop but it is what it is this arduino has really taken off. And it is definitely the micro controller of choice for the high school and community college project. Many people have jumped on the band wagon of making shields etc . for the arduino. And I don't see any supply interruptions with the chip you can buy as many as you want today(mouser about 700 digikey about 200). I tried the IDE , learn, etc. It was a mine field trying to get examples etc. Not so with the basic stamp and the prop these seemed to be streamlined to get you up and running quick with good library's etc.
    So if I ran this program I would make the IDE package quick, easy, and simple to get experiments working. And I'd give some small quantities to high schools, colleges and universities just to let them know that the prop with C is the # 1 platform you should be using.
  • edited 2015-10-19 23:00
    Thanks DigitalBob,
    DigitalBob wrote: »
    ...I tried the IDE , learn, etc. It was a mine field trying to get examples etc...

    Hmm, haven't seen anything like that before. You should just be able to click SimpleIDE's Open Project button, and look in /Learn/Examples. In case it's not immediately visible, the full path within Documents is ...SimpleIDE/Learn/Examples/.

    Andy
  • jmgjmg Posts: 15,173
    edited 2015-10-19 23:55
    David Betz wrote: »
    I would think you'd want to teach C and C++ the way it is commonly used and putting code in headers is not the way most people write in C nor the way most employers will want their employees to write C code. Also, please verify that this scheme works with programs that contain multiple files. If it doesn't scale well to larger projects it probably isn't a good idea.
    I can see merits both ways.
    .h files can be wrappers for any language library, but I can see that bending the rules a little, to allow Inline-Code-in-Headers has some merits if you expect to ship full sources in all cases.
    ....
    I use inline assembly in my SPI header here.
    I guess that works, but it does illustrate a clean-up is really needed in in-line ASM support.

    I found some in-line ASM examples on the web
    FreeBASIC Syntax :
    sub inline_assembler(v() as v2d,byval tx as single,byval ty as Single)
      Dim lv as UInteger
      lv= LAST_VECTOR
     asm
      mov eax,[v]    
      mov edi,[eax]
      fld dword ptr [ty] 
      fld dword ptr [tx] 
      mov ebx,0 
      mov ecx, [lv]
      L1:
       fld  dword ptr [edi+ebx*8] 
       fadd st(0),st(1)  
       fstp dword ptr [edi+ebx*8] 
       fld  dword ptr [edi+ebx*8+4] 
       fadd st(0),st(2)  
       fstp dword ptr [edi+ebx*8+4] 
       inc ebx 
      loopnz L1
      ffree st(1)
      ffree st(0) 
      End asm 
    end sub
    

    FreePASCAL Syntax :
    procedure TForm1.btnGoClick(Sender: TObject);
    var
      num, answer : integer;
    begin
      num := StrToInt(edtInput.Text);
      //This is required with Lazarus on x86:
      {$ASMMODE intel}
      asm
        MOV EAX, num
        ADD EAX, 110B //add binary 110
        SUB EAX, 2    //subtract decimal 2
        MOV answer, EAX
      end;
      edtOutput.Text := IntToStr(answer);
    end;
    
  • jmg wrote: »
    ....
    I use inline assembly in my SPI header here.
    I guess that works, but it does illustrate a clean-up is really needed in in-line ASM support.

    Not that I'm saying I like GCC's inline-assembly syntax... but you're talking about modifying GCC, not just some little tool written by a Parallax community member. Good luck with that lol
  • Andy,

    Great work on the Propeller C Tutorial but jumping between the Examples and Project directories is annoying. It would be nice if there was a working directory where everything is in one place except also subdivide the examples by the tutorial topic.

    I also wasn't aware the first times I used SimpleIDE that if I used Project Save As that any changes I made would be saved to my original file. I overwrote some of the Examples.
    Oh and today I discovered not to use time as a variable.
    I kept getting strange error messages about it expected a ; before the last variable in the expression.

    By the way in most circuits you use a 100 ohm resistor to protect the I/O pin but in the Sense Light circuit on Learn there is a 220.
    Is that an error?
    http://learn.parallax.com/propeller-c-simple-circuits/sense-light
  • edited 2015-10-20 01:52
    Hi Genetix,

    We'll consider that. There are going to be others who are adamant about keeping the folders and their contents separate. In the meantime, you can search ...learn/examples with your file browser. Then, select all, and either copy or move to My Projects. There's also no restriction on where your files are. Since I frequently nuke my SimpleIDE folder (usually to make sure I have original source for answering a tech support question), the My Projects folder doesn't work so well for me. So, I have a separate folder named SimpleIDE Dev where I do most of my work. It happens to in My Documents, but it could just as easily be on the Desktop, etc...

    Thanks for mentioning the auto-save when running. In other words, If you make changes to a file and run it, those changes are automatically saved before they are run. It would be nice if it behaved the same way the Propeller and BASIC Stamp Editor do, but SimpleIDE is not there yet. We probably need to add notes about that to the Learn site tutorials and What's a Multicore Microcontroller. If it's not there, we'll make the update. Some tips for the way it currently works: You can use the Save Project As button to make a copy if you want to have a changed file and keep the original. Since it auto enumerates the filename, you can even just click the Save Project As button, and then press Enter. That also makes previous versions of your project easy to get back to by clicking the Project dropdown; it'll give you a list. If you want to get back the entire original SimpleIDE folder, you can simply close SimpleIDE, rename the ...Documents/SimpleIDE folder. When you reopen SimpleIDE, it will recreate the SimpleIDE folder with the original files.

    At the beginning of the pushbutton tutorial where you actually build circuits in learn, there's an i-box that explains those small resistor values (100, 220, 240) are pretty much interchangeable for the purposes of those tutorials. The what's a Multicore Microcontroller book sticks with 220 because that's what's going to be in the kit.

    Funny, 100 ohms for the 7 segment display doesn't seem right to me though. Thanks for pointing my attention to the tutorials. You might see that one change kinda soon.

    Andy
  • jmgjmg Posts: 15,173
    Thanks for mentioning the auto-save when running. In other words, If you make changes to a file and run it, those changes are automatically saved before they are run.
    I don't see that mention, but most IDEs must save before run, otherwise the tools have only old-files to work on.
    A few PC IDEs I've used have inbuilt tools that can work on the Editor-image, but that is rare in MCU land.


    You can use the Save Project As button to make a copy if you want to have a changed file and keep the original.

    I thought the OP was saying "I overwrote some of the Examples." using save-as ?
    Maybe an example is needed
    Of course, you do need to Save-As early, otherwise the must-save-to-build will save the changes over the Example master - perhaps that is what happened here ?

  • It would be nice to see this simple IDE set up like the Bs2 or prop. You open it and your examples and libraries are on your left. Then just click on the code and it opens up on the page. I went to the learn page and you have to copy and paste it to your IDE page. Then I tried update libraries and it called for google drive in the download.
    I must say that your IDE setup looks like it is patterned after the Arduino sketch format .
  • DigitalBob wrote: »
    It would be nice to see this simple IDE set up like the Bs2 or prop. You open it and your examples and libraries are on your left. Then just click on the code and it opens up on the page. I went to the learn page and you have to copy and paste it to your IDE page. Then I tried update libraries and it called for google drive in the download.
    I must say that your IDE setup looks like it is patterned after the Arduino sketch format .

    You may be wishing for something that isn't entirely realistic. Basic doesn't have a requirement on main() right? It doesn't use a linker in the same way for grabbing multiple files and creating a single executable. C/C++ is a more complicated environment, no ifs, ands or buts about it. Simplifying it usually leads to removing features (aka, arduino IDE). If you want the simplicity of pbasic, then personally, I would encourage to to stay there.
  • Heater.Heater. Posts: 21,230
    SwimDude0614,
    Simplifying it usually leads to removing features (aka, arduino IDE)
    Excellent idea, for pedagogical purposes. As I said, I always thought that was the point of a "simple" IDE for the Propeller.

    See how popular and successful the Arduino is? Notice how they don't even document or mention the complicated parts of the language (C++) they are using?

    The Prop has complications of it's own, with it's multiple processors. Those who want a complex IDE for C/C++ already have many to choose from.



  • Heater. wrote: »
    SwimDude0614,
    Simplifying it usually leads to removing features (aka, arduino IDE)
    Excellent idea, for pedagogical purposes. As I said, I always thought that was the point of a "simple" IDE for the Propeller.

    See how popular and successful the Arduino is? Notice how they don't even document or mention the complicated parts of the language (C++) they are using?

    The Prop has complications of it's own, with it's multiple processors. Those who want a complex IDE for C/C++ already have many to choose from.

    I actually agree whole heartedly - but only if parallax also provide support for external IDEs in the form of something like PropWare's build system, or an eclipse plugin. GCC is already complicated, and adding drivers (.cog) make it even worse.
  • Heater. wrote: »
    SwimDude0614,
    Simplifying it usually leads to removing features (aka, arduino IDE)
    Excellent idea, for pedagogical purposes. As I said, I always thought that was the point of a "simple" IDE for the Propeller.

    See how popular and successful the Arduino is? Notice how they don't even document or mention the complicated parts of the language (C++) they are using?

    The Prop has complications of it's own, with it's multiple processors. Those who want a complex IDE for C/C++ already have many to choose from.


    I was surprised that the Parallax education people didn't use C++ themselves. It would have allow their C examples to look more like Spin code and make an easier transition if students wanted to try Spin in the future.

  • David BetzDavid Betz Posts: 14,516
    edited 2015-10-20 11:01
    Heater. wrote: »
    SwimDude0614,
    Simplifying it usually leads to removing features (aka, arduino IDE)
    Excellent idea, for pedagogical purposes. As I said, I always thought that was the point of a "simple" IDE for the Propeller.

    See how popular and successful the Arduino is? Notice how they don't even document or mention the complicated parts of the language (C++) they are using?

    The Prop has complications of it's own, with it's multiple processors. Those who want a complex IDE for C/C++ already have many to choose from.

    I actually agree whole heartedly - but only if parallax also provide support for external IDEs in the form of something like PropWare's build system, or an eclipse plugin. GCC is already complicated, and adding drivers (.cog) make it even worse.
    Parallax already provides a full set of command line tools including make. I'm not saying there is anything wrong with PropWare's build system but there is already a way to manage large projects that is familiar to most anyone who has done professional development in C or C++.

    Edit: Duh. Of course, PropGCC doesn't come with make. It is part of the Xcode tools that I use on the Mac and an optional install on most Linux systems. I guess we do include it in the Windows install of PropGCC though.

  • Heater.Heater. Posts: 21,230
    make is all we need.

    I hate make.

    But I hate having to learn any other build system even more.


  • Heater. wrote: »
    make is all we need.

    I hate make.

    But I hate having to learn any other build system even more.

    Yes, make is horrible. I particularly hate that tab and space mean different things. However, as you say, it gets the job done and I already know it. Well, I only know a tiny bit about it. When I want to do anything at all complicated, I have to find the manual. Hmmm.... Maybe I should take a look at cmake.

  • TorTor Posts: 2,010
    I find make easy. You just have to concentrate on a single Make, and that one is GNU Make. Forget all those others, particularly SYSV Make.

    cmake is not a Make replacement. Neither is Automake (with Autoconf), they are meant to assist with building a package on multiple platforms. Automake, in particular, auto-generates the most horribly looking Makefiles ever seen. These tools are not meant to make it easier to write Makefiles. Instead they automate setup of platform-specific builds (Makefiles and all). But this is *more* complicated than writing a simple Makefile for a single (your) platform. Just take a look at a sample..

    -Tor
Sign In or Register to comment.