Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slim down sketch size #553

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

facchinm
Copy link
Member

Since 0304de7 the sketch size has exploded. Moving the BLE stack to ARC core is the main responsible.
This patch addresses two main fields:

  • avoid including useless functions (WIP)
  • avoid including ble symbols in sketches which don't use it

The first patch could be further optimized but since most sketches uses the CDC port it doesn't make much sense.

Sketch size comparison:
BareMinimum: 48744 -> 12540
(BLE central) Scan: 91692 -> 80440

__assert_func and its dependencies are automatically added by libc unless we provide a stub implementation and avoid uisng -Wl,--whole-archive when linking against system lib
By moving the BLE stack initialization to its library we can avoid including it in any build.
@@ -158,6 +158,9 @@ SECTIONS
{
. = ALIGN(4);
__start_heap = .;
end = __start_heap;
_end = end;
__end = end;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not clear on the purpose of these 3 new symbols? can you explain them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first step to properly support newlib's nano.specs, which unfortunately aren't compiled in the current toolchain. The nano lib doesn't provide all the symbols and the linker would fail with something like

sbrk.c:(.text._sbrk+0x2): undefined reference to `end'

@eriknyquist
Copy link
Contributor

@SidLeung can you review please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants