Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Looking for books about C++ embedded programming

Status
Not open for further replies.

speedoak

Member level 1
Joined
Apr 12, 2003
Messages
36
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
355
C++ embedded programming

I use C to develop hardware driver for a long time, I used to think C++ is not efficient to develop low level driver, but recently I found that by using C++ to develop driver is very good and interesting, anybody can recommend some C++ application notes or book on C++ embedded programming?? thanks
 

Re: C++ embedded programming

Hi Speedoak,

Try to get from here:
Code:
http://ftp.cdut.edu.cn/pub3/uncate_doc/OReilly%20-%20Programming%20Embedded%20Systems%20in%20C%20and%20C++.chm
 

C++ embedded programming

this book introduces a chapter about
Making our C programs "look like" C++
 

C++ embedded programming

in general, c is a good choice for embedded programming. it is very easy to implement the interface between hardware and software.
 

Re: C++ embedded programming

Hi

Have you a tutorial for learn to use CCS PIC C compiler??


Thank you
 

Re: C++ embedded programming

speedoak said:
I use C to develop hardware driver for a long time, I used to think C++ is not efficient to develop low level driver, but recently I found that by using C++ to develop driver is very good and interesting, anybody can recommend some C++ application notes or book on C++ embedded programming?? thanks

a few compilers support C++,
but i think C++ is to help you apply all the concepts of OOP (inheritance,etc..)
as long as you have quite enough RAM...
 

Re: C++ embedded programming

terka said:
Hi

Have you a tutorial for learn to use CCS PIC C compiler??


Thank you

An Introduction to Programming The Microchip PIC in CCS C



Bye
 

Re: C++ embedded programming

what is CCS C?
 

Re: C++ embedded programming

I want to know from your experiences, which is more desirable in embedded C programming? Declaring variables as global variables OR using local variables in functions?

Sometimes i avoid creating functions with more than 1 parameter, because it seemed that the stack memory requirements increases. I also prefer using global variables then using local variables for the similar reason. Are my assumptions correct? Anyone has any suggestions for better C embedded programming?

salam,
irfan.
 

C++ embedded programming

using global variables means we always reserve certain amount of RAM for these variables.
So i suggest using least global variables as much as possible... usually only in the case of shared variables..
 

Re: C++ embedded programming

irfansyah

as you said that you avoid using function's with more than 1 parameter
that is good but what if you require a function with more than i parameter

also using global variable is not a good idea unless they are shared as they take memory for entire life of program at run time

use local variables
also declare local variables inside if() conditions so that only if actualy required are local variables declared and take space from heap

Added after 4 hours 30 minutes:

Use pointer efectively to improve the code
it improves the speed and is more compact
 

C++ embedded programming

C++ may be not efficient from the point of code size.C is very suitble for mid level mcu's.I advice C...
 

Re: C++ embedded programming

devennan said:
irfansyah

also declare local variables inside if() conditions so that only if actualy required are local variables declared and take space from heap

can we do it? i think most C compilers ask us to declare variables at the beginning of the function..
 

Re: C++ embedded programming

SphinX said:
terka said:
Hi

Have you a tutorial for learn to use CCS PIC C compiler??


Thank you

An Introduction to Programming The Microchip PIC in CCS C

h**p://

Bye

Is this book completely uploaded?
 

The best method for variable declarations.

Hi,
as you know local static variables are invisible outside the prodecudure, globals are visible everywhere in whole program.
But in my oppinion, when you are declaring variables, you have to choice:

- "good school" looking
or
- "experience school"

The first you can found in each book - declare static variables inside procedues, like somone described in upper text.

The second solution is:
When you starts new embedded application, you should put all variables (globals and local static) in one header file.
Thats gives you opportunity to easy make application test, better than with static varibles hidden in procedures :)

When everything is tested, if you want, you can move all locall static variables declarations to proper places. I do so since 15 years and test time is strongly reduced.

Another metter is C++ on microcontrollers.
The compiled code size is the same like C.
The source code written in C++ is bigger than written in C for the same solution.
And programming is easier , thanks to C++ is higher level language than C.
If you don't belive - than try it ! To get your own oppinion.
 

Re: C++ embedded programming

A short document on firmware programming standard:
http://www.ganssle.com/misc/fsm.doc
by Jack Ganssle

in which he discourages the use of global variables especially when there are a lot of them leading to debugging problems..
Code:
All too often C and especially assembly programs have one huge
module with all of the variable definitions. Though it may seem
nice to organize variables in a common spot, the peril is these are
all then global in scope. Global variables are responsible for much
undebuggable code, reentrancy problems, global warming and male
pattern baldness. Avoid them!
Real time code may occasionally require a few - and only a few -
global variables to insure reasonable response to external events.
Every global variable must be approved by the project manager.
When globals are used, put all of them into a single module. They
are so problematic that it’s best to clearly identify the sin via the
name globals.c or globals.asm.
 

C++ embedded programming

Have anybody tried JAVA in embedded system?
 

Re: C++ embedded programming

there's JEPES
**broken link removed**

but i haven't tried out
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top