There was a previous thread on this subject that closed without a clear solution. I run out of program memory when I try to add bluetooth to my LoRa app which also uses WiFi. There is insufficient program space for both WiFi and BT. I noticed that the addition of the existing bluetooth library increases the size of program code by a whopping 500KB. Since the ESP32 has a built in BT module that I would imagine has the BT heavy lifting code in ROM space I wonder why the library is so memory hungry?
Does anyone here know why it uses so much space? I wonder if the BLE capability is what consumes the majority of the space? I just need standard BT which I imagine should mainly use calls to the BT API that is probably provided by the BT module.
Anyway, what are you hoping for? The Arduino core is only a wrapper around the Espressif API's. Would knowing the reason really help, if you can't rewrite the Espressif code (which must be titanic in scope and size).
Designers hesitate to put software stacks in ROM - then they can't be updated.
I read somewhere that the ESP32 built in BT is somewhat similar to the HC-0x modules which I have implemented in the past with an Android Nano with very little code overhead. So yes I guessed that the ESP32 BT implementation would be similar as opposed to a feature that would gobble up orders of magnitude more program space. Makes me wonder if the bulge is due to the BTLE mode capability although I now have the impression that I have probably only implemented regular BT mode. I was hoping to discover the existence of a scaled down BT library. It would be nice to find a specification for the BT library just to confirm that the 500KB code size that I have noticed is normal according to specs.
I'm working on a Bluetooth project that uses the A2DP protocol to receive streaming audio from a smartphone. I'm pretty sure the HC0x devices don't support that. Bluetooth and BLE are huge systems.
Dump the library and try "NimBLE." in my cases, it is about 70% smaller. Active development. It has worked well for up. I think it is now in the arduino library system.
You folks have given me some new options to review and consider. Many thanks All for the enlightening info!
My LoRa application just transfers very short lines of text. Thus relatively simple compared to streaming applications, big file transfers, etc.
Sounds like NimBLE might be what I need as I think 150KB should fit - it never occurred to me that the BLE library might be a better fit for my application. But as standard BT has overhead to support heavy duty data transfer applications and BLE intended for small data transfers it does make sense.
The app does build OK if I eliminate WiFi but I would like to include it if possible so that I can access the LoRa node telemetry ADC data wirelessly via my LAN.
Thanks for the API spec URL! At first glance just using the API commands given in the spec directly might be all that I need to use for my simple short data message application. I need to spend some time looking at the commands.