FFT2D Frequency Domain Image Enhancement for 16-cores Epiphany
==============================================================

YS, Oct.2012


Importing the projects into an Eclipse Workspace
================================================

In this archive are packed the Eclipse project files required for building a Host-Accelerator 
framework for frequency domain image filtering for the E16G3 16-core chip on the EMEK3 kit.

In order to open the project in an Eclipse environment, please follow these steps:

1.  Install the DevIL (Developer's Image Library) package via the Ununtu Software Center.

2.  At the current directory extract the fft2d.tgz archive and change the directory using:

    >> tar xvf fft2d.tgz
    >> cd fft2d

    you are now inside the Workspace directory (WSD).

3.  Inside the WSD directory you should see the 19 new extracted project directories:

    >> ls -1
    fft2d
    fft2d_commonlib
    fft2d.core.32_36
    fft2d.core.32_37
    fft2d.core.32_38
    fft2d.core.32_39
    fft2d.core.33_36
    fft2d.core.33_37
    fft2d.core.33_38
    fft2d.core.33_39
    fft2d.core.34_36
    fft2d.core.34_37
    fft2d.core.34_38
    fft2d.core.34_39
    fft2d.core.35_36
    fft2d.core.35_37
    fft2d.core.35_38
    fft2d.core.35_39
    fft2d_host

    From the top of the list, these are the master multicore meta-project, the common-library
    project, 16 individual per-core projects and the host side project.

4.  Start Eclipse:

    >> {$EPIPHANY_HOME}/eclipse &

5.  At the "Workspace Launcher" dialog browse for the WSD and click "OK". The Eclispe Welcome
    window now opens.

6.  Click on the "Workbench" icon. The window now changes to an empty workbench.

7.  From the "File" menu select the "Import..." entry. An "Import" dialog window pops-up.

8.  Expand the "General" branch, select the "Existing Projects into Workspace" and Click "Next >".

9.  Select the "Select root directory:" option, browse for the WSD and confirm. You should now see
    the 19 extracted projects added and selected in the "Projects:" list.

10. Click "Finish". The 19 projects now populate the "Project Explorer" view.

11. It is a good idea now to change the following Workbench preferences:

    * "Window" menu -> "Preferences" -> "General" -> "Workspace"

    * Check the "Save automatically before build" checkbox.

    * "Window" menu -> "Preferences" -> "C/C++" -> "Indexer"

    * Check the "Index unused headers" and "Index source and header files opened in editor"
      checkboxes.


Building the project
====================

12. In the "Project Explorer" select one of the projects. "Edit" menu -> "Select All".

13. "Project" menu -> "Build Configurations" -> "Set Active" -> "Release".

14. In the "Project Explorer", select the "fft2d" meta-project and from the "Project" menu select
    "Build Project". The Epiphany program now builds. Click on the "Console" view to see the
    building process.

15. Select the "fft2d_host" project and from the "Project" menu select "Build Project". The
    host program now builds.


Loading the program on the EMEK3 target
=======================================

16. In the "Project Explorer", select the "fft2d" meta-project and from the "Run" menu select
    "Run Configuration...". The "Run Configuration" dialog opens.

17. From the list right-click on the "Epiphany Multicore Application (loader)" and select "New".
    The "fft2d Release" launch configuration is created.

18. Click on the "Run" button. The project will be rebuilt and then loaded on the target.


Running the host application
============================

18. In the "Project Explorer", select the "fft2d_host" project and from the "Run" menu select
    "Run Configuration...".

19. From the list right-click on the "C/C++ Application" and select "New". The "fft2d_host Release"
    launch configuration is created.
    
20. In the "Arguments" tab add the path to the image file to process. Image should be size 128x128
    grayscale image.

21. Click on the "Run" button. The project now runs in the "Console" view.

23. The calculation now takes place and when the result is ready, it is read back to the host and
    saved as the filtered image file. Note that reading back a large image may take a some time
    on the EMEK3 system.

24. Once the target project is loaded on the target, you can repeatedly run the host program - no
    need to reload the target.

