views:

738

answers:

20

I'm curious to see how popular the alternatives to C are in the embedded developer world e.g. Ada...

I've only ever used C (with a little bit of assembler), but then my targets have very limited resources. Is there a move else where in this space to something else? What is winning the ware in set top boxes?

If !C what was the underlying reason?

  • Compiler support for target
  • Trace \ static analysis tools
  • other...

Thanks.

+1  A: 

I haven't used myself, but Bascom is quite popular for AVR microcontrollers. It is a Basic IDE that lets you interact with the peripherals very easily. I've met hardware people that successfully use it.

kgiannakakis
+1  A: 

Yes. Java is becoming more popular - many processors have added instructions that pertain primarily to Java and similar languages (.net). Also, uclinux runs on microcontrollers, so you can use practically any language for some of the larger micros.

Basic is still common, as is assembly.

You'll see Ada in certain gov't projects.

And some engineers are even putting Lua and other interpreters on their micros so their customers can extend the functionality.

But C is still dominant.

Adam Davis
LOL at the downvote - if you think this is wrong, please comment, I'd love to find out what I said incorrectly so I can fix it or defend it!
Adam Davis
@Adam- gave you an upvote... gotta speak up for my RT/embedded Java brethren... JA
andersoj
+4  A: 

Forth is quite popular for embedded development.

Also, while Smalltalk is probably not popular in the embedded community, embedded development is definitely popular in the Smalltalk community.

Jörg W Mittag
A: 

This PDF talks about Scheme on a PIC processor, but it's unclear where to find the sources to set it up yourself.

Jeff Allen
I've used a Scheme-like derivative to good effect on an embedded arch with 32mb of memory, but we had to make modifications to the language to make itwork -- most importantly, forbidding unbounded memory allocation.
Crashworks
+2  A: 

Perhaps not quite the large step from C you're looking for but C++ is also resonably popular for embedded projects.

Kristof Provost
Dan
A: 

I've used EC++ (Embedded C++) quite extensively.

Also, PICBasic has been popular with the PIC'ers for eons now.

Nate
A: 

I have used Ada in embedded project for military avionics because of customer requirements. There is lots of Ada tools for embedded development but most of it is very expensive. Personally I would just use C.

Gerhard
A: 

There is a Pascal compiler for 8051

Charles Faiga
And freePascal supports ARM, MIPS and a few others.
Warren P
+1  A: 

In the early 90 I did a lot of embedded development on the 8051 using Intel PLM51 and the DCX51 operating system.

PLM is very simple language – but very powerful

We now use C

Charles Faiga
A: 

JAL

none
A: 

There is a group of folks working to make Lua a viable option for embedded work. They are targeting primarily 32-bit ARMs with 256K FLASH and 64K RAM or better, and seem happy with their work so far.

They are partly inspired by the classic BASIC-Stamp, a BASIC interpreter running in a moderately powerful PIC with the program itself stored in a serial EEPROM device.

At work, I am still maintaining a customer's embedded system that is written in a compiled flavor of BASIC running in a Zilog Z180 CPU. 1980's technology all around, with most of the system still built out of 24-bin DIP packages in sockets. The compiler runs under CP/M-80 running in a Z80 simulator, that itself runs in the MS-DOS simulator built into Windows. Aside from the shear amazement that anything productive can be done this way (and that you can still buy 27C256 UV erasable EPROMS, and that my nearly 20 year old Data/IO PROM programmer still works) I really wish the customer could afford to move to a new hardware design so the system could be rewritten in a maintainable language.

RBerteig
A: 

Depends on the microcontroller, many of them have C but the compilers are horribly, assembler is usually easy and the best performing, most efficient, etc. Ones like the msp, avr, and arm are good for C compilers and for those I would and do use C (depending on the problem).

I would stick to C or assembler, you are wasting memory, performance, and resources using anything else.

dwelch
A: 

Pascal, Modula2 work fine too. Essentially they are pretty much equivalent to C, except for the inability to do alloca (though some have that as extension).

But the core problem will be the problem with any !C compiler: what do you prefer, a better compiler/toolchain or the language of preference.

Despite I like the Wirthian languages most, I simply use C, and am living with the consequences, simply because the toolchain is better.

There have been examples in the past (Pascals, or even tightly compiled Basics), but C is mostly the norm. I never understood why.

Marco van de Voort
A: 

I worked on a device which ran some incredibly old version of python (1.4 or something). There was no way to debug it (other than printing debug messages) so when your code hit an exception everything would just stop and you scratched your head for an hour. Whenever you made a change and upgraded the code it was running, it took about 10 minutes to interpret and compile it.

Needless to say we scrapped that and replaced the microcontroller with one that ran C.

James
I wrote a microcontroller based system with all the code in C, which used an embedded python interpreter for extensions and scripting. Beauty.
Warren P
+1  A: 

If you work in the smartcard space, you get to use Java Card. Yep, Java, on an 8-bit micro. It's kinda fun, actually. I get to develop in Eclipse, test ( & debug!) on the PC simulator, and can be confident that it'll run the same on the card. It's just such a pity Java is a terrible language for embedded apps :)

A: 

See this related question:

What languages are used for real-time systems programming.

In response to your "why" question, from the standpoint of government/military acquisition, there is a perception that Java (language, platform, etc...) is the lingua franca these days and that economies of scale in the language will reduce acquisition and maintenance cost. There's also a hope that one can efficiently train a competent Java programmer to be a reasonable RT/embedded programmer in Java faster than if they are required to learn a new language. This rationale is suspect, in my opinion, but it does answer the "why" question.

andersoj
+3  A: 

When you say "embedded development", keep in mind that you have to consider the scale of the project.

When programming something on the scale of a microcontroller or the firmware for an ASIC, you tend to see C and assembly dominate the scene. Embedded developers tend to "specialize" in these languages since compilers for them are available for nearly every embedded target platform. If your project migrates from, say, a chip with a PowerPC core to a chip with an ARM core, you can be fairly confident that your C code will not be overly difficult to port over. Some chips do have compilers available for other languages, but typically they do not match the C compiler in terms of efficiency of the resulting binary. Since embedded systems are often low on resources, system designers want to make their code as efficient as possible (also one reason why you see a lot of assembly language code). I have seen development tools available for languages such as C++, Pascal, Basic, and others, but they are typically niche tools that are not mature enough to match the efficiency of the available C compilers. Debugging tools for these languages also tend to be harder to find than what is available for C/assembly.

You also mentioned set-top boxes. Embedded systems on this scale can pack the equivalent power of a desktop computer from 7-8 years ago. Their available RAM, storage space, and processing power allows them to run full-featured operating systems and interpreters for higher-level languages. On these more powerful systems you will still see C and assembly language being used (for driver code, if nothing else), but other languages (such as Java, Lua, Tcl, Ruby, etc) are becoming more and more common. Using interpreted languages makes porting code from one platform to another even easier, as long as the platform has sufficient resources to handle the overhead of the language interpreter. Any low-level code that interfaces directly with hardware (drivers) with still typically use assembly or C since high-level languages don't always have the capability to do this sort of thing. Anything running as an application on top of the embedded operating system can usually be developed and tested inside an emulator or virtual machine, and so you will see a lot of code being developed in whatever language the developer happens to be comfortable with.

TLDR version: C is popular because is it a versatile language that nearly all developers are familiar with. Assembly is popular because it allows for low-level hardware access in ways that would otherwise be difficult or impossible. Interpreted/scripted languages such as Java are becoming more popular, but the resource requirements of the interpreters for these languages may be too much for some embedded systems to handle. The quality and variety of development/debugging tools availability for the C and assembly languages also makes these options attractive.

bta
A: 

If you include the iPhone as an embedded platform then Objective-C

sean riley
A: 

Considering how many times I've had a Java out-of-memory exception on my phone(most of the time I do anything remotely interesting), I'd run away from Java like a bat out of a hot place.

I've heard that Erlang was designed for use for cell phones. I think Lisp is a good architecture for remote device support- if the device cna handle the run-time.

Paul Nathan
A: 

A lot of home-brew users and small companies needing a cheap solution have found Tiny Tiger and Basic STAMP (using BASIC) meets their needs.

Warren P