esp32_devkit debug in Macos Eclipse
https://github.com/espressif/idf-eclipse-pluginhttps://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/jtag-debugging/index.htmlhttps://github.com/espressif/idf-eclipse-plugin/blob/mast
https://github.com/espressif/idf-eclipse-plugin
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/jtag-debugging/index.html
https://github.com/espressif/idf-eclipse-plugin/blob/master/docs/OpenOCD%20Debugging.md
1. INSTALL THE ENVIRONMENT
1.1) Installing Prerequisites
The minimum requirements for running the IDF Eclipse plug-ins are:
-
Java 11 and above : Download and install Java SE from here
- Python 3.5 and above : Download and install Python from here
- Eclipse 2020-06 CDT : Download and install Eclipse CDT package from here
- Git : Get the latest git from here
- ESP-IDF 4.0 and above : Clone the ESP-IDF repo from here
Note: Make sure Java, Python and Git are available on the system environment PATH.
in MacOs, the default python is v2.7. set the command "alias python="/usr/local/bin/python3"" in .bash_profile
1.2) Installing IDF Plugin using update site URL
You can install the IDF Eclipse plugin into an existing Eclipse CDT installation using the update site URL. You first need to add the release repository URL as follows:
-
Go to
Help
->Install New Software
- Click
Add…
- Enter
Location
of the repository https://dl.espressif.com/dl/idf-eclipse-plugin/updates/latest/ - Enter
Name
asEspressif IDF Plugin for Eclipse
- Click
Ok
- Select
Espressif IDF
from the list and proceed with the installation
Note: Though screenshots are captured from
macOS
, installation instructions are applicable forWindows
,Linux
andmacOS
.
1.3) Installing ESP-IDF Tools
ESP-IDF requires some prerequisite tools to be installed so you can build firmware for the ESP32. The prerequisite tools include Python, Git, cross-compilers, menuconfig tool, CMake and Ninja build tools.
For this getting started guide, follow the instructions below.
- Navigate to
Help
>ESP-IDF Tools Manager
>Install Tools
- Provide the
ESP-IDF Directory
path - Provide
Git
andPython
executable locations if they are not auto-detected. - Click on
Install Tools
to proceed with the installation process. Check the Console for the installation details. - Installation might take a while if you're doing it for the first time since it has to download and install xtensa-esp32-elf, esp32ulp-elf, cmake, openocd-esp32 and ninja tools.
Note: Make sure you run this step even if you've already installed the required tools, since it sets the IDF_PATH, PATH, OPENOCD_SCRIPTS and IDF_PYTHON_ENV_PATH to the Eclipse CDT build environment based on the idf_tools.py export command.
ESP-IDF Directory selection dialog:
1.4) install ESP-IDF GDB OpenOCD Debugging tool (optional, esp prog is required)
n ESP-IDF GDB OpenOCD Debugging, both GDB server and GDB client both will be initiated by Eclipse, so no need to run anything from the command line.
Before you get started, please make sure you've already installed Embedded C/C++ OpenOCD Debugging
plugin while updating the IDF Eclipse Plugin.
2. Create/Import the Project
2.1) Create a new project
-
Make sure you are in
C/C++ Perspective
- Go to
File
>New
>Espressif IDF Project
(If you don't see this, please reset the perspective fromWindow
>Perspective
>Reset Perspective..
) - Provide the
Project name
- Click
Finish
Note: You will see a lot of unresolved inclusion errors in the editor and those will be resolved only after the build.
2.2) Create a new project using ESP-IDF Templates
- Make sure you're in
C/C++ Perspective
- Go to
File
>New
>Espressif IDF Project
(If you don't see this, please reset the perspective fromWindow
>Perspective
>Reset Perspective..
) - Provide the
Project name
- Click
Next
- Check
Create a project using one of the templates
- Select the required template from the tree
- Click
Finish
Note: You will see a lot of unresolved inclusion errors in the editor and those will be resolved only after the build.
2.3) Importing an existing IDF Project
-
Make sure you're in
C/C++ Perspective
. -
Right click in the Project Explorer
- Select
Import..
Menu - Select
Existing IDF Project
fromEspressif
import wizard menu list - Click
Next
- Click on
Browse...
to choose an existing project location directory - Provide
Project name
if you wish you have a different name - Click
Finish
to import the selected project into eclipse workspace as a CMake project
3. Configuration
3.1) Configuring Launch target
Next, we need to tell CDT to use the toolchain for our project so that all the headers will be indexed and resolved. This is accomplished through the Launch Bar, the new widget set you see on the far left of the toolbar. This will be shown only when you have a project in the project explorer.
-
Click on the third dropdown
- Select
New Launch Target
- Select
ESP Target
- Provide properties for the target where you would like to launch the application. Enter a
Name
for the target and select theSerial Port
your ESP device is connected to on your machine.
3.2) Config Flash Parameter
To provide the customized launch configuration and flash arguments, please follow the step by step instructions below.
- Click on the
Launch Configuration
edit button - Switch to the
Main
tab - Specify the
Location
where this application has to run. Sinceidf.py
is a python file, will configure the python system path. Example:${system_path:python}
- Specify
Working directory
of the application. Example:${workspace_loc:/hello_world}
- In additional arguments, provide a flashing command which will run in the specified working directory
- Flash command looks like this:
/Users/user-name/esp/esp-idf/tools/idf.py -p /dev/cu.SLAB_USBtoUART flash
- Click OK to save the settings
3.3) Create a new debug configuration
Please follow the below steps to create a new debug configuration.
-
Right-click on the project
Debug As > Debug Configurations...
This will launch a debug configuration window- On the left Panel, choose
ESP-IDF GDB OpenOCD Debugging
- Right Click and create
New Configuration
This will create a new debug configuration for your project
Please navigate through each tab and configure project specific settings.
NOTE: Most of the settings are auto-configured by the plugin.
if esp32_devkit with esp-wroom-32 are used, update the config options: board/esp32-wrover-kit-1.8v.cfg to board/esp-wroom-32.cfg
3.4) Configuring Environment Variables
in MacOs, the cmake located at /usr/local/bin/cmake. but /usr/local/bin is not defined in Eclipse PATH by default. following the step below to add it back.
Eclipse auto configures the required environment variables in the Preferences > C/C++ Build > Environment
section if IDF Tools are installed using Help
> ESP-IDF Tools Manager
> Install Tools
menu option.
4. BUILD, FLASH AND DEBUG
4.1) BUILD
-
Select a project from the Project Explorer
-
Select
Run
from the first drop-down, which is calledLaunch Mode
- Select your application from the second drop-down, which is called
Launch Configuration
(Auto-detected) - Select target from the third drop-down, which is called
Launch Target
- Now click on the
Build
button widget which you see on the far left of the toolbar
if the project is imported from aws esp demo code, it may fail to build. user have to use the command line to build the application(https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html)
4.2) FLASH
if 3.2(Config Flash Parameter) is configued. Click on the Launch
icon (In Run Mode) to flash the application to the selected board.
4.3) DEBUG
config the launch mode to Debug, config the launch config to 3.3(Create a new debug configuration ) debug config.
Click on the Launch
icon (In Debug Mode) to Debug the application in the selected board.
更多推荐
所有评论(0)