Skip to content

Increasing BLE sketch size of ~156k after adding BluetoothSerial lib #1194

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

Closed
reaper7 opened this issue Mar 8, 2018 · 9 comments
Closed
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@reaper7
Copy link
Contributor

reaper7 commented Mar 8, 2018

Hardware:

Board: ESP32 Dev Module
Core Installation/update date: Branch_b4b9a79 05/03/2018
IDE name: Arduino IDE
Flash Frequency: 80Mhz
Upload Speed: 921600

Description:

after adding the BluetoothSerial library (b4b9a79), sketches which use BLE library (https://github.com/nkolban/ESP32_BLE_Arduino/tree/6bad7b42a96f0aa493323ef4821a8efb0e8815f2) increase finally size by ~156 kbytes!

Lets try for example library: BLE -> example: BLE_uart:

  • branch with previous commit (835268c) finally sketch size: 931869 bytes (71%)

  • branch with BluetoothSerial library (b4b9a79) finally sketch size: 1088621 bytes (83%)

For this reason my sketches with BLE and several additions do not fit esp32 flash any more,
even though I do not use new BluetoothSerial library in these cases (increase size from 1265006 to 1422022)

What is interesting, I did not notice the increase final sketch size when BLE library is not used.

In the current situation, creation a little more advanced programs with BLE and for e.g. display, becomes impossible due to lack of space.

Sketch:

library: BLE -> example: BLE_uart

@beegee-tokyo
Copy link
Contributor

The Bluetooth stack is very large. You need to change you partition sizes as shown in the Wiki.

@reaper7
Copy link
Contributor Author

reaper7 commented Mar 8, 2018

@beegee-tokyo - tnx! this is a option but...
...it's looks like these two libraries use two separate bluetooth stacks?

@beegee-tokyo
Copy link
Contributor

I do not know if there are two different stacks for BLE and Bluetooth, because that is somewhere down below in the ESP-IDF. But I started with using BLE only first and added Bluetooth Serial later (check my blog) the program size didn't double, so I guess there is only one stack.

@reaper7
Copy link
Contributor Author

reaper7 commented Mar 8, 2018

In that case, if only one stack, who eats ~157k ? new libbt.a from sdk?

I check this on raw example from library BLE->BLE_Server as-is (without any addition like SerialBT)
current master branch and earlier branch from 5 march 2018 "Add BluetoothSerial library" b4b9a79
generate output files with ~1085890bytes
while the previous branches (until 4 march 2018) generate output files with ~929130bytes

in my opinion it is a very large increase
but if this is not a bug, then only way is a increase partition size for app

BTW. @beegee-tokyo, great blog, very useful

@jjoe64
Copy link

jjoe64 commented Jun 8, 2018

Hi all, I faced the same issue and did not found a easy solution, so I finally forked the library and create a "light version" of it.
Only the BLE server will work. This is a fork of the official esp32 ble library and is stripped to decrease the size. It is only possible to use the ble server features.

I saved about ~30KB program size with this version.

https://github.com/jjoe64/esp32_ble_light

@JoanMCD
Copy link

JoanMCD commented Aug 22, 2018

You can save ~10k by remove the long Mode / Vendor / ... String lists in the BThelp.c (or move it to a seperate .c Files)

Also you can save ~47kb (Wow!) of ram by release the classic BT ram if not needed.

Or use the idf direct and save a lot RAM/ROM, have less bugs but also less comfort.

@aravindara
Copy link

when i do that my program is compiling with errors

@stale
Copy link

stale bot commented Aug 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 1, 2019
@stale
Copy link

stale bot commented Aug 15, 2019

This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

5 participants