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
 

rbpij

Newbie level 3
Joined
Dec 22, 2004
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
28
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
 

ilker

Member level 3
Joined
Dec 13, 2004
Messages
58
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Location
TURKEY
Activity points
445
C++ embedded programming

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

nj_jack

Member level 5
Joined
Nov 9, 2004
Messages
87
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
725
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.
 

terka

Advanced Member level 4
Joined
Dec 15, 2003
Messages
100
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,298
Activity points
936
Re: C++ embedded programming

Hi

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


Thank you
 

banh

Advanced Member level 1
Joined
Dec 16, 2004
Messages
458
Helped
17
Reputation
34
Reaction score
5
Trophy points
1,298
Activity points
3,937
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...
 

SphinX

Advanced Member level 3
Joined
Jan 25, 2002
Messages
822
Helped
58
Reputation
116
Reaction score
29
Trophy points
1,308
Location
EGYPT
Activity points
7,045
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
 

banh

Advanced Member level 1
Joined
Dec 16, 2004
Messages
458
Helped
17
Reputation
34
Reaction score
5
Trophy points
1,298
Activity points
3,937
Re: C++ embedded programming

what is CCS C?
 

irfansyah

Advanced Member level 4
Joined
Dec 29, 2004
Messages
106
Helped
9
Reputation
18
Reaction score
1
Trophy points
1,298
Location
New South Wales
Activity points
1,124
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.
 

banh

Advanced Member level 1
Joined
Dec 16, 2004
Messages
458
Helped
17
Reputation
34
Reaction score
5
Trophy points
1,298
Activity points
3,937
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..
 

devennan

Member level 3
Joined
May 7, 2004
Messages
66
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,288
Location
India
Activity points
798
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
 

muko

Member level 1
Joined
Mar 3, 2004
Messages
37
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
317
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...
 

banh

Advanced Member level 1
Joined
Dec 16, 2004
Messages
458
Helped
17
Reputation
34
Reaction score
5
Trophy points
1,298
Activity points
3,937
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..
 

Jack// ani

Advanced Member level 3
Joined
Dec 2, 2004
Messages
759
Helped
107
Reputation
222
Reaction score
58
Trophy points
1,308
Activity points
5,006
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?
 

trashmen

Newbie level 3
Joined
Jan 9, 2005
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
40
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.
 

banh

Advanced Member level 1
Joined
Dec 16, 2004
Messages
458
Helped
17
Reputation
34
Reaction score
5
Trophy points
1,298
Activity points
3,937
Re: C++ embedded programming

A short document on firmware programming standard:
https://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.
 

FD357

Member level 2
Joined
Jul 19, 2003
Messages
44
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
200
C++ embedded programming

Have anybody tried JAVA in embedded system?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top