looking for a smaller esp32 bluetooth library OR more memory

i recently tried adding a Bluetooth serial interface to my code and exceeded the esp32 prog mem space.

the found that the SerialtoSerialBT example requires 864k bytes or 65% of memory.

while the .o files add up to 148k in my code, the elf file is 582k with WiFi

i'm hoping someone can point me to a smaller bluetooth library or some other solution, potentially processor board with more memory but also WiFi and bluetooth.

just realized this may not be the best forum to post this (feel free to move)

You could try using the ESP-IDF C API directly: SPP API - ESP32 - — ESP-IDF Programming Guide latest documentation.

Edit: This might be obvious, but have you tried disabling OTA and SPIFFS? (Tools > Partition Scheme in the IDE)

Pieter

thanks

gcjr:
just realized this may not be the best forum to post this (feel free to move)

I dont think the mods are able to move the posts across to the Expressif forums.

Do update everyone if you find a much smaller Bluetooth library.

What is going on here? I have an ESP32 development board (Heltec) but I have never used it. It never occurred to me that I would need a library to run the on-board Bluetooth. I feel I am being left behind by all this...

Hey there,

I don't have any smaller sized bluetooth library, but have a solution.

You should go in the library folder, and find that bluetooth library. Find the .h and .cpp files. Copy them to a safe place (It is a backup). Open the .h and .cpp files (from the library and not backup) in two notepads. Find the functions that you don't use in your code. Find them in both the .h and .cpp file. And delete the function in the .h and .cpp file. You can delete multiple functions if you want. Then save the files in their places, and try programming the board again. The code might take less space now.

Now if you want to get the original libraries again, so find your backup files, and replace them in their first place.

..Arnav

Pieter, Arnav

thanks for the thoughts. both will need some work and when i'm in the right frame of mind will look into them. of course i don't want to become an expert in either

it appears that only 1/3 of the 4mb of flash memory is available for the sketch on the esp32. Another 1/3 is reserved for over the air (OTA) programming and a 1/3 for SPIFF.

it appears these partitions can be changed and it looks like that’s a quick and possibly appropriate solution

Yes, that's what I referred to here, I should probably have been more explicit :

PieterP:
This might be obvious, but have you tried disabling OTA and SPIFFS? (Tools > Partition Scheme in the IDE)

ArnavPawarAA:
Hey there,

I don't have any smaller sized bluetooth library, but have a solution.

It is my understanding that only the functions within a library that are used by the sketch are compiled into the program in the same way that any functions that you write in your sketch but do not call are not compiled into the program

Your advice to edit the library is, therefore, wrong