From 28d0ee58d055f6378d9b96a2ddd0b143a643a24f Mon Sep 17 00:00:00 2001 From: Olof Astrand Date: Tue, 20 Feb 2018 15:43:32 +0100 Subject: [PATCH] Added info about __libc_init_array --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f945e5..7dbbf2a 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,16 @@ But instead .platformio/packages/framework-cmsis/variants/stm32l1/stm32l151xba/startup_stm32l151xba.S is used, -Only difference is +Only difference is that platformio has removed the call to __libc_init_array /*bl __libc_init_array*/ /* PlatformIO note: Will work without -nostartfiles */ -Probably not important \ No newline at end of file + +Here you can read more about this, +http://cs107e.github.io/guides/gcc/ +https://www.embedded.com/design/mcus-processors-and-socs/4026075/Building-Bare-Metal-ARM-Systems-with-GNU-Part-2 + +The option -nostartfiles instructs the linker to not use the standard system startup functions nor link the code containing those functions. + + The library function __libc_init_array invokes all C++ static constructors (see also the linker script). + As we do not have any static c++ constructors this should not be a problem, but could be something to think about. + If you patch the function to call , bl __libc_init_array then you might get an undefined reference to _init. + https://answers.launchpad.net/gcc-arm-embedded/+question/224709