ESP boot partitions overlap error - help with compiler config options

Hi everyone, this is probably a stupidly simple thing to fix but it’s doing my head in and have spent hours going through this forum and others looking for a solution.

I’ve inherited a ESP-IDF project that is working and am porting over to platformio. I can get the code to compile in platformio (thank you to this community for help here!)

Now I’m trying to upload and get the following error (renaming project to protect anonymity):

esptool write_flash: error: argument <address> <filename>: Detected overlap at address: 0x8000 for file: /Users/pinchy/Documents/PlatformIO/Projects/project/.pio/build/project/partitions.bin

I’m using a partitions table:

nvs,      data, nvs,     ,  0x6000
phy_init, data, phy,     ,  0x1000
factory,  app,  factory, , 1M

have also tried the following table:

nvs,      data, nvs,     ,  0x6000
phy_init, data, phy,     ,  0x1000
factory,  app,  factory, 0x10000, 1M

And here’s my platformio.ini file:

[env:project]
boards_dir = boards
board = project
platform = https://github.com/platformio/platform-espressif32.git
framework = espidf
board_build.embed_files = src/error.mp3
board_build.partitions = partitions.csv
build_flags ="-D CONFIG_PARTITION_TABLE_OFFSET=0x10000"

And here’s the esptool.py call:
"/Users/pinchy/.platformio/penv/bin/python" "/Users/pinchy/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp32 --port "/dev/cu.usbserial-FTAR8L7D" --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /Users/pinchy/Documents/PlatformIO/Projects/project/.pio/build/project/bootloader.bin 0x8000 /Users/pinchy/Documents/PlatformIO/Projects/project/.pio/build/project/partitions.bin 0x10000 .pio/build/project/firmware.bin

I can see that although I’ve been trying various arguments in platformio.ini, the esptool is still loading the bootloader at 0x8000 (default) rather than what I want it to; 0x10000.

any ideas what I’m doing wrong?

What is the size of the bootloader, starting at 0x1000? Maybe it overflows into 0x8000. It can be at maximum 28672 bytes long for that.

ls -la /Users/pinchy/Documents/PlatformIO/Projects/project/.pio/build/project/bootloader.bin

gives what?

Still experimental bleeding edge stuff so errors are inevitible :sweat_smile:

Mate you’re everywhere! Thank you for your help :slight_smile:

Here’s all the bin files:

-rw-r--r--  1 pinchy  staff   28736 16 Mar 14:54 bootloader.bin
-rw-r--r--  1 pinchy  staff  841120 16 Mar 14:53 firmware.bin
-rw-r--r--  1 pinchy  staff    3072 16 Mar 14:51 partitions.bin

Yep! Hoping that my (and your!) efforts help others too, I love PIO and ESP, I really want them to play nice!

ETA:
I was able to manually call the esptool in command line and changed the partitions.bin to 0x10000 and firmware.bin to 0x12000 and it built and uploaded. (Of course the device didn’t work because the partitions table is now out of sync). I can’t figure out how within the platformio environment to modify these positions. Creating an sdkconfig.defaults file with the appropriate entires doesn’t seem to be read in, my sdkconfig file is overwritten each time i build. hmmmm

Well 28736 is more than the maximum allowed 0x8000 - 0x1000 = 28672. Now there are several possibilities:

  • if the bootlaoder is compiled during project compilation and not pregiven, somehow the compilere produces a too-large output
  • if the bootloader taken from a precompiled file, then surely the loading addresses must have been changed for IDF-v4, because then the overlap is inevitble. Then the partitions.bin address can’t be at 0x8000 because the bootloader starting at 0x1000 and length 0x7040 collides with it by 0x40 bytes.

Do you have a reference upload for the firmware in normal ESP-IDF? What’s the flashing command there, and the size of the bootloader?

Ok, managed to get it working. The handover I got said to use a single app partition, however the menuconfig sdkdefaults were for a dual OTA setup. So compiling a single app partition like I was, was never going to work. PIO was taking the sdkdefaults and running with it, ignoring my partition file and build flags.

Running idf.py menuconfig and correcting the sdkdefaults (single partition) worked.

Thanks heaps for your help @maxgerhardt