From 9a293641b9abf9e4fca34f46a2de781f50847da9 Mon Sep 17 00:00:00 2001 From: "Westergreen, Dalon" Date: Wed, 29 Mar 2017 15:41:36 -0700 Subject: Initial commit of de10-nano recipes Please note that this is purely for development. Only superficial efforts have been made to resolve security concerns, and it should be noted that the board ships with an EMPTY ROOT PASSWORD and support for root login via ssh. This allows passwordless access to the board via ssh. recipes-bsp/u-boot: Contains the uboot 2017.03rc2 recipe and patches to support the de10-nano board recipes-connectivity/avahi: bbappend to remove unwanted packages recipes-connectivity/bluez: bbappend to add --compat to the bluetooth service to support legacy SDP APIs recipes-connectivity/openssh: bbappend to add a custom sshd_config recipes-core/base-files: bbappend to customize fstab and inputrc recipes-core/imagemagick: bbappend to change build configuration for the de10-nano board recipes-core/packagegroups: bbappend to remove an unwanted package recipes-core/webkit: bbappend to remove support for opengl recipes-demo: Various demo applications recipes-devtools: MRAA and UPM recipes recipes-images/angstrom/de10-nano-image.bb: DE10-Nano image definition recipes-kernel/de10-nano-linux-firmware: FPGA related firmware required for fpga configuration and devicetree overlay support recipes-kernel/linux: bbappend to customize configuration of linux kernel as well as patch in the de10-nano devicetree recipes-misc: various initialization and systemd scripts recipes-qt/qt5: bbappend to modify qt build options recipes-support/neon: bbappend to remove unwanted package recipes-support/upower: bbappend to remove unwanted package recipes-webserver: webserver configuration and webcontent for board hostedweb portal recipes-xfce/thunar-volman: bbappend to remove unwanted package recipes-xfce/xfce-pointers: add configuration so that xfce does not use the adxl input as a mouse recipes-xfce/xfce4-settings: bbappend to remove unwanted package Signed-off-by: Westergreen, Dalon --- recipes-demo/de10-nano-fftsw-apps/files/LICENSE | 22 +++ .../de10-nano-fftsw-apps/files/README_HOST.TXT | 154 +++++++++++++++ .../de10-nano-fftsw-apps/files/README_SANDBOX.TXT | 139 +++++++++++++ .../files/README_SANDBOX_BUILD.TXT | 59 ++++++ .../de10-nano-fftsw-apps/files/README_TARGET.TXT | 114 +++++++++++ .../files/README_TARGET_BUILD.TXT | 151 ++++++++++++++ .../files/archive_for_target.sh | 68 +++++++ .../files/archive_src_for_sandbox.sh | 33 ++++ .../files/archive_src_for_target.sh | 96 +++++++++ .../de10-nano-fftsw-apps/files/build_all.sh | 85 ++++++++ .../de10-nano-fftsw-apps/files/build_app.sh | 104 ++++++++++ .../de10-nano-fftsw-apps/files/build_lib.sh | 90 +++++++++ recipes-demo/de10-nano-fftsw-apps/files/c16_256.c | 104 ++++++++++ .../de10-nano-fftsw-apps/files/c16_256x32.c | 109 ++++++++++ .../de10-nano-fftsw-apps/files/c16_256x32x128.c | 113 +++++++++++ recipes-demo/de10-nano-fftsw-apps/files/c16_4096.c | 104 ++++++++++ recipes-demo/de10-nano-fftsw-apps/files/c32_256.c | 104 ++++++++++ .../de10-nano-fftsw-apps/files/c32_256x32.c | 109 ++++++++++ .../de10-nano-fftsw-apps/files/c32_256x32x128.c | 113 +++++++++++ recipes-demo/de10-nano-fftsw-apps/files/c32_4096.c | 104 ++++++++++ .../de10-nano-fftsw-apps/files/clean_all.sh | 91 +++++++++ .../de10-nano-fftsw-apps/files/copy_to_target.sh | 23 +++ .../files/create_input_waveforms.sh | 60 ++++++ .../files/create_real_short_sine32.c | 38 ++++ .../files/create_real_short_square32.c | 35 ++++ .../files/create_real_short_triangle32.c | 40 ++++ .../files/de10-nano-fftsw-init.service | 10 + .../de10-nano-fftsw-apps/files/duplicate_x128.sh | 23 +++ .../de10-nano-fftsw-apps/files/duplicate_x32.sh | 23 +++ .../de10-nano-fftsw-apps/files/duplicate_x8.sh | 23 +++ recipes-demo/de10-nano-fftsw-apps/files/fft_256.c | 111 +++++++++++ .../de10-nano-fftsw-apps/files/fft_256x32.c | 113 +++++++++++ .../de10-nano-fftsw-apps/files/fft_256x32x128.c | 117 +++++++++++ recipes-demo/de10-nano-fftsw-apps/files/fft_4096.c | 111 +++++++++++ .../de10-nano-fftsw-apps/files/fftdma_256.c | 111 +++++++++++ .../de10-nano-fftsw-apps/files/fftdma_256x32.c | 113 +++++++++++ .../de10-nano-fftsw-apps/files/fftdma_256x32x128.c | 117 +++++++++++ .../de10-nano-fftsw-apps/files/fftdma_4096.c | 111 +++++++++++ .../files/images/README_IMAGES.TXT | 100 ++++++++++ .../files/images/create_gnuplot_sine_256.gnu | 28 +++ .../files/images/create_gnuplot_sine_256x32.gnu | 28 +++ .../files/images/create_gnuplot_sine_4096.gnu | 28 +++ .../files/images/create_gnuplot_squares_256.gnu | 28 +++ .../files/images/create_gnuplot_squares_256x32.gnu | 28 +++ .../files/images/create_gnuplot_squares_4096.gnu | 28 +++ .../files/images/create_gnuplot_triangle_256.gnu | 28 +++ .../images/create_gnuplot_triangle_256x32.gnu | 28 +++ .../files/images/create_gnuplot_triangle_4096.gnu | 28 +++ .../files/images/create_montage_sine_256.sh | 15 ++ .../files/images/create_montage_sine_256x32.sh | 15 ++ .../files/images/create_montage_sine_4096.sh | 15 ++ .../files/images/create_montage_squares_256.sh | 15 ++ .../files/images/create_montage_squares_256x32.sh | 15 ++ .../files/images/create_montage_squares_4096.sh | 15 ++ .../files/images/create_montage_triangle_256.sh | 15 ++ .../files/images/create_montage_triangle_256x32.sh | 15 ++ .../files/images/create_montage_triangle_4096.sh | 15 ++ .../files/ne10cpx_long_to_text.c | 48 +++++ .../files/ne10cpx_short_to_text.c | 48 +++++ .../de10-nano-fftsw-apps/files/neon16_256.c | 104 ++++++++++ .../de10-nano-fftsw-apps/files/neon16_256x32.c | 109 ++++++++++ .../de10-nano-fftsw-apps/files/neon16_256x32x128.c | 113 +++++++++++ .../de10-nano-fftsw-apps/files/neon16_4096.c | 104 ++++++++++ .../de10-nano-fftsw-apps/files/neon32_256.c | 104 ++++++++++ .../de10-nano-fftsw-apps/files/neon32_256x32.c | 109 ++++++++++ .../de10-nano-fftsw-apps/files/neon32_256x32x128.c | 113 +++++++++++ .../de10-nano-fftsw-apps/files/neon32_4096.c | 104 ++++++++++ recipes-demo/de10-nano-fftsw-apps/files/overhead.c | 219 +++++++++++++++++++++ .../files/real_short_to_ne10cpx_long.c | 58 ++++++ .../files/real_short_to_ne10cpx_short.c | 58 ++++++ recipes-demo/de10-nano-fftsw-apps/files/run_all.sh | 24 +++ .../de10-nano-fftsw-apps/files/run_fft_256.sh | 48 +++++ .../de10-nano-fftsw-apps/files/run_fft_256x32.sh | 48 +++++ .../files/run_fft_256x32x128.sh | 49 +++++ .../de10-nano-fftsw-apps/files/run_fft_4096.sh | 48 +++++ .../files/run_stream_256x16x1.sh | 31 +++ .../files/run_stream_256x1x1.sh | 31 +++ .../files/run_stream_256x32x128.sh | 31 +++ .../files/sandbox_build_all.sh | 52 +++++ .../files/sandbox_create_input_waveforms.sh | 49 +++++ .../de10-nano-fftsw-apps/files/setup_env.src | 8 + .../files/setup_target_fft_env.sh | 167 ++++++++++++++++ .../files/stream_fpga_256x16x1.c | 118 +++++++++++ .../files/stream_fpga_256x1x1.c | 118 +++++++++++ .../files/stream_fpga_256x32x128.c | 118 +++++++++++ .../files/stream_neon32_256x16x1.c | 133 +++++++++++++ .../files/stream_neon32_256x1x1.c | 133 +++++++++++++ .../files/stream_neon32_256x32x128.c | 133 +++++++++++++ .../files/stream_raw_256x16x1.c | 114 +++++++++++ .../files/stream_raw_256x1x1.c | 114 +++++++++++ .../files/stream_raw_256x32x128.c | 114 +++++++++++ .../de10-nano-fftsw-apps/files/target_build_all.sh | 84 ++++++++ .../de10-nano-fftsw-apps/files/target_build_app.sh | 95 +++++++++ .../de10-nano-fftsw-apps/files/target_build_lib.sh | 85 ++++++++ 94 files changed, 6968 insertions(+) create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/LICENSE create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/README_HOST.TXT create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/README_SANDBOX.TXT create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/README_SANDBOX_BUILD.TXT create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/README_TARGET.TXT create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/README_TARGET_BUILD.TXT create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/archive_for_target.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/archive_src_for_sandbox.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/archive_src_for_target.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/build_all.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/build_app.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/build_lib.sh create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/c16_256.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/c16_256x32.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/c16_256x32x128.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/c16_4096.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/c32_256.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/c32_256x32.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/c32_256x32x128.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/c32_4096.c create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/clean_all.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/copy_to_target.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/create_input_waveforms.sh create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/create_real_short_sine32.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/create_real_short_square32.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/create_real_short_triangle32.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/de10-nano-fftsw-init.service create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/duplicate_x128.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/duplicate_x32.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/duplicate_x8.sh create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/fft_256.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/fft_256x32.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/fft_256x32x128.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/fft_4096.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/fftdma_256.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/fftdma_256x32.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/fftdma_256x32x128.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/fftdma_4096.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/images/README_IMAGES.TXT create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_gnuplot_sine_256.gnu create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_gnuplot_sine_256x32.gnu create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_gnuplot_sine_4096.gnu create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_gnuplot_squares_256.gnu create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_gnuplot_squares_256x32.gnu create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_gnuplot_squares_4096.gnu create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_gnuplot_triangle_256.gnu create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_gnuplot_triangle_256x32.gnu create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_gnuplot_triangle_4096.gnu create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_montage_sine_256.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_montage_sine_256x32.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_montage_sine_4096.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_montage_squares_256.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_montage_squares_256x32.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_montage_squares_4096.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_montage_triangle_256.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_montage_triangle_256x32.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/images/create_montage_triangle_4096.sh create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/ne10cpx_long_to_text.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/ne10cpx_short_to_text.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/neon16_256.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/neon16_256x32.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/neon16_256x32x128.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/neon16_4096.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/neon32_256.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/neon32_256x32.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/neon32_256x32x128.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/neon32_4096.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/overhead.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/real_short_to_ne10cpx_long.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/real_short_to_ne10cpx_short.c create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/run_all.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/run_fft_256.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/run_fft_256x32.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/run_fft_256x32x128.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/run_fft_4096.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/run_stream_256x16x1.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/run_stream_256x1x1.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/run_stream_256x32x128.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/sandbox_build_all.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/sandbox_create_input_waveforms.sh create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/setup_env.src create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/setup_target_fft_env.sh create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/stream_fpga_256x16x1.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/stream_fpga_256x1x1.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/stream_fpga_256x32x128.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/stream_neon32_256x16x1.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/stream_neon32_256x1x1.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/stream_neon32_256x32x128.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/stream_raw_256x16x1.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/stream_raw_256x1x1.c create mode 100644 recipes-demo/de10-nano-fftsw-apps/files/stream_raw_256x32x128.c create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/target_build_all.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/target_build_app.sh create mode 100755 recipes-demo/de10-nano-fftsw-apps/files/target_build_lib.sh (limited to 'recipes-demo/de10-nano-fftsw-apps/files') diff --git a/recipes-demo/de10-nano-fftsw-apps/files/LICENSE b/recipes-demo/de10-nano-fftsw-apps/files/LICENSE new file mode 100644 index 0000000..ab84792 --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) +Copyright (c) 2016 Intel Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/README_HOST.TXT b/recipes-demo/de10-nano-fftsw-apps/files/README_HOST.TXT new file mode 100644 index 0000000..c068ccb --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/README_HOST.TXT @@ -0,0 +1,154 @@ +To build the applications in this directory, you should be able to run these +host scripts in this order: + +source ./setup_env.src + this will put the cross compiler tools into the PATH +./build_ne10.sh + this will build the ne10 library into a directory 'ne10' +./build_all.sh + this will build all the applications +./archive_for_target.sh + this will archive all applications and target scripts into fft.tgz for + installation on the target +./copy_to_target.sh + this will copy the fft.tgz archive and setup_target_fft_env.sh over to + the target + +Description of directory contents: + +build_ne10.sh + host script to build the ne10 library + +build_all.sh + host script to build all applications and libraries, except ne10 library + +build_app.sh + host script to build one application + +build_lib.sh + host script to build one library + +clean_all.sh + host script to clean all build objects + +archive_for_target.sh + host script to archive all applications and scripts for target + installation + +copy_to_target.sh + host script that copies fft.tgz archive and setup_target_fft_env.sh + script over to the target + +create_input_waveforms.sh + target script that executes waveform creation applications and + duplication scripts to create all input waveforms for the applications + to consume + +duplicate_x128.sh +duplicate_x32.sh +duplicate_x8.sh + these target scripts duplicate a file x8, x32 or x128 times. These are + used to replicate the fundamental waveforms into longer patterns + +images/ + this directory contains host scripts to create PNG images of waveform + data text files using gnu plot and montage from imagemagick + +run_all.sh +run_fft_256.sh +run_fft_256x32.sh +run_fft_256x32x128.sh +run_fft_4096.sh +run_stream_256x32x128.sh +run_stream_256x16x1.sh +run_stream_256x1x1.sh + these target scripts execute all of the various permutations of the demo + applications mentioned below + +setup_target_fft_env.sh + this target script is used to extract the fft.tgz archive onto the ram + disk mounted at /mnt/ram + +overhead.c + this is the source for the overhead library that all of the applications + are linked against + +c16_256.c +c16_256x32.c +c16_256x32x128.c +c16_4096.c + these applications use the NE10 C functions to implement the FFT + algorithm for a variety of input sample sizes with 16-bit resolution + +c32_256.c +c32_256x32.c +c32_256x32x128.c +c32_4096.c + these applications use the NE10 C functions to implement the FFT + algorithm for a variety of input sample sizes with 32-bit resolution + +fft_256.c +fft_256x32.c +fft_256x32x128.c +fft_4096.c + these applications use the FPGA logic to implement the FFT + algorithm for a variety of input sample sizes. This variant pushes + the input samples into the FPGA and pulls the results back out using + programmed I/O from the HPS Cortex A9 processor + +fftdma_256.c +fftdma_256x32.c +fftdma_256x32x128.c +fftdma_4096.c + these applications use the FPGA logic to implement the FFT + algorithm for a variety of input sample sizes. This variant moves + the input samples into the FPGA and the results back out using DMA + through the ACP port of the Cortex A9 processor + +neon16_256.c +neon16_256x32.c +neon16_256x32x128.c +neon16_4096.c + these applications use the NE10 NEON functions to implement the FFT + algorithm for a variety of input sample sizes with 16-bit resolution + +neon32_256.c +neon32_256x32.c +neon32_256x32x128.c +neon32_4096.c + these applications use the NE10 NEON functions to implement the FFT + algorithm for a variety of input sample sizes with 32-bit resolution + +stream_fpga_256x32x128.c +stream_fpga_256x16x1.c +stream_fpga_256x1x1.c +stream_neon32_256x32x128.c +stream_neon32_256x16x1.c +stream_neon32_256x1x1.c +stream_raw_256x32x128.c +stream_raw_256x16x1.c +stream_raw_256x1x1.c + these applications stream data from the FPGA into ramdisk files, the + fpga variant DMAs the input stream thru the FPGA FFT logic before it + is DMAed through the ACP port of the Cortex A9, the neon variant DMAs + the raw input data stream through the ACP port and then computes the FFT + algorithm on it before saving to the ram disk, the raw variant DMAs the + raw input data stream through the ACP port and then directly into the + ram disk + +create_real_short_sine32.c +create_real_short_square32.c +create_real_short_triangle32.c + these applications create the initial 32 samples of their respective + waveform, sine, square and triangle + +real_short_to_ne10cpx_long.c +real_short_to_ne10cpx_short.c + these applications translate the real short data format into ne10cpx + long and short format which is consumed by the demo applications + +ne10cpx_long_to_text.c +ne10cpx_short_to_text.c + these applications translate the ne10cpx long and short format binary + data into text format output which may be read by gnu plot for example + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/README_SANDBOX.TXT b/recipes-demo/de10-nano-fftsw-apps/files/README_SANDBOX.TXT new file mode 100644 index 0000000..5969cbf --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/README_SANDBOX.TXT @@ -0,0 +1,139 @@ +To build the applications in this directory, please follow the guidance provided +at the top of the README_SANDBOX_BUILD.TXT file. + +Once you have built the applications in this directory you can follow these +directions to make use of them. + +We want to run the 'fftdma_256' program and the 'neon32_256' program that we +just built. These programs require some input waveform data to feed into the +FFT algorithm and they output the real and imaginary FFT results. To create the +input waveform data we can run this script: + +sandbox# ./sandbox_create_input_waveforms.sh + +The 'sandbox_create_input_waveforms.sh' script runs a few of the utiltiy +programs that we just build along with some of the utility scripts to create +some input waveform patterns that we can feed into the 'fftdma_256' and +'neon32_256' programs. After we run this script we should see the following +output that it created: + +sandbox# ls input_waveforms/ output_waveforms/ +input_waveforms/: +ne10cpx_long_sine256.bin ne10cpx_short_sine256.bin +ne10cpx_long_square256.bin ne10cpx_short_square256.bin +ne10cpx_long_triangle256.bin ne10cpx_short_triangle256.bin + +output_waveforms/: + +The 'fftdma_256' program consumes 16-bit sample inputs which is what the +'ne10cpx_short_*.bin' files contain, and the 'neon32_256' program consumes +32-bit sample inputs which is what the 'ne10cpx_long_*.bin' files contain. + +Now we're ready to run the programs. Execute each program like this: + +sandbox# ./fftdma_256 \ + --input=input_waveforms/ne10cpx_short_sine256.bin \ + --output=output_waveforms/fftdma_256_sine.bin + +sandbox# ./neon32_256 \ + --input=input_waveforms/ne10cpx_long_sine256.bin \ + --output=output_waveforms/neon32_256_sine.bin + +And now we should see the raw binary output from the two program executions, +like this: + +sandbox# ls output_waveforms/ +fftdma_256_sine.bin neon32_256_sine.bin + +You can see the raw data by dumping it with 'hexdump -Cv', but if we really want +to "see" the data, we could also convert it into a PNG image file that we can +view with a web browser. + +To create a PNG image out of the output results, first we need to convert the +binary data into a text file that 'gnuplot' can digest. We have previously +compiled a utility program that can help us do that, the 'ne10cpx_long_to_text' +utility. We can convert the two output data files like this: + +sandbox# cat output_waveforms/fftdma_256_sine.bin | \ + ./ne10cpx_long_to_text > output_waveforms/fftdma_256_sine.txt + +sandbox# cat output_waveforms/neon32_256_sine.bin | \ + ./ne10cpx_long_to_text > output_waveforms/neon32_256_sine.txt + +And now we should see the binary output files along with the converted text +files in the output directory: + +sandbox# ls output_waveforms/ +fftdma_256_sine.bin neon32_256_sine.bin +fftdma_256_sine.txt neon32_256_sine.txt + +Next we can have gnuplot plot the data from the text files like this: + +sandbox# gnuplot -d -e ' +set terminal pngcairo background "#FFFFFF" fontscale 1.0 size 1024, 768; +set output "output_waveforms/fftdma_256_sine.png"; +set title "fftdma_256_sine"; +plot for [i=1:2] "output_waveforms/fftdma_256_sine.txt" +using i with line title columnhead;' + +sandbox# gnuplot -d -e ' +set terminal pngcairo background "#FFFFFF" fontscale 1.0 size 1024, 768; +set output "output_waveforms/neon32_256_sine.png"; +set title "neon32_256_sine"; +plot for [i=1:2] "output_waveforms/neon32_256_sine.txt" +using i with line title columnhead;' + +And now we should see the PNG files in the output directory along with the +binary and text files: + +sandbox# ls output_waveforms/ +fftdma_256_sine.bin fftdma_256_sine.txt neon32_256_sine.png +fftdma_256_sine.png neon32_256_sine.bin neon32_256_sine.txt + +Let's convert the input waveform into a PNG so that we can "see" that as well. +We follow the same steps as above. + +sandbox# cat input_waveforms/ne10cpx_long_sine256.bin | \ + ./ne10cpx_long_to_text > input_waveforms/ne10cpx_long_sine256.txt + +sandbox# gnuplot -d -e ' +set terminal pngcairo background "#FFFFFF" fontscale 1.0 size 1024, 768; +set output "input_waveforms/ne10cpx_long_sine256.png" ; +set title "input_256_sine" ; +plot for [i=1:2] "input_waveforms/ne10cpx_long_sine256.txt" +using i with line title columnhead ;' + +Now lets put all the images together into one large montage. + +sandbox# montage \ + -background '#000000' \ + -font Liberation-Mono-Regular \ + "input_waveforms/ne10cpx_long_sine256.png" \ + "output_waveforms/neon32_256_sine.png" \ + "output_waveforms/fftdma_256_sine.png" \ + -tile 1x3 \ + -geometry +5+5 \ + sines_256.png + +VIEW MONTAGE IMAGE IN WEB BROWSER +To view this montage in a web browser, we can copy it over to the images +directory that the web server is pulling from on the DE10-Nano target system. +That directory is '/usr/share/webcontent/images', so we can copy the montage +file like this: + +sandbox# cp \ + sines_256.png \ + /usr/share/webcontent/images/ + +To view the montage, we need to start a web browser on our host machine and +surf to the image on the Altas target, the montage will be visible at the +following URL: + +/images/sines_256.png + +VIEW MONTAGE IMAGE IN VNC SESSION +To view this montage in a VNC session, simply run the 'display' image viewer +application: + +sandbox# display sines_256.png + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/README_SANDBOX_BUILD.TXT b/recipes-demo/de10-nano-fftsw-apps/files/README_SANDBOX_BUILD.TXT new file mode 100644 index 0000000..be65e72 --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/README_SANDBOX_BUILD.TXT @@ -0,0 +1,59 @@ +To build the applications in this directory, you should be able to run these +target scripts in this order: + +./sandbox_build_all.sh + this will build all the applications + +At this point everything should be built. + +Description of directory contents: + +sandbox_build_all.sh + target script to build all applications and libraries + +target_build_app.sh + target script to build one application + +target_build_lib.sh + target script to build one library + +clean_all.sh + target script to clean all build objects + +create_input_waveforms.sh + target script that executes waveform creation applications and + duplication scripts to create all input waveforms for the applications + to consume + +duplicate_x8.sh + this target script duplicates a file x8 times. This is used to + replicate the fundamental waveforms into longer patterns + +overhead.c + this is the source for the overhead library that all of the applications + are linked against + +fftdma_256.c + this application uses the FPGA logic to implement the FFT + algorithm for a variety of input sample sizes. This variant moves + the input samples into the FPGA and the results back out using DMA + through the ACP port of the Cortex A9 processor + +neon32_256.c + this application uses the NE10 NEON functions to implement the FFT + algorithm for a variety of input sample sizes with 32-bit resolution + +create_real_short_sine32.c +create_real_short_square32.c +create_real_short_triangle32.c + these applications create the initial 32 samples of their respective + waveform, sine, square and triangle + +real_short_to_ne10cpx_long.c + this application translates the real short data format into ne10cpx + long and short format which is consumed by the demo applications + +ne10cpx_long_to_text.c + this application translates the ne10cpx long and short format binary + data into text format output which may be read by gnu plot for example + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/README_TARGET.TXT b/recipes-demo/de10-nano-fftsw-apps/files/README_TARGET.TXT new file mode 100644 index 0000000..a0ff7fa --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/README_TARGET.TXT @@ -0,0 +1,114 @@ +On the DE10-Nano target board, you should be able to run the following script to +install and execute the FFT example applications: + +./setup_target_fft_env.sh + this target script will ensure that the fft_driver is installed, ensure + that /mnt/ram has a 100MB tmpfs ram disk mounted, and then extract the + fft.tgz archive into /mnt/ram/fft and run the create_input_waveforms.sh + script and then runs the run_all.sh script + +Description of directory contents: + +create_input_waveforms.sh + target script that executes waveform creation applications and + duplication scripts to create all input waveforms for the applications + to consume + +duplicate_x128.sh +duplicate_x32.sh +duplicate_x8.sh + these target scripts duplicate a file x8, x32 or x128 times. These are + used to replicate the fundamental waveforms into longer patterns + +run_all.sh +run_fft_256.sh +run_fft_256x32.sh +run_fft_256x32x128.sh +run_fft_4096.sh +run_stream_256x32x128.sh + these target scripts execute all of the various permutations of the demo + applications mentioned below + +setup_target_fft_env.sh + this target script is used to extract the fft.tgz archive onto the ram + disk mounted at /mnt/ram + +c16_256 +c16_256x32 +c16_256x32x128 +c16_4096 + these applications use the NE10 C functions to implement the FFT + algorithm for a variety of input sample sizes with 16-bit resolution + +c32_256 +c32_256x32 +c32_256x32x128 +c32_4096 + these applications use the NE10 C functions to implement the FFT + algorithm for a variety of input sample sizes with 32-bit resolution + +fft_256 +fft_256x32 +fft_256x32x128 +fft_4096 + these applications use the FPGA logic to implement the FFT + algorithm for a variety of input sample sizes. This variant pushes + the input samples into the FPGA and pulls the results back out using + programmed I/O from the HPS Cortex A9 processor + +fftdma_256 +fftdma_256x32 +fftdma_256x32x128 +fftdma_4096 + these applications use the FPGA logic to implement the FFT + algorithm for a variety of input sample sizes. This variant moves + the input samples into the FPGA and the results back out using DMA + through the ACP port of the Cortex A9 processor + +neon16_256 +neon16_256x32 +neon16_256x32x128 +neon16_4096 + these applications use the NE10 NEON functions to implement the FFT + algorithm for a variety of input sample sizes with 16-bit resolution + +neon32_256 +neon32_256x32 +neon32_256x32x128 +neon32_4096 + these applications use the NE10 NEON functions to implement the FFT + algorithm for a variety of input sample sizes with 32-bit resolution + +stream_fpga_256x32x128 +stream_fpga_256x16x1 +stream_fpga_256x1x1 +stream_neon32_256x32x128 +stream_neon32_256x16x1 +stream_neon32_256x1x1 +stream_raw_256x32x128 +stream_raw_256x16x1 +stream_raw_256x1x1 + these applications stream data from the FPGA into ramdisk files, the + fpga variant DMAs the input stream thru the FPGA FFT logic before it + is DMAed through the ACP port of the Cortex A9, the neon variant DMAs + the raw input data stream through the ACP port and then computes the FFT + algorithm on it before saving to the ram disk, the raw variant DMAs the + raw input data stream through the ACP port and then directly into the + ram disk + +create_real_short_sine32 +create_real_short_square32 +create_real_short_triangle32 + these applications create the initial 32 samples of their respective + waveform, sine, square and triangle + +real_short_to_ne10cpx_long +real_short_to_ne10cpx_short + these applications translate the real short data format into ne10cpx + long and short format which is consumed by the demo applications + +ne10cpx_long_to_text +ne10cpx_short_to_text + these applications translate the ne10cpx long and short format binary + data into text format output which may be read by gnu plot for example + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/README_TARGET_BUILD.TXT b/recipes-demo/de10-nano-fftsw-apps/files/README_TARGET_BUILD.TXT new file mode 100644 index 0000000..a69cae3 --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/README_TARGET_BUILD.TXT @@ -0,0 +1,151 @@ +To build the applications in this directory, you should be able to run these +target scripts in this order: + +./target_build_all.sh + this will build all the applications +./archive_for_target.sh + this will archive all applications and target scripts into fft.tgz for + installation on the target + +At this point everything should be built. If you'd like to install and run +everything you can run this script: + +./setup_target_fft_env.sh + this target script will ensure that the fft_driver is installed, ensure + that /mnt/ram has a 100MB tmpfs ram disk mounted, and then extract the + fft.tgz archive into /mnt/ram/fft and run the create_input_waveforms.sh + script and then runs the run_all.sh script + +NOTE: see the README_TARGET.TXT file for additional information + +Description of directory contents: + +target_build_all.sh + target script to build all applications and libraries + +target_build_app.sh + target script to build one application + +target_build_lib.sh + target script to build one library + +clean_all.sh + target script to clean all build objects + +archive_for_target.sh + target script to archive all applications and scripts for target + installation + +create_input_waveforms.sh + target script that executes waveform creation applications and + duplication scripts to create all input waveforms for the applications + to consume + +duplicate_x128.sh +duplicate_x32.sh +duplicate_x8.sh + these target scripts duplicate a file x8, x32 or x128 times. These are + used to replicate the fundamental waveforms into longer patterns + +images/ + this directory contains host scripts to create PNG images of waveform + data text files using gnu plot and montage from imagemagick + +run_all.sh +run_fft_256.sh +run_fft_256x32.sh +run_fft_256x32x128.sh +run_fft_4096.sh +run_stream_256x32x128.sh +run_stream_256x16x1.sh +run_stream_256x1x1.sh + these target scripts execute all of the various permutations of the demo + applications mentioned below + +setup_target_fft_env.sh + this target script is used to extract the fft.tgz archive onto the ram + disk mounted at /mnt/ram + +overhead.c + this is the source for the overhead library that all of the applications + are linked against + +c16_256.c +c16_256x32.c +c16_256x32x128.c +c16_4096.c + these applications use the NE10 C functions to implement the FFT + algorithm for a variety of input sample sizes with 16-bit resolution + +c32_256.c +c32_256x32.c +c32_256x32x128.c +c32_4096.c + these applications use the NE10 C functions to implement the FFT + algorithm for a variety of input sample sizes with 32-bit resolution + +fft_256.c +fft_256x32.c +fft_256x32x128.c +fft_4096.c + these applications use the FPGA logic to implement the FFT + algorithm for a variety of input sample sizes. This variant pushes + the input samples into the FPGA and pulls the results back out using + programmed I/O from the HPS Cortex A9 processor + +fftdma_256.c +fftdma_256x32.c +fftdma_256x32x128.c +fftdma_4096.c + these applications use the FPGA logic to implement the FFT + algorithm for a variety of input sample sizes. This variant moves + the input samples into the FPGA and the results back out using DMA + through the ACP port of the Cortex A9 processor + +neon16_256.c +neon16_256x32.c +neon16_256x32x128.c +neon16_4096.c + these applications use the NE10 NEON functions to implement the FFT + algorithm for a variety of input sample sizes with 16-bit resolution + +neon32_256.c +neon32_256x32.c +neon32_256x32x128.c +neon32_4096.c + these applications use the NE10 NEON functions to implement the FFT + algorithm for a variety of input sample sizes with 32-bit resolution + +stream_fpga_256x32x128.c +stream_fpga_256x16x1.c +stream_fpga_256x1x1.c +stream_neon32_256x32x128.c +stream_neon32_256x16x1.c +stream_neon32_256x1x1.c +stream_raw_256x32x128.c +stream_raw_256x16x1.c +stream_raw_256x1x1.c + these applications stream data from the FPGA into ramdisk files, the + fpga variant DMAs the input stream thru the FPGA FFT logic before it + is DMAed through the ACP port of the Cortex A9, the neon variant DMAs + the raw input data stream through the ACP port and then computes the FFT + algorithm on it before saving to the ram disk, the raw variant DMAs the + raw input data stream through the ACP port and then directly into the + ram disk + +create_real_short_sine32.c +create_real_short_square32.c +create_real_short_triangle32.c + these applications create the initial 32 samples of their respective + waveform, sine, square and triangle + +real_short_to_ne10cpx_long.c +real_short_to_ne10cpx_short.c + these applications translate the real short data format into ne10cpx + long and short format which is consumed by the demo applications + +ne10cpx_long_to_text.c +ne10cpx_short_to_text.c + these applications translate the ne10cpx long and short format binary + data into text format output which may be read by gnu plot for example + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/archive_for_target.sh b/recipes-demo/de10-nano-fftsw-apps/files/archive_for_target.sh new file mode 100755 index 0000000..c3de93d --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/archive_for_target.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +COPY_LIST=" +README_TARGET.TXT +create_input_waveforms.sh +duplicate_x128.sh +duplicate_x32.sh +duplicate_x8.sh +run_all.sh +run_fft_256.sh +run_fft_4096.sh +run_fft_256x32.sh +run_fft_256x32x128.sh +run_stream_256x32x128.sh +run_stream_256x16x1.sh +run_stream_256x1x1.sh +create_real_short_sine32 +create_real_short_square32 +create_real_short_triangle32 +real_short_to_ne10cpx_long +real_short_to_ne10cpx_short +ne10cpx_short_to_text +ne10cpx_long_to_text +c16_256 +c32_256 +fft_256 +fftdma_256 +neon16_256 +neon32_256 +c16_4096 +c32_4096 +fft_4096 +fftdma_4096 +neon16_4096 +neon32_4096 +c16_256x32 +c32_256x32 +fft_256x32 +fftdma_256x32 +neon16_256x32 +neon32_256x32 +c16_256x32x128 +c32_256x32x128 +fft_256x32x128 +fftdma_256x32x128 +neon16_256x32x128 +neon32_256x32x128 +stream_fpga_256x32x128 +stream_fpga_256x16x1 +stream_fpga_256x1x1 +stream_neon32_256x32x128 +stream_neon32_256x16x1 +stream_neon32_256x1x1 +stream_raw_256x32x128 +stream_raw_256x16x1 +stream_raw_256x1x1 +" + +for NEXT in ${COPY_LIST} +do + [ -f "${NEXT}" ] || { + echo "File: '${NEXT}' in copy list was not found." + exit 1 + } +done + +tar czf fft.tgz ${COPY_LIST} + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/archive_src_for_sandbox.sh b/recipes-demo/de10-nano-fftsw-apps/files/archive_src_for_sandbox.sh new file mode 100755 index 0000000..31f399a --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/archive_src_for_sandbox.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +COPY_LIST=" +LICENSE +create_real_short_sine32.c +create_real_short_square32.c +create_real_short_triangle32.c +fftdma_256.c +ne10cpx_long_to_text.c +neon32_256.c +overhead.c +real_short_to_ne10cpx_long.c +real_short_to_ne10cpx_short.c +README_SANDBOX_BUILD.TXT +README_SANDBOX.TXT +clean_all.sh +sandbox_create_input_waveforms.sh +duplicate_x8.sh +sandbox_build_all.sh +target_build_app.sh +target_build_lib.sh +" + +for NEXT in ${COPY_LIST} +do + [ -f "${NEXT}" ] || { + echo "File: '${NEXT}' in copy list was not found." + exit 1 + } +done + +tar czf fft_sandbox.tgz ${COPY_LIST} + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/archive_src_for_target.sh b/recipes-demo/de10-nano-fftsw-apps/files/archive_src_for_target.sh new file mode 100755 index 0000000..1c7a681 --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/archive_src_for_target.sh @@ -0,0 +1,96 @@ +#!/bin/sh + +COPY_LIST=" +LICENSE +c16_256.c +c16_256x32.c +c16_256x32x128.c +c16_4096.c +c32_256.c +c32_256x32.c +c32_256x32x128.c +c32_4096.c +create_real_short_sine32.c +create_real_short_square32.c +create_real_short_triangle32.c +fft_256.c +fft_256x32.c +fft_256x32x128.c +fft_4096.c +fftdma_256.c +fftdma_256x32.c +fftdma_256x32x128.c +fftdma_4096.c +ne10cpx_long_to_text.c +ne10cpx_short_to_text.c +neon16_256.c +neon16_256x32.c +neon16_256x32x128.c +neon16_4096.c +neon32_256.c +neon32_256x32.c +neon32_256x32x128.c +neon32_4096.c +overhead.c +real_short_to_ne10cpx_long.c +real_short_to_ne10cpx_short.c +stream_fpga_256x32x128.c +stream_fpga_256x16x1.c +stream_fpga_256x1x1.c +stream_neon32_256x32x128.c +stream_neon32_256x16x1.c +stream_neon32_256x1x1.c +stream_raw_256x32x128.c +stream_raw_256x16x1.c +stream_raw_256x1x1.c +archive_for_target.sh +README_TARGET_BUILD.TXT +README_TARGET.TXT +clean_all.sh +create_input_waveforms.sh +duplicate_x128.sh +duplicate_x32.sh +duplicate_x8.sh +run_all.sh +run_fft_256.sh +run_fft_256x32.sh +run_fft_256x32x128.sh +run_fft_4096.sh +run_stream_256x32x128.sh +run_stream_256x16x1.sh +run_stream_256x1x1.sh +setup_target_fft_env.sh +target_build_all.sh +target_build_app.sh +target_build_lib.sh +images/create_gnuplot_sine_256.gnu +images/create_gnuplot_sine_256x32.gnu +images/create_gnuplot_sine_4096.gnu +images/create_gnuplot_squares_256.gnu +images/create_gnuplot_squares_256x32.gnu +images/create_gnuplot_squares_4096.gnu +images/create_gnuplot_triangle_256.gnu +images/create_gnuplot_triangle_256x32.gnu +images/create_gnuplot_triangle_4096.gnu +images/create_montage_sine_256.sh +images/create_montage_sine_256x32.sh +images/create_montage_sine_4096.sh +images/create_montage_squares_256.sh +images/create_montage_squares_256x32.sh +images/create_montage_squares_4096.sh +images/create_montage_triangle_256.sh +images/create_montage_triangle_256x32.sh +images/create_montage_triangle_4096.sh +images/README_IMAGES.TXT +" + +for NEXT in ${COPY_LIST} +do + [ -f "${NEXT}" ] || { + echo "File: '${NEXT}' in copy list was not found." + exit 1 + } +done + +tar czf fft_src.tgz ${COPY_LIST} + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/build_all.sh b/recipes-demo/de10-nano-fftsw-apps/files/build_all.sh new file mode 100755 index 0000000..5811c7d --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/build_all.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +APP_LIST=" +create_real_short_sine32 +create_real_short_square32 +create_real_short_triangle32 +real_short_to_ne10cpx_long +real_short_to_ne10cpx_short +ne10cpx_short_to_text +ne10cpx_long_to_text +c16_256 +c32_256 +fft_256 +fftdma_256 +neon16_256 +neon32_256 +c16_4096 +c32_4096 +fft_4096 +fftdma_4096 +neon16_4096 +neon32_4096 +c16_256x32 +c32_256x32 +fft_256x32 +fftdma_256x32 +neon16_256x32 +neon32_256x32 +c16_256x32x128 +c32_256x32x128 +fft_256x32x128 +fftdma_256x32x128 +neon16_256x32x128 +neon32_256x32x128 +stream_fpga_256x32x128 +stream_fpga_256x16x1 +stream_fpga_256x1x1 +stream_neon32_256x32x128 +stream_neon32_256x16x1 +stream_neon32_256x1x1 +stream_raw_256x32x128 +stream_raw_256x16x1 +stream_raw_256x1x1 +" + +LIB_LIST=" +overhead +" + +CC_TEST="${CC:?}" +type -t ${CC%${CC#*gcc}} > /dev/null 2>&1 || { + echo "" + echo "ERROR: cross compiler tools are not visible in the environment." + echo "" + exit 1 +} + +THE_SYSROOT="$(${CC:?} -print-sysroot)" + +[ -f "${THE_SYSROOT:?}${includedir:?}/NE10.h" ] || { + echo "" + echo "ERROR: cannot locate include file 'NE10.h'." + echo "ERROR: '${THE_SYSROOT:?}${includedir:?}/NE10.h'" + echo "" + exit 1 +} + +[ -f "${THE_SYSROOT:?}${libdir:?}/libNE10.so" ] || { + echo "" + echo "ERROR: cannot locate library archive 'libNE10.so'." + echo "ERROR: '${THE_SYSROOT:?}${libdir:?}/libNE10.so'" + echo "" + exit 1 +} + +for NEXT in ${LIB_LIST} +do + ./build_lib.sh "${NEXT}" +done + +for NEXT in ${APP_LIST} +do + ./build_app.sh "${NEXT}" +done + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/build_app.sh b/recipes-demo/de10-nano-fftsw-apps/files/build_app.sh new file mode 100755 index 0000000..d64b347 --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/build_app.sh @@ -0,0 +1,104 @@ +#!/bin/sh + +CC_TEST="${CC:?}" +type -t ${CC%${CC#*gcc}} > /dev/null 2>&1 || { + echo "" + echo "ERROR: cross compiler tools are not visible in the environment." + echo "" + exit 1 +} + +THE_SYSROOT="$(${CC:?} -print-sysroot)" + +[ -f "${THE_SYSROOT:?}${includedir:?}/NE10.h" ] || { + echo "" + echo "ERROR: cannot locate include file 'NE10.h'." + echo "ERROR: '${THE_SYSROOT:?}${includedir:?}/NE10.h'" + echo "" + exit 1 +} + +[ -f "${THE_SYSROOT:?}${libdir:?}/libNE10.so" ] || { + echo "" + echo "ERROR: cannot locate library archive 'libNE10.so'." + echo "ERROR: '${THE_SYSROOT:?}${libdir:?}/libNE10.so'" + echo "" + exit 1 +} + +[ "$#" -eq "1" ] || { + echo "" + echo "USAGE: ${0} " + echo "" + exit 1 +} + +[ -e "${1}" ] && { + echo "" + echo "${1} already exists" + echo "please remove it and try again" + echo "rm ${1}" + echo "" + exit 1 +} + +[ -e "${1}.c" ] || { + echo "" + echo "${1}.c does not exists" + echo "cannot compile it" + echo "" + exit 1 +} + +${CC:?} \ + -march=armv7-a \ + -mfloat-abi=hard \ + -mfpu=neon \ + -mthumb-interwork \ + -mthumb \ + -O2 -D_FORTIFY_SOURCE=2 \ + -g \ + -feliminate-unused-debug-types \ + -std=gnu99 \ + -W \ + -Wall \ + -Werror \ + -Wc++-compat \ + -Wwrite-strings \ + -Wstrict-prototypes \ + -Wformat -Wformat-security \ + -pedantic \ + -fstack-protector-strong \ + -z noexecstack \ + -z relro -z now \ + -o "${1}.o" \ + -c \ + "${1}.c" + +[ "${1}.c" -nt "${1}.o" ] && { + echo "" + echo "${1}.c is newer than ${1}.o" + echo "cannot link it" + echo "" + exit 1 +} + +${CXX:?} \ + -march=armv7-a \ + -mfloat-abi=hard \ + -mfpu=neon \ + -mthumb-interwork \ + -mthumb \ + -O2 -D_FORTIFY_SOURCE=2 \ + -Wformat -Wformat-security \ + -fstack-protector-strong \ + -z noexecstack \ + -z relro -z now \ + -g \ + "${1}.o" \ + -o "${1}" \ + -L. \ + -loverhead \ + -lNE10 \ + -lm + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/build_lib.sh b/recipes-demo/de10-nano-fftsw-apps/files/build_lib.sh new file mode 100755 index 0000000..a6b2878 --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/build_lib.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +CC_TEST="${CC:?}" +type -t ${CC%${CC#*gcc}} > /dev/null 2>&1 || { + echo "" + echo "ERROR: cross compiler tools are not visible in the environment." + echo "" + exit 1 +} + +THE_SYSROOT="$(${CC:?} -print-sysroot)" + +[ -f "${THE_SYSROOT:?}${includedir:?}/NE10.h" ] || { + echo "" + echo "ERROR: cannot locate include file 'NE10.h'." + echo "ERROR: '${THE_SYSROOT:?}${includedir:?}/NE10.h'" + echo "" + exit 1 +} + +[ -f "${THE_SYSROOT:?}${libdir:?}/libNE10.so" ] || { + echo "" + echo "ERROR: cannot locate library archive 'libNE10.so'." + echo "ERROR: '${THE_SYSROOT:?}${libdir:?}/libNE10.so'" + echo "" + exit 1 +} + +[ "$#" -eq "1" ] || { + echo "" + echo "USAGE: ${0} " + echo "" + exit 1 +} + +[ -e "lib${1}.a" ] && { + echo "" + echo "lib${1}.a already exists" + echo "please remove it and try again" + echo "rm lib${1}.a" + echo "" + exit 1 +} + +[ -e "${1}.c" ] || { + echo "" + echo "${1}.c does not exists" + echo "cannot compile it" + echo "" + exit 1 +} + +${CC:?} \ + -march=armv7-a \ + -mfloat-abi=hard \ + -mfpu=neon \ + -mthumb-interwork \ + -mthumb \ + -O2 -D_FORTIFY_SOURCE=2 \ + -g \ + -feliminate-unused-debug-types \ + -std=gnu99 \ + -W \ + -Wall \ + -Werror \ + -Wc++-compat \ + -Wwrite-strings \ + -Wstrict-prototypes \ + -Wformat -Wformat-security \ + -pedantic \ + -fstack-protector-strong \ + -z noexecstack \ + -z relro -z now \ + -o "${1}.o" \ + -c \ + "${1}.c" + +[ "${1}.c" -nt "${1}.o" ] && { + echo "" + echo "${1}.c is newer than ${1}.o" + echo "cannot archive it" + echo "" + exit 1 +} + +${AR:?} \ + -r \ + "lib${1}.a" \ + "${1}.o" + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/c16_256.c b/recipes-demo/de10-nano-fftsw-apps/files/c16_256.c new file mode 100644 index 0000000..a27064a --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/c16_256.c @@ -0,0 +1,104 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "NE10.h" + +/* customize these macros and variables for a particular implementation */ +#define FFT_POINTS (256) +#define IN_SAMPLE_TYPE ne10_fft_cpx_int16_t +#define OUT_SAMPLE_TYPE ne10_fft_cpx_int16_t +#define CFG_TYPE ne10_fft_cfg_int16_t +#define CFG_ALLOC_FUNC ne10_fft_alloc_c2c_int16 +#define FFT_FUNC ne10_fft_c2c_1d_int16_c + +const char *g_test = "c16_256"; +const char *g_description = "256 point FFT, C implementation, 16-bit precision"; + +/* these functions and variables are implemented in overhead.c as a library */ +extern void initialize_everything(int argc, char **argv); +extern uint64_t get_gt_value(void); +extern void release_everything(void); +extern void print_results(void); + +extern char *g_input_filename; +extern char *g_output_filename; +extern uint64_t g_start_time; +extern uint64_t g_end_time; + +int main(int argc, char **argv) +{ + int input_fd; + int output_fd; + int result; + IN_SAMPLE_TYPE *in_buf; + OUT_SAMPLE_TYPE *out_buf; + CFG_TYPE cfg; + + initialize_everything(argc, argv); + + /* allocate storage for input, output and config buffers */ + in_buf = (IN_SAMPLE_TYPE*) NE10_MALLOC (FFT_POINTS * sizeof(IN_SAMPLE_TYPE)); + if(in_buf == NULL) + error(1, errno, "in_buf allocation"); + + out_buf = (OUT_SAMPLE_TYPE*) NE10_MALLOC (FFT_POINTS * sizeof(OUT_SAMPLE_TYPE)); + if(out_buf == NULL) + error(1, errno, "out_buf allocation"); + + cfg = CFG_ALLOC_FUNC(FFT_POINTS); + if(cfg == NULL) + error(1, errno, "cfg allocation"); + + /* open the input and output files */ + input_fd = open(g_input_filename, O_RDONLY); + if(input_fd < 0) + error(1, errno, "opening input file '%s'", g_input_filename); + + output_fd = open(g_output_filename, O_WRONLY | O_CREAT, ~((mode_t)umask)); + if(output_fd < 0) + error(1, errno, "opening output file '%s'", g_output_filename); + + /* capture the start value of the GT */ + g_start_time = get_gt_value(); + + /* read the input data */ + result = read(input_fd, in_buf, FFT_POINTS * sizeof(IN_SAMPLE_TYPE)); + if(result < 0) + error(1, errno, "read input file"); + if(result != (FFT_POINTS * sizeof(IN_SAMPLE_TYPE))) + error(1, 0, "input data size, expected %d but got %d", FFT_POINTS * sizeof(IN_SAMPLE_TYPE), result); + + /* compute FFT */ + FFT_FUNC(out_buf, in_buf, cfg, 0, 1); + + /* write the output data */ + result = write(output_fd, out_buf, FFT_POINTS * sizeof(OUT_SAMPLE_TYPE)); + if(result < 0) + error(1, errno, "write output file"); + if(result != (FFT_POINTS * sizeof(OUT_SAMPLE_TYPE))) + error(1, 0, "output data size, expected %d but got %d", FFT_POINTS * sizeof(OUT_SAMPLE_TYPE), result); + + /* capture the end value of the GT */ + g_end_time = get_gt_value(); + + /* close the input and output files */ + close(output_fd); + close(input_fd); + + /* free storage for input, output and config buffers */ + NE10_FREE (cfg); + NE10_FREE (out_buf); + NE10_FREE (in_buf); + + print_results(); + release_everything(); + return 0; +} + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/c16_256x32.c b/recipes-demo/de10-nano-fftsw-apps/files/c16_256x32.c new file mode 100644 index 0000000..5ea2893 --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/c16_256x32.c @@ -0,0 +1,109 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "NE10.h" + +/* customize these macros and variables for a particular implementation */ +#define FFT_CALC_POINTS (256) +#define FFT_CALC_ROUNDS (32) +#define FFT_POINTS (FFT_CALC_POINTS * FFT_CALC_ROUNDS) +#define IN_SAMPLE_TYPE ne10_fft_cpx_int16_t +#define OUT_SAMPLE_TYPE ne10_fft_cpx_int16_t +#define CFG_TYPE ne10_fft_cfg_int16_t +#define CFG_ALLOC_FUNC ne10_fft_alloc_c2c_int16 +#define FFT_FUNC ne10_fft_c2c_1d_int16_c + +const char *g_test = "c16_256x32"; +const char *g_description = "256x32 point FFT, C implementation, 16-bit precision"; + +/* these functions and variables are implemented in overhead.c as a library */ +extern void initialize_everything(int argc, char **argv); +extern uint64_t get_gt_value(void); +extern void release_everything(void); +extern void print_results(void); + +extern char *g_input_filename; +extern char *g_output_filename; +extern uint64_t g_start_time; +extern uint64_t g_end_time; + +int main(int argc, char **argv) +{ + int input_fd; + int output_fd; + int result; + IN_SAMPLE_TYPE *in_buf; + OUT_SAMPLE_TYPE *out_buf; + CFG_TYPE cfg; + int i; + + initialize_everything(argc, argv); + + /* allocate storage for input, output and config buffers */ + in_buf = (IN_SAMPLE_TYPE*) NE10_MALLOC (FFT_POINTS * sizeof(IN_SAMPLE_TYPE)); + if(in_buf == NULL) + error(1, errno, "in_buf allocation"); + + out_buf = (OUT_SAMPLE_TYPE*) NE10_MALLOC (FFT_POINTS * sizeof(OUT_SAMPLE_TYPE)); + if(out_buf == NULL) + error(1, errno, "out_buf allocation"); + + cfg = CFG_ALLOC_FUNC(FFT_CALC_POINTS); + if(cfg == NULL) + error(1, errno, "cfg allocation"); + + /* open the input and output files */ + input_fd = open(g_input_filename, O_RDONLY); + if(input_fd < 0) + error(1, errno, "opening input file '%s'", g_input_filename); + + output_fd = open(g_output_filename, O_WRONLY | O_CREAT, ~((mode_t)umask)); + if(output_fd < 0) + error(1, errno, "opening output file '%s'", g_output_filename); + + /* capture the start value of the GT */ + g_start_time = get_gt_value(); + + /* read the input data */ + result = read(input_fd, in_buf, FFT_POINTS * sizeof(IN_SAMPLE_TYPE)); + if(result < 0) + error(1, errno, "read input file"); + if(result != (FFT_POINTS * sizeof(IN_SAMPLE_TYPE))) + error(1, 0, "input data size, expected %d but got %d", FFT_POINTS * sizeof(IN_SAMPLE_TYPE), result); + + /* compute FFT */ + for (i = 0; i < FFT_CALC_ROUNDS ; i++) { + FFT_FUNC(out_buf + (i * FFT_CALC_POINTS), in_buf + (i * FFT_CALC_POINTS), cfg, 0, 1); + } + + /* write the output data */ + result = write(output_fd, out_buf, FFT_POINTS * sizeof(OUT_SAMPLE_TYPE)); + if(result < 0) + error(1, errno, "write output file"); + if(result != (FFT_POINTS * sizeof(OUT_SAMPLE_TYPE))) + error(1, 0, "output data size, expected %d but got %d", FFT_POINTS * sizeof(OUT_SAMPLE_TYPE), result); + + /* capture the end value of the GT */ + g_end_time = get_gt_value(); + + /* close the input and output files */ + close(output_fd); + close(input_fd); + + /* free storage for input, output and config buffers */ + NE10_FREE (cfg); + NE10_FREE (out_buf); + NE10_FREE (in_buf); + + print_results(); + release_everything(); + return 0; +} + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/c16_256x32x128.c b/recipes-demo/de10-nano-fftsw-apps/files/c16_256x32x128.c new file mode 100644 index 0000000..c015f80 --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/c16_256x32x128.c @@ -0,0 +1,113 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "NE10.h" + +/* customize these macros and variables for a particular implementation */ +#define FFT_IN_ROUNDS (128) +#define FFT_CALC_POINTS (256) +#define FFT_CALC_ROUNDS (32) +#define FFT_POINTS (FFT_CALC_POINTS * FFT_CALC_ROUNDS) +#define IN_SAMPLE_TYPE ne10_fft_cpx_int16_t +#define OUT_SAMPLE_TYPE ne10_fft_cpx_int16_t +#define CFG_TYPE ne10_fft_cfg_int16_t +#define CFG_ALLOC_FUNC ne10_fft_alloc_c2c_int16 +#define FFT_FUNC ne10_fft_c2c_1d_int16_c + +const char *g_test = "c16_256x32x128"; +const char *g_description = "256x32x128 point FFT, C implementation, 16-bit precision"; + +/* these functions and variables are implemented in overhead.c as a library */ +extern void initialize_everything(int argc, char **argv); +extern uint64_t get_gt_value(void); +extern void release_everything(void); +extern void print_results(void); + +extern char *g_input_filename; +extern char *g_output_filename; +extern uint64_t g_start_time; +extern uint64_t g_end_time; + +int main(int argc, char **argv) +{ + int input_fd; + int output_fd; + int result; + IN_SAMPLE_TYPE *in_buf; + OUT_SAMPLE_TYPE *out_buf; + CFG_TYPE cfg; + int i; + int j; + + initialize_everything(argc, argv); + + /* allocate storage for input, output and config buffers */ + in_buf = (IN_SAMPLE_TYPE*) NE10_MALLOC (FFT_POINTS * sizeof(IN_SAMPLE_TYPE)); + if(in_buf == NULL) + error(1, errno, "in_buf allocation"); + + out_buf = (OUT_SAMPLE_TYPE*) NE10_MALLOC (FFT_POINTS * sizeof(OUT_SAMPLE_TYPE)); + if(out_buf == NULL) + error(1, errno, "out_buf allocation"); + + cfg = CFG_ALLOC_FUNC(FFT_CALC_POINTS); + if(cfg == NULL) + error(1, errno, "cfg allocation"); + + /* open the input and output files */ + input_fd = open(g_input_filename, O_RDONLY); + if(input_fd < 0) + error(1, errno, "opening input file '%s'", g_input_filename); + + output_fd = open(g_output_filename, O_WRONLY | O_CREAT, ~((mode_t)umask)); + if(output_fd < 0) + error(1, errno, "opening output file '%s'", g_output_filename); + + /* capture the start value of the GT */ + g_start_time = get_gt_value(); + + for(j = 0 ; j < FFT_IN_ROUNDS ; j++) { + /* read the input data */ + result = read(input_fd, in_buf, FFT_POINTS * sizeof(IN_SAMPLE_TYPE)); + if(result < 0) + error(1, errno, "read input file"); + if(result != (FFT_POINTS * sizeof(IN_SAMPLE_TYPE))) + error(1, 0, "input data size, expected %d but got %d", FFT_POINTS * sizeof(IN_SAMPLE_TYPE), result); + + /* compute FFT */ + for (i = 0; i < FFT_CALC_ROUNDS ; i++) { + FFT_FUNC(out_buf + (i * FFT_CALC_POINTS), in_buf + (i * FFT_CALC_POINTS), cfg, 0, 1); + } + + /* write the output data */ + result = write(output_fd, out_buf, FFT_POINTS * sizeof(OUT_SAMPLE_TYPE)); + if(result < 0) + error(1, errno, "write output file"); + if(result != (FFT_POINTS * sizeof(OUT_SAMPLE_TYPE))) + error(1, 0, "output data size, expected %d but got %d", FFT_POINTS * sizeof(OUT_SAMPLE_TYPE), result); + } + + /* capture the end value of the GT */ + g_end_time = get_gt_value(); + + /* close the input and output files */ + close(output_fd); + close(input_fd); + + /* free storage for input, output and config buffers */ + NE10_FREE (cfg); + NE10_FREE (out_buf); + NE10_FREE (in_buf); + + print_results(); + release_everything(); + return 0; +} + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/c16_4096.c b/recipes-demo/de10-nano-fftsw-apps/files/c16_4096.c new file mode 100644 index 0000000..b2922ed --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/c16_4096.c @@ -0,0 +1,104 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "NE10.h" + +/* customize these macros and variables for a particular implementation */ +#define FFT_POINTS (4096) +#define IN_SAMPLE_TYPE ne10_fft_cpx_int16_t +#define OUT_SAMPLE_TYPE ne10_fft_cpx_int16_t +#define CFG_TYPE ne10_fft_cfg_int16_t +#define CFG_ALLOC_FUNC ne10_fft_alloc_c2c_int16 +#define FFT_FUNC ne10_fft_c2c_1d_int16_c + +const char *g_test = "c16_4096"; +const char *g_description = "4096 point FFT, C implementation, 16-bit precision"; + +/* these functions and variables are implemented in overhead.c as a library */ +extern void initialize_everything(int argc, char **argv); +extern uint64_t get_gt_value(void); +extern void release_everything(void); +extern void print_results(void); + +extern char *g_input_filename; +extern char *g_output_filename; +extern uint64_t g_start_time; +extern uint64_t g_end_time; + +int main(int argc, char **argv) +{ + int input_fd; + int output_fd; + int result; + IN_SAMPLE_TYPE *in_buf; + OUT_SAMPLE_TYPE *out_buf; + CFG_TYPE cfg; + + initialize_everything(argc, argv); + + /* allocate storage for input, output and config buffers */ + in_buf = (IN_SAMPLE_TYPE*) NE10_MALLOC (FFT_POINTS * sizeof(IN_SAMPLE_TYPE)); + if(in_buf == NULL) + error(1, errno, "in_buf allocation"); + + out_buf = (OUT_SAMPLE_TYPE*) NE10_MALLOC (FFT_POINTS * sizeof(OUT_SAMPLE_TYPE)); + if(out_buf == NULL) + error(1, errno, "out_buf allocation"); + + cfg = CFG_ALLOC_FUNC(FFT_POINTS); + if(cfg == NULL) + error(1, errno, "cfg allocation"); + + /* open the input and output files */ + input_fd = open(g_input_filename, O_RDONLY); + if(input_fd < 0) + error(1, errno, "opening input file '%s'", g_input_filename); + + output_fd = open(g_output_filename, O_WRONLY | O_CREAT, ~((mode_t)umask)); + if(output_fd < 0) + error(1, errno, "opening output file '%s'", g_output_filename); + + /* capture the start value of the GT */ + g_start_time = get_gt_value(); + + /* read the input data */ + result = read(input_fd, in_buf, FFT_POINTS * sizeof(IN_SAMPLE_TYPE)); + if(result < 0) + error(1, errno, "read input file"); + if(result != (FFT_POINTS * sizeof(IN_SAMPLE_TYPE))) + error(1, 0, "input data size, expected %d but got %d", FFT_POINTS * sizeof(IN_SAMPLE_TYPE), result); + + /* compute FFT */ + FFT_FUNC(out_buf, in_buf, cfg, 0, 1); + + /* write the output data */ + result = write(output_fd, out_buf, FFT_POINTS * sizeof(OUT_SAMPLE_TYPE)); + if(result < 0) + error(1, errno, "write output file"); + if(result != (FFT_POINTS * sizeof(OUT_SAMPLE_TYPE))) + error(1, 0, "output data size, expected %d but got %d", FFT_POINTS * sizeof(OUT_SAMPLE_TYPE), result); + + /* capture the end value of the GT */ + g_end_time = get_gt_value(); + + /* close the input and output files */ + close(output_fd); + close(input_fd); + + /* free storage for input, output and config buffers */ + NE10_FREE (cfg); + NE10_FREE (out_buf); + NE10_FREE (in_buf); + + print_results(); + release_everything(); + return 0; +} + diff --git a/recipes-demo/de10-nano-fftsw-apps/files/c32_256.c b/recipes-demo/de10-nano-fftsw-apps/files/c32_256.c new file mode 100644 index 0000000..557e064 --- /dev/null +++ b/recipes-demo/de10-nano-fftsw-apps/files/c32_256.c @@ -0,0 +1,104 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "NE10.h" + +/* customize these macros and variables for a particular implementation */ +#define FFT_POINTS (256) +#define IN_SAMPLE_TYPE ne10_fft_cpx_int32_t +#define OUT_SAMPLE_TYPE ne10_fft_cpx_int32_t +#define CF