Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: Best C compiler/IDE for Windows 10

  1. #1
    Member emseedee's Avatar
    Join Date
    Jan 2019
    Location
    Coventry, UK
    Posts
    22

    Best C compiler/IDE for Windows 10

    Hi, all,

    Done a few projects using an LC, with the code written with and compiled through Arduino/Teensyduino, but I now fancy moving up a gear and using C directly. The Teensy web site (which is obviously way out of date as it only mentions Win 7 & 8) still refers to WINAVR, but the comments on the WINAVR sourceforge page warn about WINAVR overwriting the PATH variable and advise not to use it. WINAVR also seems to be rather out of date, with no recent meaningful updates.

    So at the end of 2020, what's the team's recommendation for a C compiler / IDE / whatever for a Teensy on Windows 10. I've seen comments on here about visual teensy - is that the best path?

    Or should I do it on Linux? - I have a current version of ubuntu available to me.

    Thanks in advance

    Mike
    Last edited by emseedee; 12-13-2020 at 03:35 PM. Reason: Add linux option

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,520
    Best is always in the eye of the beholder...

    WinAVR is only valid for AVR based boards like the Teensy 2...

    Again no idea of what it is you are wanting to do... That is do you wish to do bare metal and do everything from scratch? Or do you simply want to do some stuff in C versus C++?

    Again there are many many options.

    a) Arduino IDE - is simply a wrapper on GCC compiler. It will and does build C files. For example look in the Teensy Core directories and you will find some files with the .cpp extension, which are compiled with the C PLUS PLUS compiler.... Others have the .c extension and are compiled by the c compiler. So for example your sketch folder can have files with a .c extension and they compile ...

    b) Makefiles - Again use any Editor you wish to use to generate your project and use/modify the makefile example that comes with Teensyduino.

    c) Visual Studio, with some plug in like Visual Micro.

    d) I often use Sublime Text with stuff that then calls off to Arduino build

    e) Platform IO

    ...

    But again this all boils down to what your goals are, and potentially what if any IDE you like.

    Sorry I know that is not much help

  3. #3
    Member emseedee's Avatar
    Join Date
    Jan 2019
    Location
    Coventry, UK
    Posts
    22
    Thanks for the quick reply.

    I think that what I want to do it write faster, smaller code and at the same time learn new stuff. I've heard that Arduino IDE tends to generate rather fat, bloaty code. Perhaps I'm wrong - educate me.

    From a project perspective, I'm planning to use either an LC or a 3.2 to create an interface between some organ stop actuation magnets and a MIDI input. Timing is quite important, although nothing happens really fast. I do have some code from another organ hobbyist, but that's been written in C and needs changing, hence the interest in a suitable IDE. I'm happy to code in C or C++ and learn as I go.

    In the Windows environment, my "go-to editor" is Notepad++, although that doesn't seem to link out to a compiler / builder, so it's probably a non-starter. Hence I'm looking for recommendations.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,380
    Quote Originally Posted by emseedee View Post
    I've heard that Arduino IDE tends to generate rather fat, bloaty code. Perhaps I'm wrong - educate me.
    That's not necessarily true. The Arduino IDE is uses the same gcc toolchain as every other free software package. Some expensive commercial software like IAR & Keil have their own compilers, so they actually do generate different output for the same C / C++ source code, but they're not really very different from gcc.

    What matters is how you actually write your code. For libraries you use, how the library author(s) wrote the library matters. But there too, nearly all the different tools use the exact same set of libraries. When you call Serial1.write(buffer, size), you're using the exact same hardware serial library built with the same same gcc compiler, regardless of which programming environment.

    Of course the editor experience is vastly different. Perhaps different editing software helps you to write different code. I know it does for me. That's why I almost always use "external editor" in Arduino's File > Preferences, and then edit the code using vim.

    Arduino does have a reputation for slow & bloated code. Part of that isn't really fair... the Java-based IDE can "feel" quite bloated on slower computers, because the Java runtime consumes a lot of memory. The Java GUI definitely is bloated. But ultimately it just saves your code to text files and runs the same gcc compiler used by pretty much all the other environments.

    Part of Arduino's slowness reputation comes from the library code. The good news is Teensy (generally speaking) has much more efficient libraries. A lot of work has gone into optimization. But even there, choices matter. For example, we have both digitalWrite() and digitalWriteFast(), where the fast version skips certain legacy compatibility stuff and takes advantage of const inputs to generate very efficient code. Likewise, for WS2812B LEDs, you can use Adafruit_NeoPixel or WS2812Serial or OctoWS2811. Adafruit's library is blocking and disables interrupts while it bigbangs, but it only uses 3 bytes per LED. The others are non-blocking and use double buffering, so you get much better performance (assuming you structure your code to actually do something useful while the LED data transmits), but it does come with a cost of higher memory use for the double buffering. Likewise, digitalWriteFast() will inline code, which usually works out to be similar but can result in more code space used compared to calling a function. These sorts of design trade-offs are common, where faster code often comes with a cost of extra memory or other resources used. Which way you consider to be bloated can really depend on your perspective.

    The main point is all these systems use the same gcc compiler and they generally use the exact same set of libraries. So what really matters for performance is the code you write, and which libraries you choose, and how you make use of them.

  5. #5
    Member emseedee's Avatar
    Join Date
    Jan 2019
    Location
    Coventry, UK
    Posts
    22
    Thanks very much for such an informative reply. Perhaps I will stick with Arduino then, but with NP++ as the editor (didn't know I could do that).

    Living and learning.

    Mike

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,008
    Indeed Arduino IDE is a great start for a common interface, having it be a common denominator for TeensyDuino and the Forum allows everyone to communicate and function with the result expected to be the same.

    The IDE itself is functional - but as KurtE noted : "Best is always in the eye of the beholder...". Arduino is 'Best' at being easy one step install (two with TeensyDuino) and having that common environment - After that, BEST is subjective ... there are dozens of IDE and editors.

    As noted though - that is just the USER interface to a common and well developed C and C++ compile and link system. TeensyDuino installs one tested and configured to work with Teensy 32 bit ARM processors. It isn't the bleeding edge latest version - but getting a stable one to give reliable and consistent results is a moving target not to be taken lightly. But the code generated is good and efficient for the ARM devices in use. Newer versions may bring some better optimization, as well as unexpected behavior (bugs)

    As far as Notepad++ - Have used that in the past - though now using the SublimeText after trying/buying it because it supported what I was used to - especially full 'folder/file' text search.

    For SublimeText on Windows - given a start by FrankB TSET has been created and evolved to execute the Arduino Build on Command Line from within the SublimeText environment.

    A quick look at notepad-plus-plus.org/resources/ showed : github.com/notepad-plus-plus/nppPluginList

    Found this NP++ plugin that might facilitate similar TSET build from within NP++ :: NppExec (plugin for Notepad++)

    So that might be a good way to get to use NP++, NEVER open the Arduino IDE after installed, but do compatible builds using 'your editor of choice'.

    Back what Arduino IDE is BEST at ::
    1: > Install IDE
    2: > Install TeensyDuino
    > JOB DONE build and program the same way all Forum users do for sharing sketches and libraries!
    -- > Any problems or issues can/will be resolved/addressed by PJRC or the FORUM because this is the supported platform

    As for NP++:the above involves this to get 'toward' a working environment (basically what SublimeText or any other alternate IDE requires in place of NP++):
    1: > Install IDE
    2: > Install TeensyDuino
    3: > Install NP++ { VSCode, VisualStudio, Platform IO, SublimeText, ... }
    4: > Setup Tset
    5: > Setup TyCommander ( optional for best results )
    6: > Install the NppExec { if it works as suggested to run TSET }
    -- > Configure NppExec plugin to execute the TSET Batch/CMD files to prepare the Compile.CMD and then Run it
    > JOB WELL UNDERWAY - with tweaks as needed to get desired results equivalent to Arduino IDE build.
    -- > crafting a custom system in multiple steps that is unique to that machine - that may require custom crafted work to function
    Last edited by defragster; 12-13-2020 at 09:06 PM.

  7. #7
    Member emseedee's Avatar
    Join Date
    Jan 2019
    Location
    Coventry, UK
    Posts
    22
    Wow - I didn't realise that there was so much work done into linking Arduino to external editors. Thanks for a very full explanation of these options. Also thanks for confirming that the code generated by the Arduino IDE is actually reasonably compact & fast.

    I think for the moment I'm going to stick with NP++ and then go back into Arduino to compile & link, even though the Arduino processes are a bit slow. Perhaps in the future i'll try SublimeText and TSET, but for the moment the priority is to get the current project coded.

    Thanks again

    Mike

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,008
    If the p#6 indicated NppExec works as suggested - simply adding that extension should give an easy way to do the same as is done in SublimeText, so change wouldn't be needed.

    Though SublimeText is Ultra powerful for perhaps too much - just using simple parts here beyond the Build Exec and Global folder search. But it is a nice coloring editor with good 'simple' parts for editing way better than Arduino.

    SubLime does offer 'F4' that parses the build console output and jumps to the Source file with big red balloon with text of the error in context. KurtE has found it doesn't always go to SOURCE file itself, but will leave him editing the TEMP files in the build folder - but that is on library or other none open file as seen here.

    The setup would mirror that - in some fashion - where NppExec Runs TSET to put a Compile.CMD { based on user input to batch file in CMD window to Teensy/Speed/etc} in the sketchbook folder - then the NppExec would just execute Compile.CMD ( can also be Double Clicked in File Explorer ). The setup and params passed are called out in the ReadMe or the linked Forum post - the added params just allow Verify or Clean build versus the default build/Rebuild.

    It has been years but when using Npp at least once I found a really cool extension that easily solved a parsing or other task I had at hand.

  9. #9
    Member emseedee's Avatar
    Join Date
    Jan 2019
    Location
    Coventry, UK
    Posts
    22
    Thanks for your help. I'll have a play with the NP++ / Arduino integration when I get a moment free.

  10. #10
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,008
    Installed Npp here and then PlugIn menu item Plugin Admin found NppExec.

    Open menu \ plugins \ Nppexec and "check follow $(current_directory) so that command executes from the source file folder.

    Set up TSET including edits needed as noted in readme to localize paths to current computer.

    Then as noted in Use-Sublime-Text-as-an-Arduino-IDE-replacement emulate the commands shown for SublimeText.
    Execution looks to be much simpler, but not gone as far as seeing about adding them to Menu items or shortcut keys:
    Code:
    {
    	"shell_cmd": ".\\Compile.cmd 1",
        "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
        "working_dir": "${file_path}",
        "selector": "source.c, source.c++",
    	 "variants":
        [
         {
          "name": "Clean",
          "shell_cmd": ".\\Compile.cmd 2",
         },
         {
          "name": "New Sketch",
          "shell_cmd": "start T:\\Programs\\TSet\\open_new.cmd",
         },
         {
          "name": "Verify",
          "shell_cmd": ".\\Compile.cmd 0",
         },
         {
          "name": "Tools Set",
          "shell_cmd": "start T:\\Programs\\TSet\\TSet.cmd",
         }
       ]
    }
    Run this:: in the case here to the path where TSET.cmd was copied from github.com/Defragster/Tset:
    Code:
    npp_run T:\\Programs\\TSet\\TSet.cmd"
    This creates "Compile.cmd" in that current directory!

    Executing this:: worked to build and upload using above Compile.cmd in the sketch INO directory:
    Code:
    Compile.cmd 1
    Should be the same for "0" and "2" above "Verify" and "Clean"

    As noted in github ReadMe it should upload with TeensyLoader or TyCommander as installed.

    Below starts the NEW sketch batch file

    When prefixed with npp_run it will open a CMD window to run the batch file rather than executing in place. For building it is better as above but perhaps better to do like this for Compile.cmd (as above)and NEW as follows:
    Code:
    npp_run "T:\Programs\TSet\open_new.cmd"
    The CONSOLE window can be PULLED out to a stand alone window - COOL with multimon so it can be bigger without taking space from code window!

    It seems to suggest is can find and GOTO NEXT or PREVIOUS error - though I don't see it working - even with edits to the console filter? Calling this good enough to show it is worth looking at if desired.

  11. #11
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,008
    Updated Sublime text to v.4 and TSET to create Compile.CMD with specfied sketch.ino name:
    Code:
    {
    	"shell_cmd": ".\\Compile.cmd 1",
        "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
        "working_dir": "${file_path}",
        "selector": "source.c, source.c++",
    
    	 "variants":
        [
         {
          "name": "Clean",
          "shell_cmd": ".\\Compile.cmd 2",
         },
         {
          "name": "New Sketch",
          "shell_cmd": "start T:\\Programs\\TSet\\open_new.cmd",
         },
         {
          "name": "Verify",
          "shell_cmd": ".\\Compile.cmd 0",
         },
         {
          "name": "Tools Set",
          "shell_cmd": "start T:\\Programs\\TSet\\TSet.cmd $file_name",
         }
       ]
    }
    (roughly) Equivalent NPPexec commands here : YMMV : Haven't 'stored' them or attached them to hotkeys::
    Code:
    npp_run compile.cmd
    
    npp_run compile.cmd 2
    
    npp_run  T:\\Programs\\TSet\\open_new.cmd  
    
    npp_run compile.cmd 0
    
    npp_run T:\\Programs\\TSet\\TSet.cmd $(FILE_NAME)
    In Sublime the same TEMP folder is used - not sure if NPP always does a full build?
    When I do the NEW - it opens the resulting new.INO in sublime, perhaps from associating INO to Sublime.

    NPP on github : github.com/d0vgan/nppexec
    TSET on github : github.com/Defragster/Tset
    Did the :: Open menu \ plugins \ Nppexec and "check follow $(current_directory) so that command executes from the source file folder.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •