Bluetooth Module overflows maximun Flash size

JorgeSayMe
Posts: 7
Joined: Mon Feb 17, 2020 4:40 pm

Bluetooth Module overflows maximun Flash size

Postby JorgeSayMe » Fri Jul 24, 2020 9:07 am

Good morning.

My name is Jorge and I am a Firmware developer for Sayme Corp.

I am programming an IoT Device based on an ESP32 WROOM 32D. The functions of the ESP32 are:
1) Use it as a microcontroller
2) Scan Wi-Fi networks.
3) Scan BLEs

I am developing the application with PlatformIO.
A month ago, ESP32 IDF was updated and the Bluetooth libraries didn´t work (compilation, libraries not found, ...)
due to changing the path for these libraries.

I saw on these forums that now Bluetooth module needs to be enabled on menuconfig (pio run -t menuconfig)

However, after the ESP32 IDF updates, my code has surpassed the maximum limit.

When I don't use Bluetooth and Wifi libraries my code needs this size:
Linking .pio\build\esp32dev\firmware.elf
Retrieving maximum program size .pio\build\esp32dev\firmware.elf
Checking size .pio\build\esp32dev\firmware.elf
Building .pio\build\esp32dev\firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 4.1% (used 13400 bytes from 327680 bytes)
Flash: [== ] 20.0% (used 209941 bytes from 1048576 bytes)
esptool.py v2.6

When I enable my Wi-Fi library (that doesn´t depend of menuconfig) the Flash size increases
Linking .pio\build\esp32dev\bootloader.elf
Linking .pio\build\esp32dev\firmware.elf
Building .pio\build\esp32dev\firmware.bin
Retrieving maximum program size .pio\build\esp32dev\firmware.elf
Checking size .pio\build\esp32dev\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 12.4% (used 40740 bytes from 327680 bytes)
Flash: [======= ] 67.2% (used 704526 bytes from 1048576 bytes)
esptool.py v2.6

This happens also when I enable Bluetooth library and I don´t enable Wi-Fi library

But when I use my BLE and my Wi-Fi libraries and I enable Bluetooth on menuconfig:
Linking .pio\build\esp32dev\bootloader.elf
Linking .pio\build\esp32dev\firmware.elf
Retrieving maximum program size .pio\build\esp32dev\firmware.elf
Checking size .pio\build\esp32dev\firmware.elf
Building .pio\build\esp32dev\firmware.bin
Error: The program size (1155850 bytes) is greater than maximum allowed (1048576 bytes)
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [== ] 21.3% (used 69688 bytes from 327680 bytes)
*** [checkprogsize] Explicit exit, status 1
Flash: [==========] 110.2% (used 1155850 bytes from 1048576 bytes)

The Flash overflows. This behavior didn´t happen after updating ESP-IDF.

Why now am I experimenting this behavior?

Also, VSCode doesn´t know how to open the following includes:
#include "esp_bt.h"
#include "esp_bt_main.h"
#include "esp_gap_ble_api.h"

There is something that I am doing wrong?

ESP_Sprite
Posts: 3937
Joined: Thu Nov 26, 2015 4:08 am

Re: Bluetooth Module overflows maximun Flash size

Postby ESP_Sprite » Fri Jul 24, 2020 9:09 pm

I have no clue about PlatformIO, as we don't develop that, but in general you probably want to change the size of the partitions on your flash. (In esp-idf, you can select a custom csv file that defines how much of your flash is reserved for your program, OTA, file systems etc.)

Who is online

Users browsing this forum: Google [Bot] and 25 guests