Skip to content

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Oct 2, 2019

Add C source files wrapper library

Allow to not archive HAL/LL object files to core.a.
This avoid the linker to select weak definitions instead of non-weak ones when 'whole-archive' option is not used.

See:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15833.html
New ref: https://developer.arm.com/documentation/101754/0623/armlink-Reference/Image-Structure-and-Generation/Weak-references-and-definitions?lang=en

This allow to save lot of space.
Example for BluePill F103C8 AnalogReadSerial sketch with USB CDC enabled:

  • With whole-archive:

Sketch uses 22976 bytes (35%) of program storage space. Maximum is 65536 bytes.
Global variables use 3532 bytes (17%) of dynamic memory, leaving 16948 bytes for local variables. Maximum is 20480 bytes.

  • Without whole-archive:

Sketch uses 18972 bytes (28%) of program storage space. Maximum is 65536 bytes.
Global variables use 3176 bytes (15%) of dynamic memory, leaving 17304 bytes for local variables. Maximum is 20480 bytes.

Full build without whole-archive and source files built-in library:
build_result.log

@fpistm fpistm added the enhancement New feature or request label Oct 2, 2019
@fpistm fpistm force-pushed the whole-archive branch 2 times, most recently from 6df672a to e2d24ab Compare October 4, 2019 12:48
fpistm added 3 commits October 4, 2019 16:16
Allow to not archive HAL/LL object files to core.a. This avoid the linker to select weak definitions instead of non-weak ones when 'whole-archive' option is not used. See: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15833.html Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Due to a bug in the arm none eabi gcc with lto which raise an unresolved reference if syscall is in the archive (_sbrk,...) See: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15833.html Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
1 participant