Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   embedded systems (http://www.velocityreviews.com/forums/t440021-embedded-systems.html)

shan 11-04-2005 11:15 AM

embedded systems
 
Hi to everybody,
what are the concepts that should be learnt in
c to write a embedded software.C is more powerful to handle hardware
but embedded softwares are often written in assembly language ,why ?

Thanks in advance


winnie 11-04-2005 11:19 AM

Re: embedded systems
 
if u wanna learn to write embedded software,you'd better buy a book
about it.it is absolutely a systematic project,really!Good luck!


Antonio Contreras 11-04-2005 11:41 AM

Re: embedded systems
 
shan wrote:
> Hi to everybody,
> what are the concepts that should be learnt in
> c to write a embedded software.


Learn the whole of it. At the very least it won't hurt, and you'll find
it useful if you have to develop some aplication over a PC or a
workstation.

That, said, in embedded systems you're not very likely to use
dinamically allocated memory. You will still use pointers a lot to pass
references arround, but those pointers will usually point to statically
allocted objects (the implementation I'm working with right now doesn't
even support calls to malloc() ).

If you work with small microcontrollers, memory will be at a price, so
you'll end up using bitfields a lot.

Finally, every C compiler for microcontrollers that I've come across
was non conformant in one way or the other. After you learn C, read the
documentation for your compiler, and learn about extensions and
discrepancies with the standard. In 8bit microcontrollers it's usual
for integral constants not to be of type int if they fit in a smaller
type, or to perform arithmetic operation at the precission of the
largest operators (so two chars will not be conveted to int and back as
is usually done). There are also usually extensions for specifying in
which memory location will an object be stores (to allow for maping I/O
registers to be mapped to variables).

> C is more powerful to handle hardware
> but embedded softwares are often written in assembly language ,why ?


I disagree. Assembler offers total control over the machine (not that
this is necessarily a good thing), so it could be said to be more
powerful than anything else.

Anyway, I've worked in a few projects that requiered developing
firmware for some or other embedded system and for the most part they
were developed in C. Only interrupts with tight timing requirements
were written directly in assembler.


Zara 11-04-2005 11:42 AM

Re: embedded systems
 
On 4 Nov 2005 03:15:43 -0800, "shan" <srishankar18@gmail.com> wrote:

>Hi to everybody,
> what are the concepts that should be learnt in
>c to write a embedded software.C is more powerful to handle hardware
>but embedded softwares are often written in assembly language ,why ?
>
>Thanks in advance


I do wtite embedded sw in a C/C++/ASM mix that might condemn me to
hell for all eternity. Bit it works.

Take a look at MISRA-C (use Google!), it is really interesting.

Best regards

-- Zara



All times are GMT. The time now is 02:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.