On Sat, 15 Aug 2009 08:34:33 -0000
"gene_klein2000" wrote: > The problem is when I use a class the system goes
crazy.
Huh. I have several classes instantiated globally with no problems.
However, in looking back at my code I am just using it for code
organization, no vtables, no constructor code, and I'm not using any
dynamic allocation.
Sorry for that dead-end.
Dan
Reply by gene_klein2000●August 15, 20092009-08-15
Thanks Dan,
Already did this.
The problem is when I use a class the system goes crazy.
Added this code to board_startup.S for initializing the constructors
I've verified the calling of the constructor for this class.
A simple debug print in the constructor and i see the text.
So it is called.
The main loop is like this
int main()
{
unsigned long teller = 0;
// setup debug port
DBGU_Configure( DBGU_STANDARD, 115200, BOARD_MCK );
LED_Configure( LED_YELLOW );
// Optel.Task();
// the main loop
while( 1 )
{
teller ++;
if( teller >= 5000000 )
{
teller = 0;
LED_Toggle( LED_YELLOW );
DBGU_PutChar('"x' );
}
}
}
Normally this put an X on the terminal window every second or so.
As soon as I uncomment the line Optel.Task();
The terminal window is filled with X's.
And the delay is no more there
What is the problem here, what am I doing wrong ???
Thanks for any help,
Gene
Reply by Dan Lyke●August 14, 20092009-08-14
On Fri, 14 Aug 2009 18:36:39 -0000
"gene_klein2000" wrote: > I would like to start programming in c++ on a
at91sam9260-ek.
>
> Is there anyone who can help me with the linker file and startup code
> for the constructors\destructors(if i need them).
On the AT91SAM9XE-EK, I just set up my Makefile to have C++ targets,
basically everywhere I had a CC I duplicated it with CXX and made the
appropriate change in the dependency rules from .c to .cxx compiled 'em
with $(CROSS)g++, and everything worked.
A quick look through my Makefile... Add
CXX = $(CROSS)g++
# like CFLAGS, except no -std -fgnu89inline
CXXFLAGS = -mlong-calls -ffunction-sections -Wall
# and just like CFLAGS
CXXFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
Setup your CXX_OBJECTS just like your C_OBJECTS (remember that you'll
need to "extern C {...}" your include files to call C_OBJECTS compiled
bits:
CXX_OBJECTS = main.o
CXX_OBJECTS += ...
Down in your "define RULES" section, do something similar to the
C_OBJECTS with CXX_OBJECTS and make sure you add $$(CXX_OBJECTS_$(1))
to the dependencies for your $(1)