By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,420 Members | 1,133 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,420 IT Pros & Developers. It's quick & easy.

why c is using in embeded systems

P: 5
hi any one reply why is c powerful language than others and also why we have to go for 'C' only for embeded systems most of the times
Nov 8 '06 #1
Share this Question
Share on Google+
3 Replies


Banfa
Expert Mod 5K+
P: 8,916
C is used in embedded systems because it provides low level access to the hardware (that is you can access the hardware directly using pointers) which historically other languages have not done. Also as a low level language it's instructions often have direct equivilents in machine language (assembler) making it easy to compile for most platforms.

Also it is a well developed language so writing compilers for new platforms is relatively easy.
Nov 8 '06 #2

Expert 100+
P: 1,510
hi any one reply why is c powerful language than others and also why we have to go for 'C' only for embeded systems most of the times
You chose a language to suit the application area and C (and C++) are suited for embedded applications due to
(1) one aim of C was to be able to implement machine independent code for applications which in the past required assembly language, e.g. operating systems such as UNIX
(2) pointers can be used to access memory mapped registers in I/O devices
(3) it has low-level operators similar to those in assembly languages and which can map directly into machine code operations, e.g. ++ -- and the bitwise operators & | ~ << >> etc which enable manipulation of bits (setting, clearing, shifting, etc)
(4) C has been around a long time and compilers are very efficient at optimizing code; often producing better code than many programs written in assembly language.

Assembly languages were not only machine dependent so code could not be ported across platforms but equivalent C code could be written in a much shorter time.

Assembly language still used for time critical area of applications. However, many modern processors are so complex (e.g. ARM 7, TMS320C6711, dsPIC) that they mainly programmed in C or C++
Nov 8 '06 #3

Banfa
Expert Mod 5K+
P: 8,916
Assembly language still used for time critical area of applications. However, many modern processors are so complex (e.g. ARM 7, TMS320C6711, dsPIC) that they mainly programmed in C or C++
Or areas where the code has to be code specific because it requires direct access to the processor registers.

I am think of RTOS where 95% of the code is C but there are often a few routines under-pinning the C code in assembler (in my experience often associated with task switching).
Nov 8 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.