-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JTAG ESP32 Failed to get flash mappings (Flashing Failed) (OCD-544) #223
Comments
@littleboot Thanks for the great explanation. I saw the issue. In order to speed up the download process from jtag, target cpu clock frequency is set to the highest possible value in the stub flasher code. Looks like this operation breaks something when rmt driver is enabled. We will look at it later on. But until we find the root cause you can use the attached OpenOCD master built for your test. openocd-esp32-win32-0.11.0-esp32-20211220-1339-g187c87957.zip |
Thank you very much, this build fixes the problem! I tested the OpenOcd build first using the command line according to the instructions . Launching OpenOcd
Success: no problems Flashing
Success: no problems Update OpenOcd in Eclipse: Changed open OCD path in eclipse Success: No problems, I can flash the firmware using JTAG over and over without issues. |
I'm similar issues, but when starting a debug session. I've downloaded the Openocd version from above and this is what I'm getting when starting openocd on the command prompt:
|
@josesimoes please use the scripts from the new built directory. |
@erhankur can you please point me to that "new built directory"? Where can I find it? Are you referring to the "build" directory that's created when building? |
I meant use scripts from the directory We also updated all deprecated scripts. So you need to point them in your openocd command. |
@erhankur OK that works. Thanks! |
Fix added to the latest release |
Problem description
After specific a specific firmware is flashed, loaded and working without any issues trying to flash the same or other firmware fails. The firmware in question does not touch any of the JTAG or bootstrap GPIO's. I'm certain its not a hardware issue, other firmware can be flashed and reflashed without issues. Only when the wifi provisioning code is added to the project JTAG breaks. To be able to flash over JTAG again the flash needs to be erased using the "flash erase" which using the serial bootloader which requires the serial interface to be connected (It would be a great feature to be able to erase the flash using the JTAG interface).
System properties
Firmware description
The firmware in question is a modified "wifi_prov_mgr" example.
The only modifications are the addition of very simple RMT Led driver code.
All modifications (addition of some code) can be viewed easilly looking at the GIT commits.
The addition does not touch any of the JTAG or Bootstrapping GPIO's.
Hardware
Part of OpenOcd log -d2 were it begins to fail
It looks like OpenOcd is not able to get the flash size and fail when it tries using 0KB.
Full logs and the firmware sources are provided at the end of this issue report.
Steps to reproduce
Open the provided firmware repo (see end of issue report) or perform the modifications manually. Flash this firmware over JTAG, observe that it succeeds. Observe that the apllication is working without any apparent issues. Try flashing over JTAG again. Observe that it fails to do so.
Firmware modifications
I describe here how I modified the "wifi_prov_mgr" example to get it to break JTAG flashing.
In addition I will highlight an additional issue with the example project in eclipse. Note that no modification are made to the code at this point (this is not the focus of this issue report but I would love to have a solution for this if possible).
The steps I took can be traced using the GIT commits included in the repo.
Open eclipse ide with IDF plugin and create a project based on the example "wifi_prov_mgr"
File->new->Espressif IDF project
Build project to verify toolchain is working (observe unrealed )
The project compiles without issues. However there is a problem listed in the problems tab:
Type 'size_t' could not be resolved
Somehow the eclipse indexer is not able to find the definition for "size_t".
Currently I supressing this error by the addition of:
Add
// @suppress("Type cannot be resolved")
to line 113 of app_main.c will supresses the warning but is not really a fix.Modifications to app_main.c
Note the modified code is avaible at the end of the issue report, this is for reference.
add the following code to the top of app_main.c:
add the following code to the bottom of app_main.c:
Add the following code inside
void app_main(void)
to the line before/* Wait for Wi-Fi connection */
OpenOcd Log files
db2 - fail tried flashing again.txt
db2 - succes wifi_prof_mgr without modifications.txt
db3 - fail wifi_prof_mgr plus RMT LED driver GPIO2.txt
db3 - fail wifi_prof_mgr plus RMT LED driver GPIO25.txt
Firmware repo
wifi_prov_mgr - Breaks JTAG flash.zip
The text was updated successfully, but these errors were encountered: