OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [example/] [coremark/] [makefile] - Diff between revs 6 and 19

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 6 Rev 19
Line 34... Line 34...
# The NEORV32 Processor - https://github.com/stnolting/neorv32              (c) Stephan Nolting #
# The NEORV32 Processor - https://github.com/stnolting/neorv32              (c) Stephan Nolting #
#################################################################################################
#################################################################################################
 
 
 
 
# *****************************************************************************
# *****************************************************************************
# USER CONFIGURATION
# USER CONFIGURATION (use default if not set by user)
# *****************************************************************************
# *****************************************************************************
# Compiler effort
# Compiler effort
EFFORT = -Os
EFFORT ?= -Os
 
 
# User's application sources (add additional files here)
# User's application sources (add additional files here)
APP_SRC = $(wildcard *.c)
APP_SRC ?= $(wildcard *.c)
 
 
# User's application include folders (don't forget the '-I' before each entry)
# User's application include folders (don't forget the '-I' before each entry)
APP_INC = -I .
APP_INC ?= -I .
 
 
# Compiler toolchain (use default if not set by user)
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
 
# CPU architecture and ABI
# CPU architecture and ABI
MARCH = -march=rv32i
MARCH ?= -march=rv32i
MABI  = -mabi=ilp32
MABI  ?= -mabi=ilp32
 
 
# Path to runtime c library (use default if not set by user)
# Relative or absolute path to the NEORV32 home folder
LIBC_PATH   ?= $(dir $(shell which $(CC)))../$(RISCV_TOOLCHAIN)/lib/libc.a
 
LIBGCC_PATH ?= $(dir $(shell which $(CC)))../lib/gcc/$(RISCV_TOOLCHAIN)/*/libgcc.a
 
 
 
# Relative or absolute path to the NEORV32 home folder (use default if not set by user)
 
NEORV32_HOME ?= ../../..
NEORV32_HOME ?= ../../..
# *****************************************************************************
# *****************************************************************************
 
 
 
 
 
 
Line 111... Line 107...
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Tools and flags
# Tools and flags
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# compiler tools
# compiler tools
CC      = $(RISCV_TOOLCHAIN)-gcc
CC      = $(RISCV_TOOLCHAIN)-gcc
LD      = $(RISCV_TOOLCHAIN)-ld
 
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE    = $(RISCV_TOOLCHAIN)-size
SIZE    = $(RISCV_TOOLCHAIN)-size
 
 
# NEORV32 executable image generator
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
 
# Compiler flags
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -lm
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
 
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
# Linker flags
 
LD_OPTS = $(EFFORT) --gc-sections
 
 
 
# User flags for additional config
# User flags for additional configuration
USER_FLAGS =
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
CC_OPTS += $(USER_FLAGS)
 
 
# Use embedded RISC-V CPU extension?
 
ifeq (,$(findstring rv32e,$(MARCH)))
 
        CC_OPTS +=
 
else
 
        CC_OPTS += -D__RISCV_EMBEDDED_CPU__
 
endif
 
 
 
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Host native compiler
# Host native compiler
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
CC_X86 = gcc -Wall -O -g
 
 
Line 164... Line 150...
$(OBJ): %.o : %.c crt0.elf
$(OBJ): %.o : %.c crt0.elf
        @$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
        @$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
 
# Link object files and show memory utilization
# Link object files and show memory utilization
main.elf: $(OBJ)
main.elf: $(OBJ)
        @$(LD) $(LD_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) $(LIBC_PATH) $(LIBGCC_PATH) -o $@
        @$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
        @echo "Memory utilization:"
        @echo "Memory utilization:"
        @$(SIZE) main.elf
        @$(SIZE) main.elf
 
 
# Assembly listing file (for debugging)
# Assembly listing file (for debugging)
$(APP_ASM): main.elf
$(APP_ASM): main.elf
Line 210... Line 196...
        @$(CC) $(CC_OPTS) -c $< -o $@
        @$(CC) $(CC_OPTS) -c $< -o $@
 
 
# Compile and install bootloader
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
        @set -e
        @set -e
        @$(LD) $(LD_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) $(LIBC_PATH) $(LIBGCC_PATH) -o bootloader.elf
        @$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
        @echo "Memory utilization:"
        @echo "Memory utilization:"
        @$(SIZE) bootloader.elf
        @$(SIZE) bootloader.elf
        @$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
        @$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
        @$(OBJCOPY) -I elf32-little bootloader.elf -j .text   -O binary text.bin
        @$(OBJCOPY) -I elf32-little bootloader.elf -j .text   -O binary text.bin
        @$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
        @$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
Line 235... Line 221...
$(error NEORV32_HOME folder not found!)
$(error NEORV32_HOME folder not found!)
endif
endif
        @echo "NEORV32_HOME: $(NEORV32_HOME)"
        @echo "NEORV32_HOME: $(NEORV32_HOME)"
        @echo "---------------- Check: $(CC) ----------------"
        @echo "---------------- Check: $(CC) ----------------"
        @$(CC) -v
        @$(CC) -v
        @echo "---------------- Check: $(LD) ----------------"
 
        @$(LD) -V
 
        @echo "---------------- Check: $(OBJDUMP) ----------------"
        @echo "---------------- Check: $(OBJDUMP) ----------------"
        @$(OBJDUMP) -V
        @$(OBJDUMP) -V
        @echo "---------------- Check: $(OBJCOPY) ----------------"
        @echo "---------------- Check: $(OBJCOPY) ----------------"
        @$(OBJCOPY) -V
        @$(OBJCOPY) -V
        @echo "---------------- Check: $(SIZE) ----------------"
        @echo "---------------- Check: $(SIZE) ----------------"
        @$(SIZE) -V
        @$(SIZE) -V
        @echo "---------------- Check: NEORV32 image_gen ----------------"
        @echo "---------------- Check: NEORV32 image_gen ----------------"
        @$(IMAGE_GEN) -help
        @$(IMAGE_GEN) -help
        @echo "---------------- Check: native gcc ----------------"
        @echo "---------------- Check: Native GCC ----------------"
        @$(CC_X86) -v
        @$(CC_X86) -v
        @echo
        @echo
        @echo "Toolchain check OK"
        @echo "Toolchain check OK"
 
 
 
 
Line 274... Line 258...
        @echo "MARCH:     $(MARCH)"
        @echo "MARCH:     $(MARCH)"
        @echo "MABI:      $(MABI)"
        @echo "MABI:      $(MABI)"
        @echo "---------------- Info: RISC-V Toolchain ----------------"
        @echo "---------------- Info: RISC-V Toolchain ----------------"
        @echo "Toolchain: $(RISCV_TOLLCHAIN)"
        @echo "Toolchain: $(RISCV_TOLLCHAIN)"
        @echo "CC:        $(CC)"
        @echo "CC:        $(CC)"
        @echo "LD:        $(LD)"
 
        @echo "OBJDUMP:   $(OBJDUMP)"
        @echo "OBJDUMP:   $(OBJDUMP)"
        @echo "OBJCOPY:   $(OBJCOPY)"
        @echo "OBJCOPY:   $(OBJCOPY)"
        @echo "SIZE:      $(SIZE)"
        @echo "SIZE:      $(SIZE)"
        @echo "---------------- Info: C Lib ----------------"
        @echo "---------------- Info: Libraries ----------------"
        @echo "CLIB:      $(LIBC_PATH)"
        @echo "LIBGCC:"
        @echo "GCCLIB:    $(LIBGCC_PATH)"
        @$(CC) -print-libgcc-file-name
 
        @echo "SEARCH-DIRS:"
 
        @$(CC) -print-search-dirs
        @echo "---------------- Info: Flags ----------------"
        @echo "---------------- Info: Flags ----------------"
        @echo "CC_OPTS:   $(CC_OPTS)"
        @echo "CC_OPTS:   $(CC_OPTS)"
        @echo "LD_OPTS:   $(LD_OPTS)"
        @echo "---------------- Info: Host Native GCC Flags ----------------"
        @echo "---------------- Info: Host Native GCC ----------------"
 
        @echo "CC_X86:    $(CC_X86)"
        @echo "CC_X86:    $(CC_X86)"
 
 
 
 
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Show final ELF details (just for debugging)
# Show final ELF details (just for debugging)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.