TI E2E Community
StarterWare 2.00.00.05 Initialization and c++
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?
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.
Note: If this post answers your question, please click the Verify Answer button below. Thank you!
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.
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.
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..:)
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.
You are correct.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.