This demo shows the OpenCL Mandelbrot example from the Atlera website running on the Atlas-SoC board with an 2.8" Adafruit TFT display. The demo uses OpenCL to generate images from the Mandelbrot set. OpenCL is a framework for accelerating software algorithms on different types of hardware. In this case, OpenCL is used to program the FPGA instead of using RTL code.

running board with hand.JPG

Needed parts for the demo

  1. DE0-Nano-SoC Kit/Atlas-SoC Kit
  2. 2.8" TFT Touch Shield for Arduino with Resistive Touch Screen
  3. 1GB(or larger) micro SD card

Setting up the demo

Remove the cover plate from the board

The cover plate for the board needs to be removed to connect the screen to the board. There are 4 screws that need to be removed to remove the plate.
board remove cover.JPG

Configure MSEL switches

Before attaching the screen make sure the MSEL switch are set correctly or the demo wont work because the FPGA image won't configure. The settings are UP, DOWN, UP, DOWN, UP, UP.
msel highlighted.png

msel closeup.png

Attach the screen

Carefully, attach the Adafruit TFT display to the arduino port. The pins will only fit one way in the connector.

put screen on board.JPG

Flash the SD card image

  1. Download the SD card image here:
  2. unzip the zip file to get the disk image file "mandelbrot_demo.img"
  3. use win32diskimager or "dd" command to image "mandelbrot_demo.img" to the sd card.

Run the demo

  • Connect power supply to the assembled board with the SD card and the demo will start automatically. The power supply is the only cable that needs to be connected
  • The demo will automatically start up in OpenCL acceleration mode.
  • To switch to software rending mode, push the "key1" push button in the bottom right corner of the board.
  • To turn off the demo, unplug the power supply

Demo source code

This section is for advanced users who want to see how the demo is built. If you just want to run the demo, just download the SD card image and copy that to your micro SD card (see instructions above).

This demo has many different pieces to it. There are 4 different git repositories to store different parts of the project. I've included links and brief descriptions for everything. This is not a step by step guide for rebuilding the entire demo but this should be enough information to help you rebuilt a particular piece.

Build system requirements

This is what I had on my system.
  • Quartus 15.0
  • SoC EDS 15.0
  • Altera OpenCL SDK 15.0
  • Centos 6.6
  • git

Linux source code

The linux source for this project includes enabling CMA for OpenCL, Display drivers, patches for the Atlas board, and support for the GPIO buttons. The device tree source is also included in this branch.

  • Build commands
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
make socfpga_defconfig
make zImage
make socfpga_de0_nano.dts

Buildroot source code

The Buildroot source includes a prelimary SDL2 patch that the OpenCL demo needed, perl, and X.

make altera_soc_defconfig

OpenCL BSP source / FPGA Project

The includes the OpenCL BSP used for this project. This is basically an FPGA project that is used base for the OpenCL compilation.

#To build with the BSP, you have to set AOCL_BOARD_PACKAGE_ROOT
export AOCL_BOARD_PACKAGE_ROOT=/path/to/bsp

#you should see the de0 listed with this command
aoc --list-boards 

#if you recompile linux, you need to compile the driver in opencl_soc_bsp/c5soc/driver
make KDIR=path/to/linux/src

Mandelbrot application source code

This git repository includes the OpenCL kernel code and the application code. The source code is based Mandelbrot example from the Altera OpenCL design examples page.
#set this env var
export AOCL_BOARD_PACKAGE_ROOT=/path/to/bsp

#build aocx with this command
aoc device/ --board de0_nano_sharedonly_with_spi_tft

#build host code
make -f Makefile.arm


Give us your feedback

© 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Privacy.