What purpose does __libc_init_array() in library libc.a serve?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

What purpose does __libc_init_array() in library libc.a serve?

ソリューションへジャンプ
6,209件の閲覧回数
anaseem
Contributor IV

My development environment is MCUXpresso IDE.  My microcontroller is LPC11E68.  The reset entry point of my code calls __libc_init_array().  This function is in libc.a.  We are not provided with source code for this function?  Map files gives following information:

c:/nxp/mcuxpressoide_10.2.1_795/ide/tools/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v6-m\libc.a(lib_a-init.o)

./LPC_Code/cr_startup_lpc11e6x.o (__libc_init_array)

Why is this function called at startup?  Is there documentation that explains why this function needs to be called in reset initialization code?

I'm using NewLib (Nohost) library.

ラベル(1)
タグ(1)
1 解決策
5,278件の閲覧回数
BlackNight
NXP Employee
NXP Employee

This serves calling constructors and other library initialization which is necessary before calling main. There is a good description about this as well on gcc - understanding the __libc_init_array - Stack Overflow .

I hope this helps,

Erich

元の投稿で解決策を見る

1 返信
5,279件の閲覧回数
BlackNight
NXP Employee
NXP Employee

This serves calling constructors and other library initialization which is necessary before calling main. There is a good description about this as well on gcc - understanding the __libc_init_array - Stack Overflow .

I hope this helps,

Erich