PDA

View Full Version : What programming language is use for firmware?



imzjustplayin
11-06-2007, 08:48 AM
What kind of programming language do they use to program firmware in thing such as a network card, a chipset on a motherboard, or to control ECU functions in a car?

Scubar
11-06-2007, 10:03 AM
Id say it would either be ASM or C, Most likely C because its a hell of alot less time consuming than ASM.

Speederlander
11-06-2007, 04:40 PM
Chipset is assembly, the other two would typically be C with in-line assembly.

imzjustplayin
11-06-2007, 06:14 PM
What about a HDD firmware? Doesn't the ECU in a Car or the chip (microcontroller?) in a PCMCIA wifi card or HDD controller board have a different type of processor than an X86 based one? How would they program in C if the processor is a different architecture? What do they use to program cable boxes and Cellphones (smart phones based off ARM) and ones that aren't so "smart"?

Speederlander
11-07-2007, 05:36 PM
What about a HDD firmware? Doesn't the ECU in a Car or the chip (microcontroller?) in a PCMCIA wifi card or HDD controller board have a different type of processor than an X86 based one? How would they program in C if the processor is a different architecture? What do they use to program cable boxes and Cellphones (smart phones based off ARM) and ones that aren't so "smart"?

You have to have a compiler that will produce code to run on the architecture in question. C itself is portable, mostly.

rcofell
11-09-2007, 01:19 AM
Well, just think of C(or any other compiled language in fact) as an intermediary language, it only exists to be compiled into the equivalent 0s and 1s that assembly(ASM) expresses, and mostly portable as said above(instead of writing completely new code for a different architecture like with ASM, you could possibly just have to change a few lines). Although when moving between microcontrollers with different architectures you'll have to change any direct references to registers/memory locations, besides the mechanics of any timers/interrupts used.

C just exists to make the coder's job easier, much easier, so instead of having to know/memorize most of a IA(instruction architecture) for the microcontroller like you would for ASM, you can get by with writing code that's abstracted to a level above that, as the compiler takes care of the nitty gritty(although not always in the most efficient manner). ASM still has its place though, in applications where performance/memory footprint is an issue assembly can't be beat, since you're telling the microcontroller/processor what to do and exactly how to do it, hence it isn't very portable, and undocumented code is nearly impossible to understand.

This is where inline assembly comes into play, you can get the best of both worlds by inserting ASM code into your C code, so you can take care of situations where timing/performance is an issue.