[Feature Request] Support uploading via JTAG to devices with 8MB or 16MB of flash
Environment
- Development Kit: ESP32-DEVKITC-VE
- Module or chip used: ESP32-WROVER-E (8MB or 16MB)
- Debug Adapter: ESP-PROG, Segger J-Link
- Operating System: All
- IDE: Visual Studio Code 1.63, PlatformIO Core 5.2.3
- platform-espressif32 version: 3.4.0
Problem Description
When developing for ESP32 modules that have more than 4MB of flash memory, such as the 8MB or 16MB WROVER modules, it would be very useful to be able to use a JTAG debugger such as the ESP-PROG or Segger J-Link to upload code and perform inline debugging. Presently, it is only possible to do this when using a 4MB partition table.
If an 8MB or 16MB partition table is used with an 8MB or 16MB ESP32 module, attempting to upload or debug with a JTAG device will result in the ESP32 module crashing and rebooting. This is because the pre-built bootloaders in the Arduino ESP32 core are by default configured for 4MB of flash. When uploading code using the serial port and esptool, this is not a problem because esptool automatically alters the bootloader header image to comply with the detected amount of flash (reference: https://github.com/espressif/openocd-esp32/issues/184#issuecomment-990293128). When uploading via JTAG with OpenOCD, the bootloader is not changed and so you have a 4MB bootloader with an 8MB or 16MB partition table which results in the crash/reboot loop.
Desired Behavior
The PIO platform for ESP32 should incorporate a similar feature to esptool that alters the bootloader header image to comply with the amount of flash on the module or the size of the partition table. From a user perspective this could be implemented as a setting in platformio.ini perhaps.
Thanks for looking!