Since cross-compiling for ARM on my Intel box is non-trivial, the approach I've chosen is to develop on Windows using NetBeans and use the Pi as a compilation host using SSH tunneling. This way all binaries are compiled and built natively on the target execution platform. No hassle ! :-)
I also want to check my code on a cloud repository for backup, share the code and get contributions from my electrical engineer friend. I decided to go with BitBucket as it's free and Git-based. NetBeans natively supports Git so linking the project to BitBucket is quite simple and I'll skip documenting this step.
Step 1 - Enable Root login for SSH
You first need to tweak your Pi's SSH configuration a little to allow root (like admin account on Windows) login. Root permissions will be required to achieve the next steps.
On the Pi's console, first set a password for the root user:
sudo passwd rootYou should now be able to login as the root user using Putty. If it doesn't work, check the SSH daemon configuration to make sure it allows root login.
sudo nano /etc/ssh/sshd_configMake sure you have this line somewhere in the file:
PermitRootLogin yesRestart the daemon if you've change the config file:
sudo /etc/init.d/ssh restartIf you need to remove the root login at a later time (for security purposes), run this command:
sudo passwd -l root
Step 2 - Install and Configure
I downloaded NetBeans 8 from https://netbeans.org/downloads/ (get the one that says C/C++) and proceeded to install it on my workstation.
Once in NetBeans and a new project is created, you'll need to define the Raspberry Pi compilation host settings. Before you proceed further, make sure your Pi is up and running, connected to your network and that you have its IP address noted.
Navigate to the Services tab in the left window pane. Right-click on the C/C++ Build Host node and select Add new host.
Enter the IP address of the Pi in the hostname. The default SSH port is 22. Change the port number if you've modified the SSH default configuration.
Enter root as the login and select password as the authentication method, then click next.
You'll be asked to enter the password you've previously created for root.
Once you click Ok, NetBeans will start configuring the Pi to handle the build process.
In NetBeans, click the compile button and make sure that the compilation process completes successfully. You should see BUILD SUCCESSFUL in the console window.
No comments:
Post a Comment