3 years ago.

mbed boot procedure issue with GCC ARM

I am porting a new target with mbed os. In the boot sequence, the libc_init_array() function is being called from premain in mbed_boot.c . It builds fine and both libgccc and libc are linked properly. However, the binary does not work properly as it crashes when libc_init_array() is called. I am debugging by exporting the project via mbed-cli.

1. Can anybody tell me why is this function call necessary and what does it do?

2. By skipping this function, the mbed main application is reached and is working fine (although its not using any resources at the moment, only an infinite while loop). Can it be skipped?

Hi, what is your app that you are testing with?

The libc init array is initializing the objects (for instance by calling their constructors), so one of the objects is crashing. It is needed, otherwise for instance the global objects would not be initialized (once an app gets to main, you can use those objects, as they have been initialized). This answers the second question, no can not be skipped, or rather should not.

posted by Martin Kojtal 13 Nov 2017

Alright. I understand that this cannot be skipped. The app which I am using is the simplest of all. No resources from mbed are being used, just an infinite loop with 2 variables initialized to 0.

posted by Bilal Qamar 21 Nov 2017
Be the first to answer this question.