ESP32 Bare Metal Programming / Debugging with JTAG
Posted: Sat Nov 13, 2021 9:23 am
Hi,
I already have some experience with flashless Microctrontrollers like the ESP32. For example I know quite well the NXP IMXRT1051. I develop on the IMXRT so that I load the code image into the RAM and as the code starts writes itself to the QSPI flash for the permanent storage. I applied this technique on a STM32G473 too.
I know that using ESP32 without IDF is much more initial work, and I would never get the Wifi or the Bluetooth working, but for simpler tasks it would be fine.
I've spent the last two days figuring out if such a development method is possible on the ESP32 too. I made a very simple test application to test it (I'll attach it to this post). I can load it into the RAM to the address 0x40090000, data RAM is at 0x3FFF0000.
Unfortunately the openocd does not set the entry point, so I have to include the GDB command manually: "j _start"
Then it runs, I can pause and continue the execution, step instructions, check disassembly.
But breakpoints do not work. If I set a breakpoint, the execution does not stop there. This is crucial for me, and I would not invest more time to ESP32 development until this kind JTAG development works properly.
I tested Eclipse CDT on Ubuntu 20.04. I've also tried the Eclipse CDT on Windows 10.
The JTAG adapter is: interface/ftdi/dp_busblaster.cfg
Maybe I'm missing some setting.
If someone has a properly set up ESP32 development environment, please try this out. The code is so small that I can include it here:
main.cpp:
I've made a linker script for that, it is found in the .
I hope that this JTAG based development works fully and I just have only a wrong or missing setting somewhere.
br.
nvitya
I already have some experience with flashless Microctrontrollers like the ESP32. For example I know quite well the NXP IMXRT1051. I develop on the IMXRT so that I load the code image into the RAM and as the code starts writes itself to the QSPI flash for the permanent storage. I applied this technique on a STM32G473 too.
I know that using ESP32 without IDF is much more initial work, and I would never get the Wifi or the Bluetooth working, but for simpler tasks it would be fine.
I've spent the last two days figuring out if such a development method is possible on the ESP32 too. I made a very simple test application to test it (I'll attach it to this post). I can load it into the RAM to the address 0x40090000, data RAM is at 0x3FFF0000.
Unfortunately the openocd does not set the entry point, so I have to include the GDB command manually: "j _start"
Then it runs, I can pause and continue the execution, step instructions, check disassembly.
But breakpoints do not work. If I set a breakpoint, the execution does not stop there. This is crucial for me, and I would not invest more time to ESP32 development until this kind JTAG development works properly.
I tested Eclipse CDT on Ubuntu 20.04. I've also tried the Eclipse CDT on Windows 10.
The JTAG adapter is: interface/ftdi/dp_busblaster.cfg
Maybe I'm missing some setting.
If someone has a properly set up ESP32 development environment, please try this out. The code is so small that I can include it here:
main.cpp:
Code: Select all
volatile unsigned g_cnt = 0;
volatile unsigned g_cnt2 = 0;
volatile unsigned g_cnt3 = 0;
extern "C"
void _start(void)
{
g_cnt = 1;
g_cnt2 = 2;
g_cnt3 = 3;
while (1)
{
++g_cnt;
++g_cnt2;
++g_cnt3;
}
}
I hope that this JTAG based development works fully and I just have only a wrong or missing setting somewhere.
br.
nvitya