Forum Discussion
Altera_Forum
Honored Contributor
8 years agoOuch....my mistake, sorry for the mess.
I am answering myself since I realized I made a terrible mistake. Maybe if you are going too fast as I was, you might make the same mistake: using the wrong Makefile. It is not only necessary to build the .aocx emulator for a given board but also using the right Makefile for emulation in a x86 based computer. So if you're developing for a SoC based device make sure when you go for emulation (besides the Intel instructions, like sourcing the required file to prepare the environment, how to build the .aocx and how to execute the host application), that you switch to an x86-based Makefile (available also in any of the Altera design examples): get one for x86, and either use two different Makefiles or modify one slightly to provide some command line options when you go emulation or real hardware. Please find mine below. I just got the ARM and x86 Makefiles and 'merge' them creating a specific directory for the emulation building process outputs; you can usemake EMUL=1 for building the emulation host program or just make to build the AMR-based host application. The Makefile: ifeq ($(VERBOSE),1)
ECHO :=
else
ECHO := @
endif
# Where is the Intel(R) FPGA SDK for OpenCL(TM) software?
ifeq ($(wildcard $(ALTERAOCLSDKROOT)),)
$(error Set ALTERAOCLSDKROOT to the root directory of the Intel(R) FPGA SDK for OpenCL(TM) software installation)
endif
ifeq ($(wildcard $(ALTERAOCLSDKROOT)/host/include/CL/opencl.h),)
$(error Set ALTERAOCLSDKROOT to the root directory of the Intel(R) FPGA SDK for OpenCL(TM) software installation.)
endif
# OpenCL compile and link flags.
ifeq ($(EMUL),1)
AOCL_COMPILE_CONFIG := $(shell aocl compile-config )
AOCL_LINK_CONFIG := $(shell aocl link-config )
else
AOCL_COMPILE_CONFIG := $(shell aocl compile-config --arm)
AOCL_LINK_CONFIG := $(shell aocl link-config --arm)
endif
# Compilation flags
ifeq ($(DEBUG),1)
CXXFLAGS += -g
else
CXXFLAGS += -O2
endif
ifeq ($(EMUL),1)
# Compiler x86
CXX := g++
else
# Compiler. ARM cross-compiler.
CXX := arm-linux-gnueabihf-g++
endif
# Target
TARGET := host
ifeq ($(EMUL),1)
TARGET_DIR := bin/emul
else
TARGET_DIR := bin
endif
# Directories
INC_DIRS := ../common/inc
LIB_DIRS :=
# Files
INCS := $(wildcard )
SRCS := $(wildcard host/src/*.cpp ../common/src/AOCLUtils/*.cpp)
LIBS := rt pthread
# Make it all!
all : $(TARGET_DIR)/$(TARGET)
# Host executable target.
$(TARGET_DIR)/$(TARGET) : Makefile $(SRCS) $(INCS) $(TARGET_DIR)
$(ECHO)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -fPIC $(foreach D,$(INC_DIRS),-I$D)
$(AOCL_COMPILE_CONFIG) $(SRCS) $(AOCL_LINK_CONFIG)
$(foreach D,$(LIB_DIRS),-L$D)
$(foreach L,$(LIBS),-l$L)
-o $(TARGET_DIR)/$(TARGET)
$(TARGET_DIR) :
$(ECHO)mkdir $(TARGET_DIR)
# Standard make targets
clean :
$(ECHO)rm -f $(TARGET_DIR)/$(TARGET)
.PHONY : all clean
Cheers