FPGARelated.com
Forums

Microblaze, Xilkernel, and g++

Started by JackBonn October 1, 2010
I am running the Xilinx Software Development Kit Release Version:
11.2.00

My system has a Microblaze and is running Xilkernel.  I have had good
luck getting my code running with the C compiler, but now I am
transitioning to C++ to allow a pile of C++ to be ported over.  As a
first step, I renamed all the .c files to be .cpp and got a successful
compile after a few changes, most notably having to add this to one of
my files:

    extern "C" {
        void xilkernel_init ();
        void xilkernel_start ();
        int pthread_attr_setstack(const pthread_attr_t *attr, void
*stackaddr, size_t stacksize);
    }

I could not find prototypes for any of these three functions.  Shame
shame.

I also changed to this:

    extern "C" int main(void)

to make the linker happy.

Now that I have a clean compile, I am trying to debug the results.  It
seems that some of
the interrupts and/or calls to semaphores are flakey.  Specifically,
the timer interrupt is fine since Xilkernel starts,  But I am having
trouble with code associated with my interrupt driven driver for the
serial port. Just interrupts and semaphores involved here; when I run
with the original programmed i/o code everything is fine.

Remember, this all worked when I was compiling with gcc compiler and
failed when I went to g++.

In the past, I have used g++ to compile c code as a "better c
compiler".  Better at enforcing
interfaces and requiring prototypes.  So, these problems are a bit of
a surprise, especially given that the underlying tools are gnu.

Short of debugging the underlying machine/assembly code, does anyone
have any suggestions?

--
Jack Bonn <> Software Design Labs, Inc.
jack.bonn@swlabs.com (847)526-1337

Dyslexics untie.