1. Setup NetBeans IDE.
-         
Download and install  NetBeans:  https://netbeans.org/downloads/
2. Install Arduino Plugin for NetBeans.
-         
Open NetBeans IDE.
-         
Select Tools -> Plugins -> Available
Plugins, Select Arduino-plugin in the list and  install
3. Install Arduino IDE.
-         
Download Arduino IDE : https://www.arduino.cc/en/Main/Donate
-         
Note:
o  
 Name of installed folder of Arduino is not allowed to have space, by default Arduino is installed in folder: C:/Program Files/~ – having space in name, so Netbeans will not see the Arduino Tools.
4. Installi Cygwin for Windows.
-         
Based on your OS's architecture  you select   32 or 64 bit version in this link https://cygwin.com/install.html.
-         Select packages to install in  Devel Group:
o  
Gcc-core: C compiler
o  
Gcc-g++: C++ Compiler.
o  
Gdb: GNU debugger.
o  
Make: the GNU version of ‘make’ utility
o  
Cmake. 
5. Add Cygwin's path to system path variable.
-         
 Based on your installed folder of Cygwin so you chose suitable path. Example: E:\Soft\cygwin64\bin
6. Setup build tool for Arduino on NetBeans.
-         
 Run NetBeans and select:  Tools > Options
> C/C++, select tab Build Tools and click  Add Button to add   build tools for Arduino.
-         
input path of  Arduino Compiler , and no space in all paths
- In Tab  “Code Assistance ” add path to tools for  C Compiler and  C++ Compiler as below.
7. Create a Project Arduino and configure.
-         
select  board andcomport, select path to installed folder of Arduino.
-         
Change some configuration in make file.
-         
Click Build and run Arduino project ,  NetBeans  will  build project base on cross compiler specified, than create a  file *.hex and upload to Arduino board through Serial  Comport as flash in Arduino IDE.
-         
You can also open  Cygwin terminal  and  cd  to  Arduino
project folder and run command  “make upload”
8. Create a new execution project and configure it to become static library project.
a.       Configure project to build static library.
-         
After create, build and run executive project, than delete the main.cpp file and add header and source files that you want to create static library.
-         
Right click on project , select  property >
Build > Configuration Type > Static Library
-         
NetBeans  workspace will look like:
-         
if you build  project, liabrary file *.a will be created, but the  Output Windows will way that  building is falied , because in the  make file have command to creare hex file and upload to  board, you should disable this command or ignore the error message.
-         
Open Make file, search and comment out the command “#” :
“avr-objcopy -O ihex ${CND_ARTIFACT_PATH_${CONF}}
${CND_ARTIFACT_PATH_${CONF}}.hex”
Ø 
# avr-objcopy -O ihex
${CND_ARTIFACT_PATH_${CONF}} ${CND_ARTIFACT_PATH_${CONF}}.hex
-         
Rebuild lại project và xem kết quả:














Comments
Post a Comment