UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
3,109 Views
Registered: ‎08-26-2014

Why this code does not compile the hardware accelerator in SDSoC?

Hello,

 

I have a function which reads an input array and return the array. I have removed everything and let these simple lines of code. However, it still giving an unexpected error while the code in HLS works flawlesly.

 

Does anyone know where is the problem?

 

 


#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <ap_int.h>
//#include <ap_cint.h>
#include <xstatus.h>
#include <ff.h>
#include "SDcard_interface_v04.h"
#include "xparameters.h"
#include "xscutimer.h"
//#include "AxiTimerHelper.h"

//#define __SDSCC__

#ifdef __SDSCC__
    #include "sds_lib.h"
#else
    #define sds_alloc(x) (malloc(x))
    #define sds_free(x) (free(x))
#endif

void test(double a[4], double b[4]);

void test(double a[4], double b[4])
{
    b[0] = a[0];
    b[1] = a[1];
    b[2] = a[2];
    b[3] = a[3];
}

int main()
{

    double a[]={1,2,3,4}, b[]={0,0,0,0};

    test(a, b);

    printf("\n %.2f %.2f %.2f %.2f\n", b[0], b[1], b[2], b[3]);

    return 0;
}

 

 

The SDSoC console output is this:

 

 

11:57:11 **** Build of configuration Release for project HVDC_MMC ****
make pre-build main-build 
sdsoc_make_clean Release
' '
'Building file: ../src/SDcard_interface_v04.c'
'Invoking: SDSCC Compiler'
sdscc -Wall -O3 -I"../src" -c -fmessage-length=0 -MT"src/SDcard_interface_v04.o" -MMD -MP -MF"src/SDcard_interface_v04.d" -MT"src/SDcard_interface_v04.o" -o "src/SDcard_interface_v04.o" "../src/SDcard_interface_v04.c" -sds-hw test main.cpp  -clkid 1 -sds-end -sds-sys-config standalone -sds-proc a9_0 -sds-pf "zed"
INFO: [SDSoC 0-0] Create data motion intermediate representation

C:\Xilinx\Projects\HVDC_MMC\Release>C:\Xilinx\SDx\2016.4\llvm-clang\win64\llvm\bin\clang.exe -I../src -Wall -fmessage-length=0 -MMD -MP -D __SDSCC__ -target arm-none-eabi -mcpu=cortex-a9 -mfpu=vfpv3 -O0 -g -I C:/Xilinx/SDx/2016.4/aarch32-none/include -I C:/Xilinx/SDx/2016.4/Vivado_HLS/include -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/lib/gcc/arm-none-eabi/5.2.1/include -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/lib/gcc/arm-none-eabi/5.2.1/include-fixed -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/include -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/libc/usr/include -emit-llvm -S C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c -o C:/Xilinx/Projects/HVDC_MMC/Release/_sds/.llvm/src/SDcard_interface_v04.s 
C:/Xilinx/SDx/2016.4/aarch32-none/include/integer.h:28:16: warning: redefinition of typedef 'LONG' is a C11 feature [-Wtypedef-redefinition]
typedef long                    LONG;
                                ^
C:/Xilinx/SDx/2016.4/aarch32-none/include/xil_types.h:143:14: note: previous definition is here
typedef long LONG;
             ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:126:11: warning: unused variable 'count' [-Wunused-variable]
        uint32_t count, buffer_size, delay;
                 ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:126:18: warning: unused variable 'buffer_size' [-Wunused-variable]
        uint32_t count, buffer_size, delay;
                        ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:126:31: warning: unused variable 'delay' [-Wunused-variable]
        uint32_t count, buffer_size, delay;
                                     ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:158:26: warning: passing 'const void *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        result = f_read(&file1, input_buffer, num_bytes, &count);
                                ^~~~~~~~~~~~
C:/Xilinx/SDx/2016.4/aarch32-none/include\ff.h:223:32: note: passing argument to parameter 'buff' here
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br);                       /* Read data from a file */
                               ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:147:18: warning: unused variable 'delay' [-Wunused-variable]
        uint32_t count, delay, x;
                        ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:147:25: warning: unused variable 'x' [-Wunused-variable]
        uint32_t count, delay, x;
                               ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:182:10: warning: unused variable 'SD_data' [-Wunused-variable]
        double *SD_data;
                ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:183:10: warning: unused variable 'pointer' [-Wunused-variable]
        double *pointer;
                ^

C:\Xilinx\Projects\HVDC_MMC\Release>exit /b 0 
INFO: [SDSoC 0-0] Compiling C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c: In function 'SDcard_mount':
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:126:31: warning: unused variable 'delay' [-Wunused-variable]
  uint32_t count, buffer_size, delay;
                               ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:126:18: warning: unused variable 'buffer_size' [-Wunused-variable]
  uint32_t count, buffer_size, delay;
                  ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:126:11: warning: unused variable 'count' [-Wunused-variable]
  uint32_t count, buffer_size, delay;
           ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c: In function 'SDcard_read_v3':
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:158:26: warning: passing argument 2 of 'f_read' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  result = f_read(&file1, input_buffer, num_bytes, &count);
                          ^
C:/Xilinx/SDx/2016.4/aarch32-none/include/ff.h:223:9: note: expected 'void *' but argument is of type 'const void *'
 FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br);   /* Read data from a file */
         ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:158:51: warning: passing argument 4 of 'f_read' from incompatible pointer type [-Wincompatible-pointer-types]
  result = f_read(&file1, input_buffer, num_bytes, &count);
                                                   ^
C:/Xilinx/SDx/2016.4/aarch32-none/include/ff.h:223:9: note: expected 'UINT * {aka unsigned int *}' but argument is of type 'uint32_t * {aka long unsigned int *}'
 FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br);   /* Read data from a file */
         ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:147:25: warning: unused variable 'x' [-Wunused-variable]
  uint32_t count, delay, x;
                         ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:147:18: warning: unused variable 'delay' [-Wunused-variable]
  uint32_t count, delay, x;
                  ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c: In function 'SDcard_write_v3':
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:193:53: warning: passing argument 4 of 'f_write' from incompatible pointer type [-Wincompatible-pointer-types]
  result = f_write(&file1, output_buffer, num_bytes, &count);
                                                     ^
C:/Xilinx/SDx/2016.4/aarch32-none/include/ff.h:224:9: note: expected 'UINT * {aka unsigned int *}' but argument is of type 'uint32_t * {aka long unsigned int *}'
 FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to a file */
         ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:183:10: warning: unused variable 'pointer' [-Wunused-variable]
  double *pointer;
          ^
C:/Xilinx/Projects/HVDC_MMC/src/SDcard_interface_v04.c:182:10: warning: unused variable 'SD_data' [-Wunused-variable]
  double *SD_data;
          ^
sdscc log file saved as C:/Xilinx/Projects/HVDC_MMC/Release/_sds/reports/sds_SDcard_interface_v04.log

'Finished building: ../src/SDcard_interface_v04.c'
' '
'Building file: ../src/main.cpp'
'Invoking: SDS++ Compiler'
sds++ -Wall -O3 -I"../src" -c -fmessage-length=0 -MT"src/main.o" -MMD -MP -MF"src/main.d" -MT"src/main.o" -o "src/main.o" "../src/main.cpp" -sds-hw test main.cpp  -clkid 1 -sds-end -sds-sys-config standalone -sds-proc a9_0 -sds-pf "zed"
INFO: [SDSoC 0-0] Processing -sds-hw block for test
INFO: [SDSoC 0-0] Create data motion intermediate representation

C:\Xilinx\Projects\HVDC_MMC\Release>C:\Xilinx\SDx\2016.4\llvm-clang\win64\llvm\bin\clang.exe -I../src -Wall -fmessage-length=0 -MMD -MP -D __SDSCC__ -target arm-none-eabi -mcpu=cortex-a9 -mfpu=vfpv3 -O0 -g -I C:/Xilinx/SDx/2016.4/aarch32-none/include -I C:/Xilinx/SDx/2016.4/Vivado_HLS/include -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/include/c++/5.2.1 -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/include/c++/5.2.1/arm-none-eabi -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/include/c++/5.2.1/backward -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/lib/gcc/arm-none-eabi/5.2.1/include -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/lib/gcc/arm-none-eabi/5.2.1/include-fixed -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/include -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/libc/usr/include -emit-llvm -S C:/Xilinx/Projects/HVDC_MMC/src/main.cpp -o C:/Xilinx/Projects/HVDC_MMC/Release/_sds/.llvm/src/main.s 
C:/Xilinx/SDx/2016.4/Vivado_HLS/include\etc/ap_private.h:1720:20: warning: unknown attribute 'no_sanitize' ignored [-Wunknown-attributes]
    __attribute__((no_sanitize("undefined")))
                   ^
C:/Xilinx/SDx/2016.4/Vivado_HLS/include\etc/ap_private.h:2043:20: warning: unknown attribute 'no_sanitize' ignored [-Wunknown-attributes]
    __attribute__((no_sanitize("undefined"))) 
                   ^
C:/Xilinx/SDx/2016.4/Vivado_HLS/include\etc/ap_private.h:2126:20: warning: unknown attribute 'no_sanitize' ignored [-Wunknown-attributes]
    __attribute__((no_sanitize("undefined"))) 
                   ^
C:/Xilinx/SDx/2016.4/Vivado_HLS/include\etc/ap_private.h:3250:20: warning: unknown attribute 'no_sanitize' ignored [-Wunknown-attributes]
    __attribute__((no_sanitize("undefined")))
                   ^

C:\Xilinx\Projects\HVDC_MMC\Release>exit /b 0 
INFO: [SDSoC 0-0] Performing accelerator source linting for test
INFO: [SDSoC 0-0] Performing pragma generation

C:\Xilinx\Projects\HVDC_MMC\Release>C:\Xilinx\SDx\2016.4\llvm-clang\win64\llvm\bin\clang.exe -E -IC:/Xilinx/Projects/HVDC_MMC/src -Wall -fmessage-length=0 -MMD -MP -D __SDSCC__ -m32 -I C:/Xilinx/SDx/2016.4/aarch32-none/include -IC:/Xilinx/Projects/HVDC_MMC/src -D __SDSVHLS__ -target arm-none-eabi -mcpu=cortex-a9 -mfpu=vfpv3 -O0 -g -w -I C:/Xilinx/SDx/2016.4/aarch32-none/include -I C:/Xilinx/SDx/2016.4/Vivado_HLS/include -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/include/c++/5.2.1 -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/include/c++/5.2.1/arm-none-eabi -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/include/c++/5.2.1/backward -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/lib/gcc/arm-none-eabi/5.2.1/include -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/lib/gcc/arm-none-eabi/5.2.1/include-fixed -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/include -IC:/Xilinx/SDx/2016.4/SDK/gnu/aarch32/nt/gcc-arm-none-eabi/arm-none-eabi/libc/usr/include C:/Xilinx/Projects/HVDC_MMC/src/main.cpp -o C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/main_pp.cpp 

C:\Xilinx\Projects\HVDC_MMC\Release>exit /b 0 
INFO: [SDSoC 0-0] Successfully generated tcl script: C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test.tcl
INFO: [SDSoC 0-0] Moving function test to Programmable Logic
ERROR: [SDSoC 0-0] Problem detected in Vivado HLS run - unable to find solution implementation directory for test C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test/solution/impl/ip. For possible causes, review C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test/solution/solution.log or C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/vivado_hls.log.
C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/vivado_hls.log (last 20 lines):
INFO: [HLS 200-10] For user 'superviseur' on host 'po1-ne-gei-a106' (Windows NT_amd64 version 6.1) on Wed Jul 19 11:57:24 +0200 2017
INFO: [HLS 200-10] In directory 'C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls'
INFO: [HLS 200-10] Creating and opening project 'C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test'.
INFO: [HLS 200-10] Adding design file 'C:/Xilinx/Projects/HVDC_MMC/src/main.cpp' to the project
INFO: [HLS 200-10] Creating and opening solution 'C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test/solution'.
INFO: [HLS 200-10] Cleaning up the solution database.
INFO: [HLS 200-10] Setting target device to ' xc7z020clg484-1 '
INFO: [SYN 201-201] Setting up clock 'default' with a period of 7ns.
INFO: [HLS 200-10] Analyzing design file 'C:/Xilinx/Projects/HVDC_MMC/src/main.cpp' ... 
Source processing failed.
    while executing
"source C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test_run.tcl"
    invoked from within
"hls::main C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test_run.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 hls::main {*}$args"
    (procedure "hls_proc" line 5)
    invoked from within
"hls_proc $argv"
sds++ log file saved as C:/Xilinx/Projects/HVDC_MMC/Release/_sds/reports/sds_main.log
ERROR: [SDSoC 0-0] Build failed

make: *** [src/main.o] Erreur 1

11:58:04 Build Finished (took 53s.347ms)

 

And this the Vivado HLS log:

 

================================================================
  Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
  Version 2016.4
  Build 1722992 on Wed Mar 08 18:30:27 MST 2017
  Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
================================================================
INFO: [HLS 200-10] Running 'C:/Xilinx/SDx/2016.4/VIVADO~1/bin/unwrapped/win64.o/vivado_hls.exe'
INFO: [HLS 200-10] For user 'superviseur' on host 'po1-ne-gei-a106' (Windows NT_amd64 version 6.1) on Wed Jul 19 11:57:24 +0200 2017
INFO: [HLS 200-10] In directory 'C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls'
INFO: [HLS 200-10] Creating and opening project 'C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test'.
INFO: [HLS 200-10] Adding design file 'C:/Xilinx/Projects/HVDC_MMC/src/main.cpp' to the project
INFO: [HLS 200-10] Creating and opening solution 'C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test/solution'.
INFO: [HLS 200-10] Cleaning up the solution database.
INFO: [HLS 200-10] Setting target device to ' xc7z020clg484-1 '
INFO: [SYN 201-201] Setting up clock 'default' with a period of 7ns.
INFO: [HLS 200-10] Analyzing design file 'C:/Xilinx/Projects/HVDC_MMC/src/main.cpp' ... 
Source processing failed.
    while executing
"source C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test_run.tcl"
    invoked from within
"hls::main C:/Xilinx/Projects/HVDC_MMC/Release/_sds/vhls/test_run.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 hls::main {*}$args"
    (procedure "hls_proc" line 5)
    invoked from within
"hls_proc $argv"

Anyone sees where is the problem?

 

Many thanks,

 

Cerilet

 

0 Kudos
2 Replies
Explorer
Explorer
3,037 Views
Registered: ‎08-26-2014

Re: Why this code does not compile the hardware accelerator in SDSoC?

I finally found what was the problem, but I do not really know why. The problem was with some of the libraries.

I commented these lines and removed all the code related to them and it worked.

//#include <xstatus.h>
//#include <ff.h>
//#include "SDcard_interface_v04.h"
//#include "xparameters.h"
//#include "xscutimer.h"
//#include "AxiTimerHelper.h"

//#define __SDSCC__

//#ifdef __SDSCC__
//    #include "sds_lib.h"
//#else
//    #define sds_alloc(x) (malloc(x))
//    #define sds_free(x) (free(x))
//#endif

But does anyone know why I cannot add these libraries even though they are not used in the functions that run in the fabric?

0 Kudos
Observer wsun
Observer
2,809 Views
Registered: ‎05-26-2016

Re: Why this code does not compile the hardware accelerator in SDSoC?

Please separate your accelerator code/function into another file. 

0 Kudos