OSX Development Environment
Setting up a VHDL development environment on OSX is not as straight forward as with Windows or Linux machines. The main reason for this is that very few HDL hardware companies support OSX as a development platform and thus compiling, simulating and flashing your LOGi-Board becomes a whole lot harder than it needs to be.
This guide will take you through the steps needed to setup a VHDL development environment on OSX. A minimalistic virtual machine (VM) will be used to host the linux tool suites and some bash trickery will allow you to call these tools as if they were installed natively on you machine.
An additional advantage with this type of setup is that you could move your VM to the cloud and then do your design from anywhere, and on almost any platform.
The software we will be using is listed below:
Ubuntu Minimal, I used version 13.10-64bit
Xilinx ISE WebPack For Linux, required to compile code to bit files for LOGi-Board
Sigasi Editor OSX, Free starter version, or apply for an education license if you are a student
GHDL for OSX, this could also be installed on Linux but might as well use the native version
GTKWave for OSX, installed via Macports or from source
This tutorial will make a few assumptions about your knowledge of OSX, Linux and configuring these systems. Before you start it is assumed that you know how to do the following:
Install OSX applications using a DMG
Use the terminal
Have a knowledge of Macports or Homebrew
Know how to install applications in Linux using apt-get
A working knowledge of your chosen VM software
You have a basic knowledge of SSH
Setting up the VM
This section will outline the basic VM configuration and settings you need in order to successfully install Linux and complete the other steps. Note that these steps might change depending on whether you are using VMWare or some other virtual machine. You might need to look around for the settings but they will be there.
Our first step is to create a new virtual machine image.
In VMWare select Add -> New and follow the prompts in the “New Virtual Machine Assistant”.
When prompted to insert the installation disc, select “Continue without disc”.
When asked to select the OS installation disc, select the Ubuntu mini.iso you downloaded earlier.
Click next, and then set the operating system as Linux and the Version as Ubuntu 64-bit.
Before finishing click on “Customize Settings” and you will be asked to save the new VM Image. Save this wherever you like. I just use the default folder.
Next the customization screen will pop up. In this pane there are a few settings we need to change before launching our VM.
resize the disc to be 20GB if it isn’t already.
Select advanced and deselect “Split into 2GB files”
Also change the “Bus Type” to IDE instead of the default SCSI.
Enable the Network Adapter and select “Share with my Mac” under “Internet Sharing”
Processors & Memory:
Select the VM to use 2 processor cores (if you have available)
Select at least 1GB of Memory for the VM. Select more if you can.
If you are unsure about these settings just leave them as the defaults.
We can now start the VM and begin the install process.
When Ubuntu Minimal boots there should be an option which allows you to install Ubuntu to the HDD. Select install and follow the instructions on screen in order to install Ubuntu.
When you are asked about partitioning disks, select manual partitioning and setup two partitions as shown below:
20GB Ext4 partition
1GB Swap partition
After you have setup the partition table, write the changes to the disk in order to continue with the install.
Unmount the ISO and reboot the VM once the install has finished. The VM will boot directly into a bash terminal, and from here we can configure the rest of our install.
The first thing to do is to get a GUI environment up and running. While this can be considered optional, it will help with the rest of the setup process.
We are going to install LUbuntu’s window manager as it is lightweight and responsive. From terminal run:
sudo apt-get install lubuntu-core
sudo nano /etc/xdg/lxsessions/Lubuntu/autostart
and add the following
@xrandr --auto --output Virtual1 --primary --mode 1024x768 --left-of Virtual2
press ctrl-x and save the changes. Then reboot the VM.
This time it will load into the desktop environment.
Next we will setup a few libraries which are required in order to create programs for the LOGi Bone.
Run the following:
- sudo apt-get install gcc g++ curl wget tar bzip2 libmotif3 git python automake autoconf cmake libstdc++5 libcurl
We can also optionally install
ruby (I prefer it over Python for scripting stuff)
synaptic (A very nice GUI package manager) - Recommended
zsh (A nice shell environment I prefer it to Bash)
We can now install our HDL tools in order to write and build code for the FPGA.
sudo apt-get install gcc-4.7-arm-linux-gnueabi
sudo apt-get install verilog
sudo apt-get install gtkwave
sudo apt-get install software-properties-common
add-apt-repository ppa:pgavin/ghdl (You don’t need this, as we installed it in OSX too)
sudo apt-get update
sudo apt-get install ghdl
You can now go ahead and install the Xilinx ISE Webpack that you downloaded earlier.
Setting up SSH
Next we need to setup an SSH server so that we can SSH into our build machine from OSX. This provides a clean way to use the tools which are in the Linux environment.
sudo apt-get install openssh-server
Once that is installed we want to setup automatic login using a public and private key. This is so our build scripts don’t block and ask for login details everytime.
sudo nano /etc/lightdm/lightdm.conf
and add the following to the file.
autologin-user=<your Ubuntu username>
Save and exit (ctrl-x and Y)
Setting up OSX
In order to keep the VM image small we will create a shared folder in OSX. This folder will become the install location for the ISE Webpack as well as your project folder.
In order to setup the shared folder we first need to make a folder to share. On the OSX machine run the following (You can use any directory):
System Preferences -> Sharing
Under “File Sharing” add the folder you just created to the list and set the permissions to “Read & Write” for “Everyboody” so that the Linux VM can also write to this directory.
Next select “Options” and ensure that “Windows File Sharing” is enabled (second option)
Take note of the IP address given in the “File Sharing” window, we will need it in a second.
Our next step is to mount this file system in the VM. On the VM run the following commands:
sudo apt-get install cifs-utils
sudo mkdir /mnt/HDLProjects
sudo mount.cifs //<your OSX IP>/HDLProjects /mnt/HDLProjects -o user=<username>,password=<password>,nounix,sec=ntlmssp,noperm,rw
Next symlink this folder to your VM home directory
ln -s /mnt/HDLProjects/ .
Once the shared folder is setup we can install the Xilinx ISE webpack which you have downloaded.
The install takes up around 18GB of space and thus I recommend installing it to your shared folder, I installed mine at “~/HDLProjects/Xilinx_Tools/”
A standard install should be sufficient for the moment.
Setting up private keys
Typing a password every time you SSH in is not very convenient, especially when we will be running many scripts on the VM via SSH. So to prevent this we need to setup public and private keys.
On your OSX machine:
ssh-keygen -f HDLServer -N '' -t rsa -q
Copy the contents of HDLServer.pub and append it to the “~/.ssh/authorized_keys” file on the VM. If the file or folder do not exist then create them.
You can now SSH without entering a password. On the OSX machine run the following in terminal:
ssh -i ~/.ssh/HDLServer <Your username>@<Your VM IP>
If you are asked for a password then it is not setup correctly, carefully read through the above instructions again.
At this point you should be able to write VHDL in OSX using Sigasi and then import that into your ISE projects on the VM. These projects can then be built and uploaded to the LOGiBone via ISE and the VM.
The next two sections will setup the OSX machine to trick it into believing it can run the tools needed to build, test and deploy the VHDL code to the LOGiBone. While it is perfectly acceptable to just develop on the Linux VM I like the ability to separate the process and leave my VHDL build server in the cloud, this allows me to write and deploy code from anywhere.
Non-native tool setup