Windows Netbeans configuration

From Miosix Wiki
Revision as of 11:21, 22 April 2014 by Fede.tft (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installing the IDE

Download the Netbeans IDE. Among the possible versions choose the C/C++ version. Netbeans is an IDE written in Java, so it requires the JDK to function. If you don't have the JDK installed, download it from here and install it before installing Netbeans.

Configuring the IDE

Netbeans is a generic C/C++ IDE, and once installed is not set up by default to develop for ARM microcontrollers and Miosix. So you need to configure it. This is a one-time step that you will have to do again only if you re-install the IDE.

Note: this assumes you have already installed the Miosix toolchain, if not read the Windows Quick Start tutorial first.

Open the Netbeans IDE (there should be an icon on the Desktop after installation) and click on "Tools > Options". From the top of the options window select the C/C++ panel, and click the "Add" button to add a compiler to Netbeans. As "Base directory" choose "C:\arm-miosix-eabi\arm-miosix-eabi\bin". Choose "GNU MinGW" as "Tool collection family", and "ARM_MIOSIX_EABI" as "Tool collection name". Note that you must use the "ARM_MIOSIX_EABI" name, or you'll have problems later. The C and C++ compiler should be automatically filled in by Netbeans, if not copy them from the screenshot below. Please note that make.exe should have no path otherwise compiling will fail.

Nbsetup1-windows.png

Last, you will need to set up the paths with the compiler libraries for code completion to work. Click on the "Code assistance" tab, and "C compiler" sub-tab. The list of folders and macro definitions should look like in this screenshot, if not, add the paths manually.

Nbsetup2-windows.png

Then click th "C++ compiler" sub-tab and check if the paths and macro definitions are correct. If not add the missing paths manually as in the next screenshot.

Nbsetup3-windows.png

Configuration is now complete. You can close the Options windows by clicking "Ok".

Building the Miosix kernel with Netbeans

Select "File > Open project" and select the "miosix_np_2" directory withn the Miosix top level directory.

Nbsetup4-windows.png

You may want to rename the project from the default "miosix_np_2" to the name of the project you are going to develop, by right clicking on the project name and selecting "Rename", once you have opened it.

Miosix supports different boards, each of which has different board support packages and peripheral drivers. To get code completion support for your board you need to select it within the IDE, as in the following image

Nbsetup5-windows.png

Please note that in the Windows Quick Start you had to select the board to compile for by editing the miosix/config/Makefile.inc. The board selection within the IDE does not replace the need to edit Makefile.inc, they serve two different purposes:

  • Board selection within the IDE is used by the IDE to set up code completion for your board
  • Board selection in Makefile.inc tells the kernel for which board it needs to be compiled.

However, please note that you can edit Makefile.inc and miosix/config/miosix_settings.h as regular source files within the IDE, without the need to use Notepad++.

You can open main.cpp (double click on it from the left pane), and start typing your code. Code completion is invoked by typing the first letters of the function, variable, class or member function and hitting "Ctrl-space". Netbeans also integrates with Doxygen documentation, so you can see the documentation for Miosix classes and functions directly from the IDE.

Nbsetup6-windows.png

Building is performed by clicking the hammer icon above the source code editor. The Output window will appear below the source editor showing the compilation progress and eventual compiler errors. There is no known way to transfer the compiled program on a microcontroller board directly from the IDE, for this you will have to use the QSTLink2 tool as explained in Windows Quick Start.