Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Using C++ on LPC3128

2005-04-21 by Charles Manning

Ok, you're free to do what you want, but I feel I must make a comment.

C++ uses more resources (RAM and flash) than the same thing done in C code.
C++  tends to need far more dynamic memory allocation/freeing. Something that 
is typically not very well handled on small embedded systems.
C++ hides detail making it harder to debug on an embedded platform.

In short, C++ and small embedded systems don't mix very well. In over 20 
years of embedded programming I have never found a compelling need for C++ on 
smaller systems.

There is nothing theoretical preventing the use of C++ on ARM7 though. It 
will all be stuff to do with your compiler settings, linking, and making sure 
you provide all the runtime stuff that C++ needs.

On Wednesday 20 April 2005 19:56, soren_t_hansen wrote:
> I'm trying to use C++ to write a program to a LPC2138, and so far it
> was working ok. But when trying to make a virtual function the linker
> reports the following error:
>
> /src/Blinky.o(.gnu.linkonce.r._ZTI11CLEDControl+0x0): undefined
> reference to `vtable for __cxxabiv1::__class_type_info'
> /src/Blinky.o(.gnu.linkonce.r._ZTI7CBlinky+0x0): undefined reference
> to `vtable for __cxxabiv1::__si_class_type_info'
>
> I'm using the GNU ARM (3.4.3) toolchain to compile the program and for
> the linker I use the following:
>
> -T $(LD_SCRIPT_RAM) \
> -Wl,-Map=".\bin\Ram\Blinky.map",-Ttext=0x40000000,-Tdata=0x40003000 \
> --gc-sections -o .\RAM\Blinky.elf \
> -nostartfiles -nodefaultlibs
>
> I've tried to use the -lstdc++ option, but that resulted in another
> error, regarding delete(void*)
>
> Is it because you can't use virtual functions on ARM7 or is it an
> error in the compiler or maybe my linker script?
>
> Best Regards
> S\ufffdren Hansen
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.