EmbDev.net

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


Author: Matt Budd (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello,

I am new to embedded devleopment (years in the Desktop app world), and
am having issues getting C++ to work on my AT91SAM9263-EK board.

All of the samples that Atmel gives are pure C, not C++. When I take one
of their simple samples and change its main.cpp (instead of main.c) and
use g++ instead of gcc, I get the following link error:

ld.exe: error: no memory region specified for loadable section
`.gcc_except_table'

After doing some digging, it seems like I need to customize my startup.s
and my linker script for this board for C++ (exception tables, ctor and
dtor stuff, etc.). Not ever having to worry about this in the Desktop
world, I am way out of my league and have no real idea how to change
either of these files.

Does anyone have a sample project that does some basic C++ on this
board. I know C++...just not how to get C++ to work on this particular
board. I have uploaded the sample project that isn't working to
http://www.madentec.com/test/cpptest.zip (NOTE: the
at91lib is a directory Atmel provides...it has the linker script and
startup code that seems to be geared for pure-C).

Author: Matt Budd (Guest)
Posted on:

Rate this post
0 useful
not useful
Oh, sorry, I forgot to mention that I am using Yagarto/Eclipse/Make like
Atmel recommends in their development guide. The version of g++ is
4.2.2.

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 useful
not useful
Matt Budd wrote:
> Hello,
>
> I am new to embedded devleopment (years in the Desktop app world), and
> am having issues getting C++ to work on my AT91SAM9263-EK board.
>
> All of the samples that Atmel gives are pure C, not C++. When I take one
> of their simple samples and change its main.cpp (instead of main.c) and
> use g++ instead of gcc, I get the following link error:
>
> ld.exe: error: no memory region specified for loadable section
> `.gcc_except_table'
>
> After doing some digging, it seems like I need to customize my startup.s
> and my linker script for this board for C++ (exception tables, ctor and
> dtor stuff, etc.). Not ever having to worry about this in the Desktop
> world, I am way out of my league and have no real idea how to change
> either of these files.
>
> Does anyone have a sample project that does some basic C++ on this
> board. I know C++...just not how to get C++ to work on this particular
> board. I have uploaded the sample project that isn't working to
> http://www.madentec.com/test/cpptest.zip (NOTE: the
> at91lib is a directory Atmel provides...it has the linker script and
> startup code that seems to be geared for pure-C).

I do not use C++ for "real" projects and the AT91SAM9 board I have here
still waits in the "toy-box" since I'm busy with other things. So - take
it for what it worth:
I have done same examples for C++ on ARM7TDMI which you can find on on
www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects and the
"sub"-pages. Since the basic usage and settings should not depend on the
target you might look into these. Other sources of information:
- The default linker-script (arm-elf-ld --verbose)
- newlib sources (directory libgloss/arm)
- embedded.com "bare-metal" tutorial
- last but not least and very informative: the examples from the Anglia
ST tools (http://www.st-angliamicro.com/software.asp). There are also
examples for STR9 ARM9 controllers in one of the packages (IDEaliST IDE
or STRx toolchain). Even if there are some differences between AT91SAM9
and STR9 you should find a lot of "inspiration" in Spencer Oliver's
examples.

Ah - and try to use the g++ options -fno-rtti -fno-exceptions at least
for the first experiments you can try to get execptions working later.

Hope this helps at least a little bit.
Martin Thomas

Author: Jim Kaz (ancaritha)
Posted on:

Rate this post
0 useful
not useful
Matt Budd wrote:
> Does anyone have a sample project that does some basic C++ on this
> board. I know C++...just not how to get C++ to work on this particular
> board. I have uploaded the sample project that isn't working to
> http://www.madentec.com/test/cpptest.zip (NOTE: the
> at91lib is a directory Atmel provides...it has the linker script and
> startup code that seems to be geared for pure-C).

So this code is for the Arm7TDMI core (specifically the AT91SAM7A3), but
it should at least show you how I set up the starter files/linker etc.

http://users.wpi.edu/~jimmykaz/Arm/Sam7A3_Virt_Fnct.rar


This does C++ and virtual functions.

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]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.