EmbDev.net

Forum: ARM programming with GCC/GNU tools Coding with C++

Author: Michael Rodrigues (michael_rodrigues)
Posted on: 2009-04-27 09:10

Hi,

I am using the Yagarto toolchain for the AT91SAM9RL64. I am required to
design a GUI on this chip and a GRaphical LCD. The X11R6 libraries are
being used to handle the graphic realted parts.

My querry was,
1. could i use CPP (C++) to develop my GUI (using the same setup as
mentioned above).

2. are there any precautions / care that i should be taking while taking
a plunge at CPP


please reply urgent
Author: Guest (Guest)
Posted on: 2009-04-27 19:45

Well if there is a C++ compiler for your target platform, why not?
Usually GUI development is done with some sort of library/toolkit (on
Standard-PCs: GTK+, Qt, MFC, ...). No idea if there is something like
that available for the hardware you are using.
Author: Clifford Slocombe (clifford)
Posted on: 2009-04-28 00:35

Michael Rodrigues wrote:
> The X11R6 libraries are
> being used to handle the graphic realted parts.
>
Will X run without an underlying Unix/Linux support? Seems a bit
heavyweight for such a limited part. Do you have external memory
resources?


> My querry was,
> 1. could i use CPP (C++) to develop my GUI (using the same setup as
> mentioned above).
>
You can use C++, and mix C++ and C libraries.


> 2. are there any precautions / care that i should be taking while taking
> a plunge at CPP

C++ has additional runtime set-up requirements. Your crt0.s must include
code to invoke the constructors of statically allocated objects. I have
seen crt0.s implementations that do not include such code so static
objects will not be correctly initialised when main() is started.

The newlib sbrk stub must be implemented to allow the 'new' operator to
work since it is implemented using malloc().

You may want to avoid dynamic memory allocation due to lack of
determinism or resource, and to avoid memory fragmentation. Much of the
standard library makes extensive use of dynamic memory, so you may wish
to avoid that too. The STL and sting libraries add significantly to code
size. Note also that some library calls throw exceptions. The 'new'
operator also thors exceptions rather than returning NULL like malloc().
You can include <new.h> and use 'new(std::no_throw)' instead of plain
'new'.

When mixing C and C++, be aware that C++ has different linkage
conventions. C header files used for C++ linkage must have the extern
"C" declaration within conditional compilation, and C++ interfaces to be
used in C code must have been compiled with extern "C" declarations. See
http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html


Clifford

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]





Note: the original post is older than 6 Months.

webmaster@embdev.netContactAdvertising on EmbDev.net