Pagine

Thursday, 24 March 2016

Install Linaro cross-compiler on Mac OS X

If you need a cross-compiler for Mac OS X, you have two possibilities:
  1. Install crosstool-ng and configure it
  2. Download a preconfigured cross-compiler, as Linaro.
The fastest way is to choose the second option.

First, you have to download Linaro tool from the official site, going to the section ''Linaro Toolchain'' and selecting the pre-built binary you want.

We get the linaro-toolchain-binaries(little-endian) for Linux.

After installing the toolchain, you can find all that you need in

usr/local/linaro/arm-linux-gnueabihf



Now, to add the installation folder to the PATH environmental variable, you have to pick

/usr/local/linaro/arm-linux-gnueabihf/bin

and add it as shown in our guide.



Now you can start to compile. For example, if you have a file named test.c you have to type in a shell:

arm-linux-gnueabihf-gcc -Wall -Wextra -c test.c


Sunday, 13 March 2016

Connect BeagleBone Black and Mac OS X via Serial

In this tutorial we'll see how to connect the BeagleBone Black to a Mac OS X via serial communication.

First thing: connect the BBB to the host via the USB cable.
Then, for the serial communication, you need a USB serial connector like this:




Connect the pins in this way:


  • pin 1 = black wire (ground)
  • pin 4 = green wire
  • pin 5 = white wire



Now you have to identify the device from the host. In this step there may be some problems with the recognition of the board, so let's try the following steps.

Open the shell and type: ls /dev/cu.*
In addition to the USB port employed by the power supply for the board, you should see another port for the serial cable. 
If you don't, you have to install a suitable driver for recognize and access the serial device.

So type:  sudo rm -rf /System/Library/Extensions/ProlificUsbSerial.kext
to remove any other installed driver and ther install one of the following (for me, it works with the first one):


Now, retry to type ls /dev/cu.*
You should see a  /dev/cu.usbserial between the results.

If so, the USB serial driver is working, so you can use this port name to connect with the board.
For this purpose, you can use minicom or another serial communication program.

If you need the serial connector, check this:
Usb To Ttl Serial Cable - To Connect Your Microcontroller, Raspberry Pi, Beaglebone Black, Wifi Router Or Even Hard Disk. Serial Port Communication.

For BeagleBone Black:
BeagleBone Beagleboard Black - ARM Cortex A8, RAM DDR3, HDMI, USB 2.0




Tuesday, 8 March 2016

Add a new environment variable to $PATH on Mac OS X

In this tutorial we'll explain how to add a new path variable in OS X.

The file we have to modify is /etc/paths, which contains a list of paths that are added to the $PATH variable.
All the executable files contained in the directories listed in this file can be launched on the shell using their name.

Suppose we have to add git executables to the path variables, and their directory is /usr/local/test/bin.

Follow these steps:
  1. Open the shell
  2. Type sudo nano /etc/paths
  3. Add at the end of the list /usr/local/test/bin and enter your password
  4. Press ctrl+X to exit, and Y to save changes
  5. Press enter
Problem solved!

Now, let's verify if everything went well.

Type in the shell (a new window is required!) echo $PATH

You should see something like this (focus on the last item, which should be the directory you just added):

/usr/local/bin:/usr/bin:/opt/X11/bin:/usr/local/test/bin





Saturday, 5 March 2016

Neo4j: how to use neo4j jdbc driver in Java

Here's a tutorial on how to connect to Neo4j graph database using org.neo4j.jdbc.Driver and Java.

What we do in the following code is to:

  1. Set user and password strings
  2. Check for the driver in referenced libraries
  3. Establish the connection



Note that user and password strings are here hardcoded, as server port and address.
A better way to set them is using a property file as showed in our tutorial