Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Using mixed C/C++ code on bare metal arm-none-eabi target
PostPosted: Wed Dec 14, 2011 4:33 pm 
Offline

Joined: Tue Oct 11, 2011 4:08 pm
Posts: 2
Hi,
I am building a complex application for AT91SAM9RL target. Here is a brief description of my system:
- CodeSourcery arm-none-eabi compiler
- AT91SAM9RL64 IC on custom board (similar to AT91SAM9RL-EK)

I successfully run a simple graphical application on my system, written in pure C.
I prefer to avoid using third party libraries and systems (with their own licenses), even well knowing the efforts needed to build a functional gui framework library for my application. But I think that the best approach is to build it in C++ code, since its virtualization capabilities are a big help in such huge projects.

This means I have to update the startup and the linker scripts provided by at91 library in order to support the C++ library startup code and the ctors/dtors related to the classes.

In other words, I need to add in the linker script the .init and the .fini sections, and in the startup code the ctor/dtor callers.

I found sample code for the SAM7 family, but the scripts are completely different. If it is possible, I prefer to try to understand and apply the differences between original Atmel files and C++ requirements.

I don't know well the linker keywords and the code sections that needs to be worked out. Is there anyone that was able to run C++ code with the AT91SAM9 family?

Alternatively, could you explain me the code organization (where to place .init and .fini sections) and other differences between plain C initialization and C++ startup, and the method to be applied?

Any help is really appreciated.


Top
 Profile  
 
 Post subject: Re: Using mixed C/C++ code on bare metal arm-none-eabi target
PostPosted: Thu Dec 15, 2011 3:18 am 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
See how Rowley does it
http://www.rowley.co.uk/arm/


Top
 Profile  
 
 Post subject: Re: Using mixed C/C++ code on bare metal arm-none-eabi target
PostPosted: Thu Dec 15, 2011 1:37 pm 
Offline

Joined: Tue Oct 11, 2011 4:08 pm
Posts: 2
I found this document, and I think it is very clear.
I agree with the author, that says:
"While many online and printed resources focus on building and installing the GNU toolchain, it is quite hard to find a comprehensive example of using GNU C/C++ toolchain for bare metal ARM systems [...]. And even if you do find such an example, you most likely won't know WHY things are done the particular way"

I think that sharing this link could be useful for others:
http://www.state-machine.com/arm/Buildi ... th_GNU.pdf

I have just some concern about remapping (that is done once by the ROM bootloader, and then I have to setup IRQ and FIQ...), but probably I need to play with the code...


Top
 Profile  
 
 Post subject: Re: Using mixed C/C++ code on bare metal arm-none-eabi target
PostPosted: Thu Dec 15, 2011 11:05 pm 
Offline

Joined: Thu Dec 02, 2004 2:28 pm
Posts: 454
[quote="kk33"]I found this document, and I think it is very clear.
I agree with the author, that says:
"While many online and printed resources focus on building and installing the GNU toolchain, it is quite hard to find a comprehensive example of using GNU C/C++ toolchain for bare metal ARM systems [...]. And even if you do find such an example, you most likely won't know WHY things are done the particular way"[/quote]
that's the reason why I use a commercial compiler/IDE.
regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: