This contains a set of Eclipse plug-ins which extends Eclipse CDT to support application development on Zephyr RTOS, including building and target hardware debugging.
The minimum requirements for running the plugins are:
- Java SE 8 Update 212 or later
- Eclipse 2019-12 (4.14.0) with CDT 9.10.0
Also, please make sure the development host is setup to build Zephyr application by following the Getting Started guide.
The plugin can be installed via update sites in Eclipse.
- Go to
Help
in the menu bar, and selectInstall New Software
. - Click the
Add
button to add a new update site:- Name:
zephyr-eclipse
- URL: https://builds.zephyrproject.org/eclipse-plugin/
- Name:
- Select the newly added update site.
- Select
Zephyr Project
andZephyr Project Development Support
and clickNext
. - Follow the instructions on the wizards to install the plugin.
- Restart Eclipse when asked to do so.
Go to Help
in the menu bar, and select Check for Updates
.
Project creation is similar to creating other project type under Eclipse.
This will create a Hello World
project.
- Go to
File
,New
andProject...
- In the dialog, select
Zephyr Application
underZephyr Project
. - Click
Next
- Type in the name for the project.
- Under
Zephyr Base Path (ZEPHYR_BASE)
, put in (or browse to) the path to the Zephyr tree. - Click
Next
- Select the toolchain variant to be used with this project. Depending on the selection, different set of options will need to be set. These options are the same one as described in the Getting Started - Set Up a Toolchain.
- Click
Next
- Type in the board name of the targat hardware.
- Or click on the check box and select one below.
- Click
Finish
- A new project is created under Eclipse.
- It is recommended to use the
C/C++
perspective.- Go to
Window
,Perspective
,Open Perspective
, andOther...
. - Select
C/C++
and clickOk
.
- Go to
- Right click on the project name under
Project Explorer
and selectBuild Project
.
- Right click on the project name under
Project Explorer
and selectRun As
, andRun Configurations...
. - Right click on
Zephyr Emulator Target
, andNew
.- Or, select a previously created configuration.
- In the newly created configuration, make sure the project is the correct one.
- Click
Run
- The
Console
view will contain the output of the emulator. - Click the red square
Terminate
to stop the emulator.
- Right click on the project name under
Project Explorer
and selectRun As
, andRun Configurations...
. - Right click on
Zephyr Hardware Target
, andNew
.- Or, select a previously created configuration.
- In the newly created configuration, make sure the project is the correct one.
- Click
Run
- The
Console
view will contain the output of the flashing process.
- Right click on the project name under
Project Explorer
and selectDebug As
, andDebug Configurations...
. - Right click on
Zephyr Emulator Target
, andNew
.- Or, select a previously created configuration.
- In the newly created configuration, make sure the project is the correct
one, and the
C/C++ Application
points to the correct ELF file. - In the
Debugger
tab:- The
GDB Command
should be pre-populated with the GDB project discovered by CMake. If not, select the correct GDB program corresponding to the target. - Port number is pre-populated according to the target type. Change if it is not correct.
- The
- Click
Debug
and the debug session should start. - Follow Eclipse's debugging workflow to debug the application.
- Right click on the project name under
Project Explorer
and selectDebug As
, andDebug Configurations...
. - Right click on
Zephyr Hardware Target
, andNew
.- Or, select a previously created configuration.
- In the newly created configuration, make sure the project is the correct
one, and the
C/C++ Application
points to the correct ELF file. - In the
Main
tab, default is to also flash the image to the target. This can be skipped with the appropriate option. - In the
Debugger
tab:- The
GDB Command
should be pre-populated with the GDB project discovered by CMake. If not, select the correct GDB program corresponding to the target. - Port number is pre-populated according to the target type. Change if it is not correct.
- The
- Click
Debug
and the debug session should start. - Follow Eclipse's debugging workflow to debug the application.
The minimum requirements for building the plugins are:
- Java SE 11.0.3
- Maven 3.3.9 or later (except 3.6.1)
$ mvn clean package
The resulting p2 repository is at maven/repository/target/repository
.
The OpenOCD in the Zephyr SDK can export information on threads for GDB.
To utilize this capability, CONFIG_OPENOCD_SUPPORT
must be enabled in
the project configuration file to export information on threads.
Also, the board's openocd configuration file must have the following line:
$_TARGETNAME configure -rtos auto
This line tells OpenOCD to search for exported information on threads.
With the correct configuration mentioned above, information on available threads will be displayed in Eclipse's debug perspective.
- Eclipse is not responding after clicking Finish at project creation.
Due to the Zephyr source tree being linked within the project, it may take some time for Eclipse to traverse the whole tree. For example, after running sanity check, the output folder contains a large amount of files for Eclipse to traverse.