Friday, August 27, 2010

Best C editor for AVR, PIC, RENESAS, etc... ???

I've been spending a lot of time searching for the best C editor for MCU's.
There are a lot around the internet, many of them have many important features, but no one is still perfect for MCU's, because they are made for Windows' C so they provide class handling, inheritance, and so on...
"Must have" features for an editor should be:
  • Syntax highlight
  • Code folding
  • Self completion (like MS Intellisense)
  • Show Hints when mouse hovers a variable/function
  • Functions List (argh! this is a point I have to discuss!)
  • Functional Find in Files
  • Parenthesis matching
  • Hyperlink in comments (this is a point I have a great idea, later on this post)
  • Light size & portable
  • Free of charge. Possibly.

I tried: SlickEdit2010, PsPad, Programmer's notepad, Code::Blocks, Eclipse (wonderful AVR plugin but Java: as slow as death), UeStudio, Unired, Netbeans, HippoEdit, JFE and Codelite.

Everyone has many of the above features but none has them all. Slickedit is probably the best but it lacks of the last two features (a crappy illegal portable version exists but you won't be able to run any batch to compile using WinAvr).
Jfe is the lightest and portable one: you can find in workspace files even if files are not yet saved, but it remains a little steps behind (no code folding or hints on variables, just a sort of help when typing functions).

Ehm, one question: WHY DO FUNCTIONS LIST HAVE TO BE ORDERED ALPHABETICALLY???
I like only editors who show functions the same order I have typed them! When coding for a MCU you probably have one single file which contains all. No prototyping, just a list of methods.
I need an overview of the functions I wrote, not the alphabetical list of them. The upper part of my code is initializations, the middle part are interrupts, followed by low level functions then more high level ones who call the preceeding ones.
If you sort it alphabetically I lose control of who is calling who.

Ok, at the end of the day I decided that Codelite (without Windows' facilites, no wxWidgets and so on) is my choice. It is also opensource so I could make changes to SymbolView.dll to show functions not sorted alphabetically.
For version 2.6 (and not following).
You can install it (but copying the folder to another pc will make it portable), then go to C:\Program Files\Codelite\Plugins and replace the SymbolView.dll using the one you can find zipped here.
Then, after opening the program, go to Plugins menu -> Manage Plugins... and check the SymbolView plugin.
It is shown as a tab in the workspace pane, right click on that tab and choose "Detach".
Now finally you have functions list (and only functions, no macros, variables, etc...) ordered by line number...


It still lacks of hyperlink in comments. If a part of my code is a result of an Excel Sheet computation I would like to write:
// Details on computations: file://algorithm.xls
So when i hover the mouse on it, and click, the file opens.

Some of the above editors have this feature, but Codelite hasn't. Let's hope in future.

MY IDEA

This is my idea (who knows, someone in future will implement it): instead of placing just an hyperlink why can't I link the file directly?
Let me explain: I write some code with a clock and signal.
This is what I want to see on screen just for better documentation of what I'm doing:


And this is what is stored in real file (thus not interfering with compilation) opened with notepad:

WHY NO ONE EVER THOUGHT ABOUT IT? I'M SICK OF DOCUMENTING SIGNALS IN MY FILES WITH SLASH, BACKSLASH, UNDERSCORE & PIPE /_|\ !!!


Parallax has delightful fonts for Propeller MCU (must install Propeller Tool) which has many symbols, but it forces to save the file in unicode format... I like ANSI.

Damn. One of these days I'm going to do that myself...

2 comments:

Diecore said...

Hi
Could you tell me which IDEs can i use with jtag debugging capabilities except eclipse?
What platform do you use? arduino, atmega,xmega?

Valerio said...

Hi,
well for STM32 I use both Iar Ide and Keil uVision with Jlink 7.
For Atmel, AvrStudio has Jtag debug support but I never used it.
Atmega and AtTiny are my favourite (and also Pic16) and for all of them I have never needed any hardware debug support since I came into this:

http://www.scienceprog.com/unprofessional-review-of-avr-simulators/

And keep using Codelite 2.6.
Bye