From 4e39007d175a9987f75a6e51037e6cdf3d9b25dc Mon Sep 17 00:00:00 2001 From: bLueriVerLHR Date: Thu, 11 May 2023 16:10:59 +0800 Subject: [PATCH] [Modified] init laos compile env --- .gitignore | 3 ++- CMakeLists.txt | 2 +- laos/.gitignore | 1 + laos/CMakeLists.txt | 8 -------- laos/Makefile | 26 ++++++++++++++++++++++++++ laos/include/common.h | 5 +++++ laos/main.c | 3 --- laos/src/common/common.c | 0 laos/src/main.c | 6 ++++++ 9 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 laos/.gitignore delete mode 100644 laos/CMakeLists.txt create mode 100644 laos/Makefile create mode 100644 laos/include/common.h delete mode 100644 laos/main.c create mode 100644 laos/src/common/common.c create mode 100644 laos/src/main.c diff --git a/.gitignore b/.gitignore index 608b1d4..3e52f59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .vscode/ -build/ \ No newline at end of file +build/ +ext/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index db1f5d9..a941f29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ add_executable(${LA_SIM_TARGET} ${LASIM_SRC}) # ----- ----- 构建操作系统 ----- ----- set(LAOS laos) -add_subdirectory(${LAOS}) +# add_custom_target(${LAOS} make build) # ----- ----- 构建 Verilator 项目 ----- ----- diff --git a/laos/.gitignore b/laos/.gitignore new file mode 100644 index 0000000..d163863 --- /dev/null +++ b/laos/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/laos/CMakeLists.txt b/laos/CMakeLists.txt deleted file mode 100644 index ad25ed3..0000000 --- a/laos/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.12) - -set(LA_OS_TARGET ${PROJECT_NAME}-os) - -# get all cxx source files from lasim folder -file(GLOB_RECURSE LAOS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c) - -add_executable(${LA_OS_TARGET} ${LAOS_SRC}) \ No newline at end of file diff --git a/laos/Makefile b/laos/Makefile new file mode 100644 index 0000000..fe3a8fc --- /dev/null +++ b/laos/Makefile @@ -0,0 +1,26 @@ +LA_BIN_PATH := $(CURDIR)/../ext/loongarch32r-linux-gnusf-2022-05-20/bin +LA_PREFIX := loongarch32r-linux-gnusf- + +CC := $(LA_BIN_PATH)/$(LA_PREFIX)gcc +CXX := $(LA_BIN_PATH)/$(LA_PREFIX)g++ +OD := $(LA_BIN_PATH)/$(LA_PREFIX)objdump +OC := $(LA_BIN_PATH)/$(LA_PREFIX)objcopy + +CMAKE := cmake + +BUILD_DIR := build +$(shell mkdir -p $(BUILD_DIR)) + +BIN := neula-os +COMMON_DIR := COMMON + +FILES := $(shell find src -name *.c) + +.PHONY: build clean + +build: + $(CC) $(FILES) -o $(BUILD_DIR)/$(BIN) + $(OD) -D $(BUILD_DIR)/$(BIN) > $(BUILD_DIR)/$(BIN).dump + +clean: + rm -rf $(BUILD_DIR) \ No newline at end of file diff --git a/laos/include/common.h b/laos/include/common.h new file mode 100644 index 0000000..02461ab --- /dev/null +++ b/laos/include/common.h @@ -0,0 +1,5 @@ +#ifndef COMMON_H__ +#define COMMON_H__ + + +#endif // COMMON_H__ \ No newline at end of file diff --git a/laos/main.c b/laos/main.c deleted file mode 100644 index e9cdae1..0000000 --- a/laos/main.c +++ /dev/null @@ -1,3 +0,0 @@ -int main() { - return 0; -} \ No newline at end of file diff --git a/laos/src/common/common.c b/laos/src/common/common.c new file mode 100644 index 0000000..e69de29 diff --git a/laos/src/main.c b/laos/src/main.c new file mode 100644 index 0000000..93ebade --- /dev/null +++ b/laos/src/main.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("%d", 123); + return 0; +} \ No newline at end of file