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
Observer dr_jjrussell
Observer
2,427 Views
Registered: ‎11-02-2015

CSIM Makefile does not honor distinct CFLAGS

 In building my application for VIVADO HLS, I have a specified distinct CFLAGS for different files.  This distinction is not honored in the csim.mk files.  These options seem to be collected as a whole into the make variable IFLAGS.   This can go unnoticed until mutually exclusive or illegal flags are defined which causes the build to abort.

 

I ran into this when I specified -std=c++0x for my C++ files.  In the build, I also have a C file.  When compiling in debug mode, the makefile chooses the C++ compiler for all files, but when compiling outside of debug mode, the C compiler is chosen for .C files. The debug build is fine, but the straight (non-debug) build aborts when the -std=c++0x is encountered by the GCC C compiler.  

 

I was very wary that this -std=c++0x flag might have been picked up out of my environment, so I included a -O1 only on one file to verify my theory that the IFLAGS was the concatenation of CFLAGS specified in the VIVADO HLS GUI.  I work in a large group, so this still does not rule out that someone 'modified' the way makefiles are generated.  Just don't know how much control the user has over this sort of thing...

 

I note that the distinct flags do explicitly appear in the makefile rules for the files that they apply to.  The issue is the concatenation also into IFLAGS.

 

Here is the csim.mk file

 

# ==============================================================
# File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
# Version: 2016.3
# Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
#
# ==============================================================

CSIM_DESIGN = 1

__SIM_FPO__ = 1

__SIM_OPENCV__ = 1

__SIM_FFT__ = 1

__SIM_FIR__ = 1

__SIM_DDS__ = 1

ObjDir = obj

HLS_SOURCES = ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/AP-Decode.cpp ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/BTD.c ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/BTE.cpp ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/DuneDataCompressionCore_test.cpp ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/DuneDataCompressionCore.cpp

TARGET := csim.exe

AUTOPILOT_ROOT := /afs/slac.stanford.edu/g/reseng/xilinx/vivado_2016.3/Vivado_HLS/2016.3
AUTOPILOT_MACH := lnx64
ifdef AP_GCC_M32
AUTOPILOT_MACH := Linux_x86
IFLAG += -m32
endif
IFLAG += -fPIC
ifndef AP_GCC_PATH
AP_GCC_PATH := /afs/slac.stanford.edu/g/reseng/xilinx/vivado_2016.3/Vivado_HLS/2016.3/lnx64/tools/gcc/bin
endif
AUTOPILOT_TOOL := ${AUTOPILOT_ROOT}/${AUTOPILOT_MACH}/tools
AP_CLANG_PATH := ${AUTOPILOT_TOOL}/clang-3.9/bin
AUTOPILOT_TECH := ${AUTOPILOT_ROOT}/common/technology


IFLAG += -I "${AUTOPILOT_TOOL}/systemc/include"
IFLAG += -I "${AUTOPILOT_ROOT}/include"
IFLAG += -I "${AUTOPILOT_ROOT}/include/opencv"
IFLAG += -I "${AUTOPILOT_ROOT}/include/ap_sysc"
IFLAG += -I "${AUTOPILOT_TECH}/generic/SystemC"
IFLAG += -I "${AUTOPILOT_TECH}/generic/SystemC/AESL_FP_comp"
IFLAG += -I "${AUTOPILOT_TECH}/generic/SystemC/AESL_comp"
IFLAG += -I "${AUTOPILOT_TOOL}/auto_cc/include"
IFLAG += -D__SIM_FPO__

IFLAG += -D__SIM_OPENCV__

IFLAG += -D__SIM_FFT__

IFLAG += -D__SIM_FIR__

IFLAG += -D__SIM_DDS__

IFLAG += -std=c++0x -O1 <--- DISTINCT CFLAGS COLLECTED IN IFLAG
AP_ENABLE_OPTIMIZED := 1
DFLAG += -DAUTOCC
DFLAG += -D__xilinx_ip_top= -DAESL_TB
CCFLAG +=

 

include ./Makefile.rules

all: $(TARGET)

 

AUTOCC := apcc

$(ObjDir)/AP-Decode.o: ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/AP-Decode.cpp $(ObjDir)/.dir
$(Echo) " Compiling ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/AP-Decode.cpp in $(BuildMode) mode" $(AVE_DIR_DLOG)
$(Verb) $(CC) ${CCFLAG} -c -MMD -std=c++0x $(IFLAG) $(DFLAG) -DNDEBUG $< -o $@ ; \

-include $(ObjDir)/AP-Decode.d

$(ObjDir)/BTD.o: ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/BTD.c $(ObjDir)/.dir
$(Echo) " Compiling(apcc) ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/BTD.c in $(BuildMode) mode" $(AVE_DIR_DLOG)
$(Verb) $(AUTOCC) -c -MMD $(IFLAG) $(DFLAG) -DNDEBUG $< -o $@ ; \

-include $(ObjDir)/BTD.d

$(ObjDir)/BTE.o: ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/BTE.cpp $(ObjDir)/.dir
$(Echo) " Compiling ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/BTE.cpp in $(BuildMode) mode" $(AVE_DIR_DLOG)
$(Verb) $(CC) ${CCFLAG} -c -MMD -std=c++0x -O1 $(IFLAG) $(DFLAG) -DNDEBUG $< -o $@ ; \

-include $(ObjDir)/BTE.d

$(ObjDir)/DuneDataCompressionCore_test.o: ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/DuneDataCompressionCore_test.cpp $(ObjDir)/.dir
$(Echo) " Compiling ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/DuneDataCompressionCore_test.cpp in $(BuildMode) mode" $(AVE_DIR_DLOG)
$(Verb) $(CC) ${CCFLAG} -c -MMD -std=c++0x $(IFLAG) $(DFLAG) -DNDEBUG $< -o $@ ; \

-include $(ObjDir)/DuneDataCompressionCore_test.d

$(ObjDir)/DuneDataCompressionCore.o: ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/DuneDataCompressionCore.cpp $(ObjDir)/.dir
$(Echo) " Compiling ../../../../../../../../afs/slac.stanford.edu/u/ey/russell/rce/DUNE/firmware/VivadoHLS/DuneDataCompression/vivado_hls/src/DuneDataCompressionCore.cpp in $(BuildMode) mode" $(AVE_DIR_DLOG)
$(Verb) $(CC) ${CCFLAG} -c -MMD -std=c++0x $(IFLAG) $(DFLAG) -DNDEBUG $< -o $@ ; \

-include $(ObjDir)/DuneDataCompr

 

0 Kudos