1 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/devguides/master/xds-docs-guides-devguides-book.yml -->
5 One option for building your application using XDS is to use
6 an Integrated Development Environment
7 ([IDE](https://en.wikipedia.org/wiki/Integrated_development_environment)).
8 Many IDEs exist (e.g. [NetBeans](https://netbeans.org/),
9 [Visual Studio Code](https://code.visualstudio.com/),
10 [Qt Creator](https://www.qt.io/),
11 [Eclipse](https://www.eclipse.org/), and so forth).
13 This section first develops an XDS configuration file
14 (i.e. `xds-project.conf`) and then provides two
15 examples, NetBeans and Visual Studio, that do the following.
17 - NetBeans: Creates two separate build configurations
18 for a project, which makes it easy to switch back and forth
19 between types of builds.
21 - Visual Studio: Creates tasks that allow you to build an example
22 based on CMake templates.
24 ## XDS Configuration File
26 This section shows how to create an XDS configuration file
27 (i.e. `xds-project.conf`) or how to re-use an existing file.
28 For example, the following commands set up the configuration
29 file for an `aarch64` SDK to cross-build the
30 application for a Renesas Gen3 board.
33 # create file at root directory of your project
35 # MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application
36 cat > $MY_PROJECT_DIR/xds-project.conf << EOF
37 export XDS_AGENT_URL=localhost:8800
38 export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b
39 export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03
45 This section creates two configurations: one to compile the
46 project natively using native GNU gcc, and one to cross-compile
47 the project using XDS.
49 Having two configurations allows you to easily switch between them
50 using NetBean's **Run -> Set Project Configuration** menu.
52 ### Native Configuration
54 Follow these steps to create the native configuration:
56 1. Open the **Tools** -> **Options** menu.
58 2. Open the **C/C++** tab.
60 3. Click on the **Add** button in the **Build Tools** sub-tab:
62 {:: style="width:90%; max-width:700px; margin:auto; display:flex"}
64 4. Fill the **Make Command** and **Debugger Command** fields to point to the XDS tools:
66 {:: style="width:90%; max-width:700px; margin:auto; display:flex"}
70 6. Select the **File** -> **New Project** menu item to declare the
71 project and create a native configuration.
73 7. Select **C/C++ Project with Existing Sources** and click on **Next**.
75 8. Specify your project directory and set **Select Configuration Mode** to
77 Be sure to keep **Tool Collection** set to "Default GNU" in order to create a
78 *native configuration*, which is based on the native GNU GCC.
82 {:: style="width:90%; max-width:700px; margin:auto; display:flex"}
84 10. Update the **Run in Folder** field to add the `build_native` suffix.
85 Doing so results in the build files being located in the
86 `build_native` sub-directory.
87 Be sure to keep the defaults for all other settings and then click **Next**.
89 {:: style="width:90%; max-width:700px; margin:auto; display:flex"}
91 11. Click through **Next** several times while always keeping the
92 default settings until the **Finish** button appears.
94 12. Click **Finish** to complete the creation of the native configuration.
96 ### Cross-Compilation Configuration
98 Follow these steps to create the configuration for cross-compilation
99 based on the XDS tools:
101 1. Edit project properties (using menu **File** -> **Project Properties**)
102 to add a new configuration that will use XDS to cross-compile
103 your application for example for a Renesas Gen3 board.
105 2. in the **Build** category, click on **Manage Configurations** button
106 and then **New** button to add a new configuration named for example
109 {:: style="width:90%; max-width:700px; margin:auto; display:flex"}
111 3. Click the **Set Active** button.
113 4. Select the **Pre-Build** sub-category, and set the following:
115 - Working Directory: `build_gen3`
116 - Command Line: `xds-cli exec -c ../xds-project.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ..`
117 - Pre-build First: `ticked`<br/><br/>
119 5. Select the **Make** sub-category, and set the following:
121 - Working Directory: `build_gen3`
122 - Build Command: `xds-cli exec -c ../xds-project.conf -- make remote-target-populate`
123 - Clean Command: `xds-cli exec -c ../xds-project.conf -- make clean`<br/><br/>
125 {:: style="width:90%; max-width:700px; margin:auto; display:flex"}
127 6. Select the **Run** sub-category, and set the following:
129 - Run Command: `target/start-on-root@renesas-gen3.sh`
130 - Run Directory: `build-gen3`<br/><br/>
132 {:: style="width:90%; max-width:700px; margin:auto; display:flex"}
134 7. Click **OK** to save settings.
136 By changing the configuration from **Default** to **Gen3 board**, you can
137 compile your helloworld application natively, which is the default configuration.
138 Or, you can cross-compile your application using XDS for the Renesas Gen3 board,
139 which is the Gen3 board configuration.
141 ## Visual Studio Code
143 This section presents a Visual Studio example that creates tasks
144 that allow you to build an example that is based on CMake templates.
148 1. Start Visual Studio Code and open your project using the
156 2. Add new tasks by entering the `Ctrl+Shift+P` key combination and selecting
157 the `Tasks: Configure Task` command.
158 A list of task runner templates appears.
160 3. Define your own tasks.
161 Following is an example that builds the
162 [helloworld-native-application](https://github.com/iotbzh/helloworld-native-application)
163 that is based on CMake templates.
176 "command": "/bin/rm -rf ${workspaceFolder}/build/* && mkdir -p build && echo Cleanup done.",
180 "label": "pre-build",
183 "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ../",
192 "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget",
200 "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget-target-install",
207 4. Run a task by entering the `Ctrl+Shift+P` key combination and
208 selecting `Tasks: Run task` and then selecting the specific task.
209 For example, select `pre-build` to trigger pre-build task.
211 5. Optionally add keybindings that trigger tasks.
212 Following is an example:
218 "command": "workbench.action.tasks.runTask",
223 "command": "workbench.action.tasks.runTask",
228 "command": "workbench.action.tasks.runTask",
233 "command": "workbench.action.tasks.runTask",
238 <!-- section-note -->
241 - You can find more details about Visual Source Code keybindings
242 [here](https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks).
244 - You can find more details about Visual Source Code tasks
245 [here](https://code.visualstudio.com/docs/editor/tasks).
246 <!-- end-section-note -->