Delete obsolete makefiles that were causing confusion from RISC-V-Qemu-sifive_e-FreedomStudio demo.

This commit is contained in:
Richard Barry 2019-07-25 20:11:37 +00:00
parent 10b7b52995
commit b24ab46d39
4 changed files with 45 additions and 304 deletions

View File

@ -1,25 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.516870870" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-370325918343060407" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1992646408" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-364619458802839811" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.516870870" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="589632151712267266" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1992646408" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="602853956613322166" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>

View File

@ -1,53 +0,0 @@
#
# File: BuildEnvironment.mk
# Copyright (c) 2019, Dornerworks Ltd.
#
BUILD_DIR = ./build
CROSS_COMPILE_PREFIX = riscv32-unknown-elf
SDK_DIR = ./freedom-e-sdk
LINKER_SCRIPT = $(SDK_DIR)/env/freedom-e300-hifive1/flash.lds
#-----------------------------------------------------------
GCC = $(CROSS_COMPILE_PREFIX)-gcc
OBJCOPY = $(CROSS_COMPILE_PREFIX)-objcopy
OBJDUMP = $(CROSS_COMPILE_PREFIX)-objdump
AR = $(CROSS_COMPILE_PREFIX)-ar
RANLIB = $(CROSS_COMPILE_PREFIX)-ranlib
GDB = $(CROSS_COMPILE_PREFIX)-gdb
# if using the multi-arch (riscv64-unknown-elf-gcc):
ARCH_FLAGS = -march=rv32imac -mabi=ilp32 -mcmodel=medany
# Basic CFLAGS:
CFLAGS = -Wall -Wextra -O0 -g3 -msmall-data-limit=8 -std=gnu11
CFLAGS += -ffunction-sections -fdata-sections -fno-builtin-printf
CFLAGS += -DDONT_USE_PLIC -DDONT_USE_M_TIME
CFLAGS += -include sys/cdefs.h
CFLAGS += $(ARCH_FLAGS)
# These flags are for outputing *.d dependency files for make
CFLAGS += -MT"$@" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)"
ASMFLAGS = -O0 -g3
ASMFLAGS += $(ARCH_FLAGS)
ASMFLAGS += -DportasmHANDLE_INTERRUPT=handle_trap
ASMFLAGS += -msmall-data-limit=8
ASMFLAGS += -ffunction-sections -fdata-sections
ASMFLAGS += -x assembler-with-cpp
ASMFLAGS += -MT"$@" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)"
# Linker arguments __________________________________________
LDFLAGS := -Xlinker --gc-sections -Xlinker --defsym=__stack_size=1K
LDFLAGS += -O0 -g3
LDFLAGS += -ffunction-sections -fdata-sections --specs=nano.specs
LDFLAGS += -nostartfiles
LDFLAGS += -T $(LINKER_SCRIPT)
LDFLAGS += -L../
LDFLAGS += -Wl,--start-group -Wl,--end-group
LDFLAGS += -Wl,--wrap=malloc -Wl,--wrap=free -Wl,--wrap=open -Wl,--wrap=lseek -Wl,--wrap=read -Wl,--wrap=write
LDFLAGS += -Wl,--wrap=fstat -Wl,--wrap=stat -Wl,--wrap=close -Wl,--wrap=link -Wl,--wrap=unlink -Wl,--wrap=execve
LDFLAGS += -Wl,--wrap=fork -Wl,--wrap=getpid -Wl,--wrap=kill -Wl,--wrap=wait -Wl,--wrap=isatty -Wl,--wrap=times
LDFLAGS += -Wl,--wrap=sbrk -Wl,--wrap=_exit -Wl,--wrap=puts -Wl,--wrap=_malloc -Wl,--wrap=_free -Wl,--wrap=_open
LDFLAGS += -Wl,--wrap=_lseek -Wl,--wrap=_read -Wl,--wrap=_write -Wl,--wrap=_fstat -Wl,--wrap=_stat -Wl,--wrap=_close
LDFLAGS += -Wl,--wrap=_link -Wl,--wrap=_unlink -Wl,--wrap=_execve -Wl,--wrap=_fork -Wl,--wrap=_getpid -Wl,--wrap=_kill
LDFLAGS += -Wl,--wrap=_wait -Wl,--wrap=_isatty -Wl,--wrap=_times -Wl,--wrap=_sbrk -Wl,--wrap=__exit -Wl,--wrap=_puts

View File

@ -1,32 +0,0 @@
#
# File: FreeRTOS.mk
# Copyright (c) 2019, Dornerworks Ltd.
#
-include BuildEnvironment.mk
FREERTOS_DIR = ../..
FREERTOS_SOURCE_DIR = $(FREERTOS_DIR)/Source
FREERTOS_SRC = \
$(FREERTOS_SOURCE_DIR)/croutine.c \
$(FREERTOS_SOURCE_DIR)/list.c \
$(FREERTOS_SOURCE_DIR)/queue.c \
$(FREERTOS_SOURCE_DIR)/tasks.c \
$(FREERTOS_SOURCE_DIR)/timers.c \
$(FREERTOS_SOURCE_DIR)/event_groups.c \
$(FREERTOS_SOURCE_DIR)/stream_buffer.c \
$(FREERTOS_SOURCE_DIR)/portable/MemMang/heap_4.c
FREERTOS_INC = $(FREERTOS_SOURCE_DIR)/include
FREERTOS_INCLUDES := \
-I $(FREERTOS_INC)
INTERRUPT_HANDLER = main_blinky
FREERTOS_BUILD_DIR = $(BUILD_DIR)/FreeRTOS
FREERTOS_OBJS = $(patsubst %.c,$(FREERTOS_BUILD_DIR)/%.o,$(notdir $(FREERTOS_SRC)))
VPATH += \
$(FREERTOS_SOURCE_DIR) \
$(FREERTOS_SOURCE_DIR)/portable/MemMang

View File

@ -1,197 +0,0 @@
#
# File: Makefile
# Copyright (c) 2019, Dornerworks Ltd.
#
PROJ_NAME ?= simple
include BuildEnvironment.mk
include FreeRTOS.mk
-include $(wildcard $(OUTDIR)/*.d)
# Platform spcific settings for this application _____________________________________________
ARCH = RISC-V
ARCH_PORTABLE_INC = $(FREERTOS_SOURCE_DIR)/portable/GCC/$(ARCH)/
ARCH_PORTABLE_SRC = $(FREERTOS_SOURCE_DIR)/portable/GCC/$(ARCH)/port.c
ARCH_PORTABLE_ASM = $(FREERTOS_SOURCE_DIR)/portable/GCC/$(ARCH)/portASM.S
SDK_SRC := \
$(SDK_DIR)/libwrap/sys/_exit.c \
$(SDK_DIR)/libwrap/sys/close.c \
$(SDK_DIR)/libwrap/sys/execve.c \
$(SDK_DIR)/libwrap/sys/fork.c \
$(SDK_DIR)/libwrap/sys/fstat.c \
$(SDK_DIR)/libwrap/sys/getpid.c \
$(SDK_DIR)/libwrap/sys/isatty.c \
$(SDK_DIR)/libwrap/sys/kill.c \
$(SDK_DIR)/libwrap/sys/link.c \
$(SDK_DIR)/libwrap/sys/lseek.c \
$(SDK_DIR)/libwrap/sys/openat.c \
$(SDK_DIR)/libwrap/sys/puts.c \
$(SDK_DIR)/libwrap/sys/read.c \
$(SDK_DIR)/libwrap/sys/sbrk.c \
$(SDK_DIR)/libwrap/sys/stat.c \
$(SDK_DIR)/libwrap/sys/times.c \
$(SDK_DIR)/libwrap/sys/unlink.c \
$(SDK_DIR)/libwrap/sys/wait.c \
$(SDK_DIR)/libwrap/sys/write.c \
$(SDK_DIR)/libwrap/stdlib/malloc.c \
$(SDK_DIR)/libwrap/misc/write_hex.c \
$(SDK_DIR)/env/freedom-e300-hifive1/init.c \
$(SDK_DIR)/drivers/plic/plic_driver.c \
$(SDK_DIR)/drivers/fe300prci/fe300prci_driver.c
SDK_ASM := \
$(SDK_DIR)/env/entry.S \
$(SDK_DIR)/env/start.S
SDK_OBJS := $(patsubst %.c,$(FREERTOS_BUILD_DIR)/%.o,$(notdir $(SDK_SRC)))
SDK_OBJS += $(patsubst %.S,$(FREERTOS_BUILD_DIR)/%.o,$(notdir $(SDK_ASM)))
VPATH += \
$(SDK_DIR)/env \
$(SDK_DIR)/env/freedom-e300-hifive1 \
$(SDK_DIR)/libwrap/sys \
$(SDK_DIR)/libwrap/misc \
$(SDK_DIR)/libwrap/stdlib \
$(SDK_DIR)/drivers/plic \
$(SDK_DIR)/drivers/fe300prci
PORT_OBJS := $(patsubst %.c,$(FREERTOS_BUILD_DIR)/%.o,$(notdir $(ARCH_PORTABLE_SRC)))
PORT_OBJS += $(patsubst %.S,$(FREERTOS_BUILD_DIR)/%.o,$(notdir $(ARCH_PORTABLE_ASM)))
FREERTOS_OBJS += $(PORT_OBJS) $(SDK_OBJS)
VPATH += $(FREERTOS_SOURCE_DIR)/portable/GCC/$(ARCH)
CFLAGS += -DportasmHANDLE_INTERRUPT=$(INTERRUPT_HANDLER)
# Set up application source, include, and object files for compilation: ______________________
APP_SRC_DIR = .
APP_SRC = \
$(APP_SRC_DIR)/main.c \
$(APP_SRC_DIR)/blinky_demo/main_blinky.c \
$(APP_SRC_DIR)/full_demo/main_full.c
APP_ASM = \
$(APP_SRC_DIR)/full_demo/RegTest.S
APP_INCLUDES = \
-I ./ \
-I $(SDK_DIR)/include \
-I $(SDK_DIR)/env/freedom-e300-hifive1 \
-I $(SDK_DIR)/env \
-I $(FREERTOS_INC) \
-I $(ARCH_PORTABLE_INC) \
-I $(FREERTOS_DIR)/Demo/Common/include
APP_BUILD_DIR = $(BUILD_DIR)/app
APP_OBJS := $(patsubst %.c,$(APP_BUILD_DIR)/%.o,$(notdir $(APP_SRC)))
APP_OBJS += $(patsubst %.S,$(APP_BUILD_DIR)/%.o,$(notdir $(APP_ASM)))
VPATH += \
$(APP_SRC_DIR)/blinky_demo \
$(APP_SRC_DIR)/full_demo \
$(APP_SRC_DIR)
DEMO_COMMON_SRC = \
$(FREERTOS_DIR)/Demo/Common/Minimal/EventGroupsDemo.c \
$(FREERTOS_DIR)/Demo/Common/Minimal/TimerDemo.c \
$(FREERTOS_DIR)/Demo/Common/Minimal/TaskNotify.c \
$(FREERTOS_DIR)/Demo/Common/Minimal/GenQTest.c \
$(FREERTOS_DIR)/Demo/Common/Minimal/blocktim.c \
$(FREERTOS_DIR)/Demo/Common/Minimal/dynamic.c \
$(FREERTOS_DIR)/Demo/Common/Minimal/recmutex.c
DEMO_COMMON_OBJS := $(patsubst %.c,$(APP_BUILD_DIR)/%.o,$(notdir $(DEMO_COMMON_SRC)))
VPATH += $(FREERTOS_DIR)/Demo/Common/Minimal
OUT_ELF = $(BUILD_DIR)/FreeRTOS-$(PROJ_NAME).elf
# Need to tell FreeRTOS where to find the FreeRTOSConfig.h __________________________________
FREERTOS_INCLUDES += \
-I ./ \
-I $(ARCH_PORTABLE_INC) \
-I $(SDK_DIR)/include \
-I $(SDK_DIR)/env/freedom-e300-hifive1 \
-I $(SDK_DIR)/env \
-I $(SDK_DIR)/drivers \
-I $(FREERTOS_DIR)/Demo/Common/include \
-I $(FREERTOS_SOURCE_DIR)/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions
# List of object files to compile for the system:
OUT_OBJS = \
$(APP_OBJS) \
$(DEMO_COMMON_OBJS) \
$(FREERTOS_OBJS)
BUILD_DIRECTORIES = \
$(APP_BUILD_DIR) \
$(FREERTOS_BUILD_DIR)
LDFLAGS += -Wl,-Map,"$(BUILD_DIR)/$(PROJ_NAME).map"
.PHONY: debug clean app_compile debug-app frtos_compile print-info out_elf sim-qemu gdb
all: directories $(OUT_OBJS) $(OUT_ELF)
directories: $(BUILD_DIRECTORIES)
app_compile: directories $(APP_OBJS)
frtos_compile: directories $(FREERTOS_OBJS)
out_elf: directories $(OUT_ELF)
# Notes
# Each "Module" needs
# - Lists of source files
# - Source Directory(ies)
# - Include Directory List (with -I prepending each entry)
# - Build Directory
# - Object list
# - OBJS = $(patsubst %.c,$(MODULE_BUILD_DIR)/%.o,$(notdir $(MODULE_SRC)))
# - Add source direcories to VPATH
# In the master make file
# - Module build directory must be created
# - Object Rules can be done with
# - $(MODULE_BUILD_DIR)/%.o : %.c
# Compile Object Files ____________________________________________________________________
$(APP_BUILD_DIR)/%.o : %.c
@echo "[APP Objects] : $@ ______________________________________________________________"
@echo "Building: $<"
$(GCC) $(CFLAGS) $(APP_INCLUDES) -o $@ -c $<
@echo "Finished Building: $<"
$(APP_BUILD_DIR)/%.o : %.S
@echo "[APP Objects] : $@ ______________________________________________________________"
@echo "Building: $<"
$(GCC) $(ASMFLAGS) $(APP_INCLUDES) $(FREERTOS_INCLUDES) -o $@ -c $<
@echo "Finished Building: $<"
$(FREERTOS_BUILD_DIR)/%.o : %.c
@echo "[FreeRTOS Objects] : $@ __________________________________________________________"
@echo "Building: $<"
$(GCC) $(CFLAGS) $(FREERTOS_INCLUDES) -o $@ -c $<
@echo "Finished Building: $<"
$(FREERTOS_BUILD_DIR)/%.o : %.S
@echo "[FreeRTOS Objects] : $@ __________________________________________________________"
@echo "Building: $<"
$(GCC) $(ASMFLAGS) $(FREERTOS_INCLUDES) -o $@ -c $<
@echo "Finished Building: $<"
# Generate ELF ___________________________________________________________________________
$(OUT_ELF): $(OUT_OBJS)
@echo '___________________________________________________________________________________'
@echo 'Building target: $@'
@echo '_______________________________'
$(GCC) $(LDFLAGS) $(LDOPTS) -o $@ $(OUT_OBJS) $(LIB_FLAGS)
@echo 'Finished building target: $@'
@echo ' '
.PHONY: build_lib
$(BUILD_DIRECTORIES):
mkdir -p $@
clean:
rm -rv $(BUILD_DIR)
sim-qemu: $(OUT_ELF)
qemu-system-riscv32 -kernel $^ -S -s -machine sifive_e
gdb: $(OUT_ELF)
$(GDB) -iex "set mem inaccessible-by-default off" -iex "set arch riscv:rv32" -iex "set riscv use_compressed_breakpoint off"