Hello
I have a project that uses an ESP32 Devkit v2.
Programmed it (work in progress) and tonight when I went to continue using programming it, it now boot loops and never reaches the setup.
rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4832
load:0x40078000,len:16460
load:0x40080400,len:4
load:0x40080404,len:3504
entry 0x400805cc
E (553) esp_image: Image length 1723008 doesn't fit in partition length 1310720
E (553) boot: OTA app partition slot 0 is not bootable
E (554) boot: No bootable app partitions in the partition table
ets Jul 29 2019 12:21:46
No idea what has changed.
I have to upload with the Partition set to 'Huge App' because the Bluetooth library takes an insane amount of memory.
And its the Bluetooth that seems to be the issue.
If I strip out all the Bluetooth code in the routine, it still boot-loops.
But stops when I remove the initial: BluetoothSerial SerialBT; declaration at the start.
Can anyone tell from the error code what the problem might be (and why it's suddenly appeared). It did work fine for a few weeks.
Doesn't appear to be a power issue. No brownout warning and the supply seems fine.
Odd
It looks like this might be a flash issue.... seems to upload if I set flash to 4Mb
ESP32 memory is divided into two partitions: one for the application code and the other for SPIFFS (SPI Flash File storage), now superseded by LittleFS. If you are using WiFi, this file system allows files that will be served as web pages or used for configuration to be uploaded to the ESP for use by your sketch. How that memory is divided is configurable.
By default 1.2Mb (1280kb) is allocated to program storage, the remaining 1.5Mb (1520kb) is used for SPIFFS/LittleFS.
The error message actually explains what happened:
It just so happens that 1310720 bytes is a representation of 1280kb (multiply by 1024). The compiled code grew to 1723008 bytes or 1.7Mb and was therefore too big to fit into a space of just 1.2Mb. By setting the partition scheme to Huge App, this will have allocated 3Mb to program memory, and reduced the memory available to SPIFFS/LittleFS to 1Mb, thereby providing sufficient memory space for your program.
As you have observed, the Bluetooth library is rather big and the #include directive at the beginning of your code is what includes that library code in the total compiled code. Removing Bluetooth related sections from your sketch will have some effect, but removing the #include directive at the beginning of the sketch is what prevents this rather large library from being included in the compiled code.
Perhaps you added another library or a large array in Progmem, but something was added to the sketch that caused the compiled code to grow beyond the capacity that was available.