Espressif ESP32-S2 Programming Manual page 1406

Table of Contents

Advertisement

Chapter 4. API Guides
By expanding threads you can navigate throughout the application. Expand Thread #5 that contains much longer call
stack. You will see there, besides function calls, numbers like 0x4000000c. They represent addresses of binary
code not provided in source form.
Fig. 28: Navigate through the call stack
In another window on right, you can see the disassembled machine code no matter if your project provides it in source
or only the binary form.
Go back to the app_main() in Thread #1 to familiar code of blink.c file that will be examined in more details
in the following examples. Debugger makes it easy to navigate through the code of entire application. This comes
handy when stepping through the code and working with breakpoints and will be discussed below.
Setting and clearing breakpoints
When debugging, we would like to be able to stop the application at critical
lines of code and then examine the state of specific variables, memory and registers / peripherals. To do so we are
using breakpoints. They provide a convenient way to quickly get to and halt the application at specific line.
Let's establish two breakpoints when the state of LED changes. Basing on code listing above, this happens at lines
33 and 36. To do so, hold the "Control"on the keyboard and double clink on number 33 in file blink.c file. A
dialog will open where you can confirm your selection by pressing"OK"button. If you do not like to see the dialog
just double click the line number. Set another breakpoint in line 36.
Information how many breakpoints are set and where is shown in window"Breakpoints" on top right. Click"Show
Breakpoints Supported by Selected Target" to refresh this list. Besides the two just set breakpoints the list may contain
temporary breakpoint at function app_main() established at debugger start. As maximum two breakpoints are
allowed (see
Breakpoints and watchpoints
available), you need to delete it, or debugging will fail.
If you now click "Resume"(click blink_task() under "Tread #8", if "Resume"button is grayed out), the
processor will run and halt at a breakpoint. Clicking "Resume"another time will make it run again, halt on second
breakpoint, and so on.
Espressif Systems
1395
Release v4.4
Submit Document Feedback

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF