Question about esp32 Flash download through JTAG
Re: Question about esp32 Flash download through JTAG
Huh, im already programming my esp32 through jtag. This way i can keep my serial connection alive =D. Im using visualgdb and that plugin handles that process, i will post a gdb session output and openocd output friday if you wanna see it.
-
- Posts: 3
- Joined: Tue Feb 07, 2017 1:09 pm
Re: Question about esp32 Flash download through JTAG
Thanks.f.h-f.s. wrote:Huh, im already programming my esp32 through jtag. This way i can keep my serial connection alive =D. Im using visualgdb and that plugin handles that process, i will post a gdb session output and openocd output friday if you wanna see it.
In that case I'm waiting for Friday
Re: Question about esp32 Flash download through JTAG
The OpenOCD output when flashing the esp32 through jtag in VisualGDB https://pastebin.com/iJ47jQZZ
The GDB output https://pastebin.com/cGiTxw1d
I guess it is restoring a .bin to a specific location in memory, which results in the same end result programming the esp32.
The GDB output https://pastebin.com/cGiTxw1d
I guess it is restoring a .bin to a specific location in memory, which results in the same end result programming the esp32.
Code: Select all
restore C:/IoT/BEASTv2/VisualGDB/Debug/BEASTv2-esp32.bin binary 0x3ffc0004 0x0 0x10000
&"restore C:/IoT/BEASTv2/VisualGDB/Debug/BEASTv2-esp32.bin binary 0x3ffc0004 0x0 0x10000\n"
Restoring binary file C:/IoT/BEASTv2/VisualGDB/Debug/BEASTv2-esp32.bin into memory (0x3ffc0004 to 0x3ffd0004)
Re: Question about esp32 Flash download through JTAG
VisualGDB can't program the flash memory. It's only possible to write into the internal RAM. The messages indicates that all the binary data was written into "memory". That's the RAM memory. After cycling the power all data that was restored will be lost. If you look into the memory map in the datasheet http://espressif.com/sites/default/file ... ual_en.pdf you will find that the addresses are all in the embedded RAM.
If you try to write to the flash area via JTAG you will get the error:
Programming the flash is currently not possible with the JTAG interface! Hopefully the people from Espressif will write the piece of code that will allow us to program the flash area via JTAG.
If you try to write to the flash area via JTAG you will get the error:
Code: Select all
Error: esp32.cpu0: xtensa_write_memory (line 1024): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : esp32.cpu0: Failed writing 4096 bytes at address 0x3F401010
Re: Question about esp32 Flash download through JTAG
I have never noticed losing the firmware after a power cycle. I'll test it out, but I think you are wrong.
I am unable to reproduce the programming through jtag using esp-idf and openocd-esp32.
Maybe because Sysprogs made a fork of openocd-esp32 for VisualGDB, thus a modified OpenOCD. https://github.com/sysprogs/openocd-esp32
Edit
They have added their own code for restoring data, im guessing thats done by which is defined in esp108.c:1901 esp108_cmd_run_alg
I am unable to reproduce the programming through jtag using esp-idf and openocd-esp32.
Maybe because Sysprogs made a fork of openocd-esp32 for VisualGDB, thus a modified OpenOCD. https://github.com/sysprogs/openocd-esp32
Edit
They have added their own code for restoring data, im guessing thats done by
Code: Select all
mon esp108 run_alg
-
- Posts: 14
- Joined: Sun Jan 03, 2016 12:15 am
Re: Question about esp32 Flash download through JTAG
May I get an updated timeline for JTAG flash?
Also I am curious about changing the registers and variable values while running "make monitor", is that possible through current JTAG debugging process?
Thank you,
Beck
Also I am curious about changing the registers and variable values while running "make monitor", is that possible through current JTAG debugging process?
Thank you,
Beck
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
Re: Question about esp32 Flash download through JTAG
Flashing over JTAG is now implemented in official openocd-esp32 distribution - https://github.com/espressif/openocd-es ... 878cfa5dfeBeck-Sisyphus wrote:May I get an updated timeline for JTAG flash?
Re: Question about esp32 Flash download through JTAG
Can anyone give an example how to program over JTAG?
I have Espressif's openocd running on my mac using a JLINK and debugging works. Openocd is launched with this .cfg:
I can telnet into openocd on port 4444 and tried this:
gives the same error.
Also:
But I'm sure I'm missing something here.
I have Espressif's openocd running on my mac using a JLINK and debugging works. Openocd is launched with this .cfg:
Code: Select all
source [find interface/jlink.cfg]
source [find target/esp32.cfg]
adapter_khz 1000
Code: Select all
MacBook-Pro:esp32 joostn$ telnet localhost 4444
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> program /Users/joostn/GitProjects/ucprojects/projects/s20socketesp32/esp32/build/s20socketesp.elf
JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
esp32.cpu0: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
esp32.cpu0: Core was reset (pwrstat=0x5F, after clear 0x0F).
esp32.cpu0: Target halted, pc=0x5000004B
esp32.cpu0: target state: halted
esp32.cpu1: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
esp32.cpu1: Core was reset (pwrstat=0x5F, after clear 0x0F).
esp32.cpu0: Core was reset (pwrstat=0x1F, after clear 0x0F).
esp32.cpu0: Target halted, pc=0x40000400
esp32.cpu0: target state: halted
esp32.cpu1: Core was reset (pwrstat=0x1F, after clear 0x0F).
esp32.cpu1: Target halted, pc=0x40000400
esp32.cpu1: target state: halted
** Programming Started **
embedded:startup.tcl:454: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 510
at file "embedded:startup.tcl", line 454
Code: Select all
> program /Users/joostn/GitProjects/ucprojects/projects/s20socketesp32/esp32/build/s20socketesp.bin 0x10000
Also:
Code: Select all
> flash probe 0
invalid subcommand "probe 0"
in procedure 'flash'
Re: Question about esp32 Flash download through JTAG
Please see http://esp-idf.readthedocs.io/en/latest ... -debugging
The thing is that you can't use 'program' with an ELF file. ESP32 bootloader needs to see a binary image in specific format, and this format is generated using esptool.py. OpenOCD does not know (yet) how to generate such a format from an ELF file. So you need to use .bin file for programming. There is a special command 'program_esp32' to do that.
The thing is that you can't use 'program' with an ELF file. ESP32 bootloader needs to see a binary image in specific format, and this format is generated using esptool.py. OpenOCD does not know (yet) how to generate such a format from an ELF file. So you need to use .bin file for programming. There is a special command 'program_esp32' to do that.
Re: Question about esp32 Flash download through JTAG
Thanks! Somehow I completely overlooked that page.
Flashing somewhat works, but only after it fails once with error:
Error: xtensa_wait_algorithm: not halted 0, pc 0x4009113b, ps 0x60021
Then the second attempt succeeds.
This is in my makefile:
Flashing somewhat works, but only after it fails once with error:
Error: xtensa_wait_algorithm: not halted 0, pc 0x4009113b, ps 0x60021
Then the second attempt succeeds.
Code: Select all
MacBook-Pro:esp32 joostn$ make app-flash-openocd
App built. Default flash app command is:
python /Users/joostn/GitProjects/ucprojects/esp32/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/cu.wchusbserial1410 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 /Users/joostn/GitProjects/ucprojects/projects/s20socketesp32/esp32/build/s20socketesp.bin
Open On-Chip Debugger 0.10.0-dev-g4106faa5 (2017-08-07-13:12)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
force hard breakpoints
adapter speed: 5000 kHz
Info : No device selected, using first device.
Info : J-Link V9 compiled Jan 10 2014 19:51:25
Info : Hardware version: 9.00
Info : VTarget = 3.333 V
Info : clock speed 5000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x400076DD
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
esp32: target state: halted
Info : esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
esp32: target state: halted
** Programming Started **
auto erase enabled
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active) APP_CPU: PC=0x400076DD
Info : Auto-detected flash size 4096 KB
Info : Using flash size 4096 KB
Info : Use core0 of target 'esp32'
Error: timed out while waiting for target halted / 4 - 2
Info : Target halted. PRO_CPU: PC=0x4009113B (active) APP_CPU: PC=0x400076DD
Error: xtensa_wait_algorithm: not halted 0, pc 0x4009113b, ps 0x60021
Error: Faied to wait algorithm (0)!
Error: Algorithm run faied (-302)!
Error: failed erasing sectors 16 to 173
embedded:startup.tcl:454: Error: ** Programming Failed **
in procedure 'program_esp32'
in procedure 'program_error' called at file "/Users/joostn/GitProjects/ucprojects/esp32/openocd_esp32_singlecore/tcl/target/esp32.cfg", line 149
at file "embedded:startup.tcl", line 454
make: *** [app-flash-openocd] Error 1
MacBook-Pro:esp32 joostn$ make app-flash-openocd
App built. Default flash app command is:
python /Users/joostn/GitProjects/ucprojects/esp32/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/cu.wchusbserial1410 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 /Users/joostn/GitProjects/ucprojects/projects/s20socketesp32/esp32/build/s20socketesp.bin
Open On-Chip Debugger 0.10.0-dev-g4106faa5 (2017-08-07-13:12)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
force hard breakpoints
adapter speed: 5000 kHz
Info : No device selected, using first device.
Info : J-Link V9 compiled Jan 10 2014 19:51:25
Info : Hardware version: 9.00
Info : VTarget = 3.335 V
Info : clock speed 5000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : Target halted. PRO_CPU: PC=0x4009113B (active) APP_CPU: PC=0x400076DD
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
esp32: target state: halted
Info : esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
esp32: target state: halted
** Programming Started **
auto erase enabled
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active) APP_CPU: PC=0x400076DD
Info : Auto-detected flash size 4096 KB
Info : Using flash size 4096 KB
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active) APP_CPU: PC=0x400076E2
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active) APP_CPU: PC=0x400076DD
wrote 647168 bytes from file build/s20socketesp.bin in 12.279594s (51.467 KiB/s)
** Programming Finished **
** Verify Started **
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active) APP_CPU: PC=0x400076E2
read 646320 bytes from file build/s20socketesp.bin and flash bank 0 at offset 0x00010000 in 8.956639s (70.470 KiB/s)
contents match
** Verified OK **
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
esp32: target state: halted
Info : esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
esp32: target state: halted
** Programming Started **
auto erase enabled
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active) APP_CPU: PC=0x400076E0
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active) APP_CPU: PC=0x400076E2
wrote 8192 bytes from file /Users/joostn/GitProjects/ucprojects/0xff_8192.bin in 2.497203s (3.204 KiB/s)
** Programming Finished **
** Verify Started **
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active) APP_CPU: PC=0x400076DD
read 8192 bytes from file /Users/joostn/GitProjects/ucprojects/0xff_8192.bin and flash bank 0 at offset 0x0000d000 in 0.928127s (8.620 KiB/s)
contents match
** Verified OK **
shutdown command invoked
Code: Select all
app-flash-openocd: app
$(OPENOCDPATH)/openocd -s $(OPENOCDPATH)/tcl -f $(OPENOCDPATH)/joost_esp32_jink.cfg -c "program_esp32 build/s20socketesp.bin 0x10000 verify" -c "program_esp32 $(UCPROJECTS)/0xff_8192.bin 0xd000 verify exit"
Who is online
Users browsing this forum: No registered users and 178 guests