- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could anybody help me how to compile programs from Nios forum Linux1.4 distribution for Nios2 under Elipse IDE Windows environment.
I don't have any problems with compilation of kernel, file system. I created new Linux application project, Rules.mak and Settings.mak were generated. I want to compile programs from linux1.4/examples/software/linux/apps/e2fsprogs/misc directory. What should I do ... When I compile according to makefile from linux1.4/examples/software/linux/apps/e2fsprogs/misc, there are a lot of errors, bad paths, etc. The linux1.4 files are installed in d:\altera\kits\nios2\bin\eclipse\plugins directory. Could anybody sent me a makefiles for compilation of these programs? Best Regards XenixLink Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Di you try looking at the wiki ? I have no idea how one would do it, but I assume you are running Microtronix linux developed under windows.
There should be a Reference guide provided by them. I developed my nios2 uclinux apps under windows via colinux. --- Quote Start --- originally posted by xenix@Nov 21 2006, 07:13 AM could anybody help me how to compile programs from nios forum linux1.4 distribution for nios2 under elipse ide windows environment.i don't have any problems with compilation of kernel, file system.
i created new linux application project, rules.mak and settings.mak were generated.
i want to compile programs from linux1.4/examples/software/linux/apps/e2fsprogs/misc directory.
what should i do ...
when i compile according to makefile from linux1.4/examples/software/linux/apps/e2fsprogs/misc, there are a lot of errors, bad paths, etc.
the linux1.4 files are installed in d:\altera\kits\nios2\bin\eclipse\plugins directory.
could anybody sent me a makefiles for compilation of these programs?
best regards
xenix
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19557)
--- quote end ---
--- Quote End ---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by xenix@Nov 21 2006, 07:13 AM could anybody help me how to compile programs from nios forum linux1.4 distribution for nios2 under elipse ide windows environment.
i don't have any problems with compilation of kernel, file system.
i created new linux application project, rules.mak and settings.mak were generated.
i want to compile programs from linux1.4/examples/software/linux/apps/e2fsprogs/misc directory.
what should i do ...
when i compile according to makefile from linux1.4/examples/software/linux/apps/e2fsprogs/misc, there are a lot of errors, bad paths, etc.
the linux1.4 files are installed in d:\altera\kits\nios2\bin\eclipse\plugins directory.
could anybody sent me a makefiles for compilation of these programs?
best regards
xenix
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19557)
--- quote end ---
--- Quote End --- Compilation works fine when the makefile is taken from linux1.4/examples/software/linux/apps/e2fsprogs and Rules.mak are applied. Xenix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then i don't know. I usually just create my own make files as i write programs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by albertyong88@Nov 22 2006, 05:58 PM then i don't know. i usually just create my own make files as i write programs.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19583)
--- quote end ---
--- Quote End --- I recalled that there is some example in nios/kit/...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey man,
I know how you feel. I was in that exact same position half a year ago or so...took me almost a week to stabalize how I write the makefiles for NIOS uClinux app. Anyway, here it is, the complete makefile that would work for any NIOS Linux app ported from Microtronix. Just study it, and ask questions if you have any. It might be helpful if you have the old Rules.mak to compare the changes I made. There are two files, Makefile and Rules.mak First, Rules.mak########################################################################### Variables and Rules for building Nios II Linux applications# # This file is a "template" that is copied over from the Nios II Linux# Application plug-in. This file should be included within your top-level# Makefile.
# This turns on various levels of hardware multiply support# Set the following option to none, mul, or mulx# none := no hardware multiplication support at all# mul := supports use of the mul assembler instruction# mulx := supports use of the mul and mulx assembler instruction
ifeq "$(HW_MUL_SUPPORT)" ""
HW_MUL_SUPPORT := mulx
endif
# # Warn users if external variables have not yet been defined.#
ifeq "$(origin UTILSDIR)" "undefined"
$(warning The location of the utiltiies directory is undefined)
endif
ifeq "$(origin LIBCDIR)" "undefined"
$(warning The location of uClibc is undefined)
endif
# # Path + Name of necessary executables#
EXECSUFFIX := .exe
CROSS := nios2-elf-
CC := $(CROSS)gcc
CPP := $(CROSS)g++
AR := $(CROSS)ar
LD := $(CROSS)ld
NM := $(CROSS)nm
RANLIB := $(CROSS)ranlib
STRIPTOOL := $(CROSS)strip
ELF2FLT := $(UTILSDIR)/bin/elf2flt
# # Location of important files#
CRT0 := $(LIBCDIR)/lib/crt0.o
LIBC := $(LIBCDIR)/lib/libc.a
LIBM := $(LIBCDIR)/lib/libm.a
LIBGCC := $(shell $(CC) -print-file-name=libgcc.a)
LIBGCCDIR := $(dir $(LIBGCC))
LINKSCRIPT := $(UTILSDIR)/scripts/elf2flt.ld
# # Various flags, modifications are not recommended and not necessarily# supported.# # DEPFLAGS:# -MM : ignore system includes, # -M : include system includes in the dependency#
WARNING_FLAGS := -Wall
# basic C flags to pass to the compiler
CFLAGS += -nostdinc -D__linux__
# if DEBUG is turned on, then turn off optimizations and turn on symbol# generation, else turn on level 2 optimizations
ifeq '$(DEBUG)' '1'
CFLAGS += -O0 -g
else
CFLAGS += -O2
endif
# pass any additional include directories to the compiler while building the# application
CFLAGS += -I$(LIBCDIR)/include -I$(LIBGCCDIR)include
# Temporary workaround for nios2-elf-gcc bug# First noticed in v3.4.1 (Altera Nios II 1.1 b131)# To be removed at a later date when bug is resolved.
CFLAGS += -fno-optimize-sibling-calls
# Turn on the various levels of hardware multiplication support.
ifeq ($(strip $(HW_MUL_SUPPORT)),none)
CFLAGS += -mno-hw-mul -mno-hw-mulx
endif
ifeq ($(strip $(HW_MUL_SUPPORT)),mul)
CFLAGS += -mhw-mul -mno-hw-mulx
endif
ifeq ($(strip $(HW_MUL_SUPPORT)),mulx)
CFLAGS += -mhw-mul -mhw-mulx
endif
mulx_help_text := $(shell $(CC) --target-help | grep mulx)
ifeq "$(mulx_help_text)" ""
CFLAGS := $(filter-out -mhw-mulx -mno-hw-mulx, $(CFLAGS))
endif
DEPFLAGS = -E -MM
LDFLAGS := $(LDFLAGS) -msys-crt0=$(CRT0) -r -d -L$(LIBCDIR)/lib
LDLIBS := $(LDLIBS) $(LIBM) $(LIBGCC) $(LIBC)
# relocate the absolute elf file if requested
ifneq ($(TEXT),)
TEXT_LOC_OPT := -Ttext $(TEXT)
endif
ifneq ($(DATA),)
DATA_LOC_OPT := -Tdata $(DATA)
endif
ifneq ($(BSS),)
BSS_LOC_OPT := -Tbss $(BSS)
endif
Second, Makefile #--------------------------------------# Target File Name and Type Definitions# --------------------------------------# DEBUG = 1 to turn on debugging support
PROJ_NAME = UsbPerf
PROGS := UsbPerf.exe
DEBUG = 0
INSTALL_DIR = Build
OBJECT_DIR = .
LIBRARY_DIR = .
EXECUTABLE_DIR = .
MISER_SHARED_DIR = ../MISER_SHARED
BITTWARE_LIB = $(MISER_SHARED_DIR)/Utilities/Bittware/Nios/Lib/libMiser.a
# ------------------------------------------# Software tool and environment definitions# ------------------------------------------
TOPDIR = .
LIBCDIR = "c:/altera/kits/nios2_60/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"
UTILSDIR = "c:/altera/kits/nios2_60/bin/eclipse/plugins/com.microtronix.nios2linux.application_1.4.0"
# -----------------------------------------------------------# Compilation Flags (Probably will never need to be changed)# -----------------------------------------------------------
CFLAGS =
# -------------------------------------------------------# Linking Flags (Probably will never need to be changed)# -------------------------------------------------------
LDFLAGS =
# --------------------------------------------------------------# Linking Libraries (Specify the uClibc-specific libraries here# --------------------------------------------------------------
LDLIBS = $(BITTWARE_LIB) -lpthread -lrt
# ---------------------------------------# Target compile time symbol definitions# ---------------------------------------
DEFINES = -DUSING_DSP_EMULATOR -DMISER_SCH_BLD
# ---------------------# Program's Stack Size# ---------------------
FLTFLAGS := -s 32768
# ------------------------------------------------------------------------# Rules.mak adds Nios-specific flags to the compilation and linking flags# ------------------------------------------------------------------------
include $(TOPDIR)/Rules.mak
# --------------# Object Files# --------------
Main_OBJ = threadTest.o
# ------------------------------------------# Include Paths# ------------------------------------------
INCLUDES = -I .
-I $(MISER_SHARED_DIR)/Utilities/Bittware/Nios/Inc
-I ../SHARED_PROG
# ----------------------------------------------# Source Paths# ----------------------------------------------
Main_PATH = .
# ----------------------# Compilation shortcut# ----------------------
GPP_COMPILE = $(CPP) $(CFLAGS) $(INCLUDES) $(DEFINES)
GPP_LINK = $(CPP) $(LDFLAGS)
GCC_COMPILE = $(CC) $(CFLAGS) $(INCLUDES) $(DEFINES)
GCC_LINK = $(CC) $(LDFLAGS)
COMPILE_Main_Src = $(GPP_COMPILE) -c $(Main_PATH)/$(addsuffix .cpp, $(basename $@)) -o $(OBJECT_DIR)/$@ $<
LINK_PROG = $(GPP_LINK)
# ----------------------# Actual Compilation# ----------------------
ALL_OBJS := $(Main_OBJ)
FINAL_OBJS := $(foreach OBJECT, $(ALL_OBJS), $(addprefix $(OBJECT_DIR)/, $(OBJECT)))
# --------------------# Files to be Created# --------------------
PROGS_BIN = $(PROGS:.exe=.bin)
PROGS_ELF = $(PROGS:.exe=.elf)
PROGS_FLT = $(PROGS:.exe=.flt)
ifeq '$(DEBUG)' '1'
PROGS_GDB = $(PROGS:.exe=.gdb)
endif
# -------------------# Actual Compilation# -------------------# Command to compile all files but doesnt link
all: $(PROGS)
# Linking
$(PROGS_BIN): $(Main_OBJ)
$(LINK_PROG) -o $(EXECUTABLE_DIR)/$(PROGS_BIN) $(FINAL_OBJS) $(LDLIBS)
@echo "=================="
@echo "Linking Successful"
@echo "=================="
# Debug file
$(PROGS_GDB): $(PROGS_BIN)
$(LD) -T $(LINKSCRIPT) -o $(EXECUTABLE_DIR)/$(PROGS_GDB) $(EXECUTABLE_DIR)/$(PROGS_BIN)
@echo "============="
@echo "GDB Completed"
@echo "============="
# ELF file
$(PROGS_ELF): $(PROGS_BIN)
$(LD) -T $(LINKSCRIPT) -Ur -o $(EXECUTABLE_DIR)/$(PROGS_ELF) $(EXECUTABLE_DIR)/$(PROGS_BIN)
@echo "============="
@echo "ELF Completed"
@echo "============="
# FLT file
$(PROGS_FLT): $(PROGS_ELF)
$(ELF2FLT) $(FLTFLAGS) -o $(EXECUTABLE_DIR)/$(PROGS_FLT) $(EXECUTABLE_DIR)/$(PROGS_ELF)
@echo "============="
@echo "FLT Completed"
@echo "============="
# Executable
$(PROGS): $(PROGS_FLT) $(PROGS_GDB)
cp -f $(EXECUTABLE_DIR)/$(PROGS_FLT) $(EXECUTABLE_DIR)/$(PROGS)
@echo "================================="
@echo "Executable Successfully Generated"
@echo "================================="
# Compilation commands
$(Main_OBJ): $<$(addsuffix .cpp, $(basename $@))
$(COMPILE_Main_Src)
# ------------------------# Cleanup# ------------------------
clean:
@rm -f *.o *.gdb *.flt *.exe *elf *.bin

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page