This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

StarterWare 2.00.00.05 Initialization and c++

Hi,

I am now having some limited sucess in using StarterWare on the BeagleBone using c++.  Compiling, debugging and running the examples was more or less straightforward.  Creating my own project based on Starterware, was less so, but achievable. 

I now have a question about the Startup code.  The code I found in init.asm and startup.c does not seem to call any of my constructors of global/static c++ objects.  It seems that starterware redirects the entry point from the default c_int00() to Entry().  Does this bypass 'normal' c++ initialization?  Can c++ be supported in StarterWare?

What is the best way to make sure that my c++ globals are initialized at startup? 

Cheers,

-Jay

  • Hi Jay,

              StarterWare is aimed at providing no-os low level peripheral programming. So we couldnt envision using C++ for this, as there no OO programming or high level design involved.

               Considering that customers can come with different background, we will look at changes needed to support C++ and probably come up with the steps required to enable C++. But i couldnt see the need for supporting C++ in StarterWare deliverable.

    Regards

    Baskaran

  • Thank you Baskaran for the quick reply.

    Looking further into it, it seems that the standard library call into the runtime library's perform_cinit() (in auto_init.asm) has been bypassed.  It looks like this was done by avoiding the default entry point of c_init00 to Entry in the linker file. 

    Anyway, I look forward to using c++ fully under starterWare.  I find that c++ in an embedded envronment is effecient and more re-usable than the equivilent C. 

     

    Cheers,

    -Jay

     

  • Looks like version 2.00.00.06 silently fixed this issue.  There was no notification in the release notes, but I can confirm now that init.asm now calls __TI_auto_init where it had not in 2.00.00.05.  This will properly cause all c++ objects declared in the global scope to have their constructors called. 

    Thank you for the change.  It really would be best if you documented these kind of changes in the future. 

    Cheers,

    -Jay

  • Jay,

          In 05 release we only had load time init of global variables. We have indeed added __TI_auto_init to support runtime initialization of global variables (in C), so that it will work for both the models. The intention here was not to add C++ support and we have not tested for C++ environment.

    Anyway good that it works for C++ too..:)

    Regards

    Baskaran

  • Hi Baskaran,

      When I trace the starterware code, occasionally, I found your post here. According to your description as above,  the __TI_auto_init will do the initialization for the .bss section, which is not done in GCC.  Is my understanding right? please confirm it.

    Thanks!

    Yaoming                        

      

  • Yaoming,

                  You are correct.

    Regards

    Baskaran

  • hi jay
    I have the same problem,but I can not find the "__TI_auto_init" in init.asm at version 2.00.00.06.
    can you give me some advice?
    I use the starteware and gcc.
  • Hi,

    The gcc runtime environment is probably very different. I don't have any experience with gcc. Sorry.

    Jay