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).
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.
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
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.
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.