[Modified] init laos compile env

This commit is contained in:
bLueriVerLHR
2023-05-11 16:10:59 +08:00
parent 5fb23889fa
commit 4e39007d17
9 changed files with 41 additions and 13 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
.vscode/
build/
ext/

View File

@@ -43,7 +43,7 @@ add_executable(${LA_SIM_TARGET} ${LASIM_SRC})
# ----- ----- 构建操作系统 ----- -----
set(LAOS laos)
add_subdirectory(${LAOS})
# add_custom_target(${LAOS} make build)
# ----- ----- 构建 Verilator 项目 ----- -----

1
laos/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
build/

View File

@@ -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})

26
laos/Makefile Normal file
View File

@@ -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)

5
laos/include/common.h Normal file
View File

@@ -0,0 +1,5 @@
#ifndef COMMON_H__
#define COMMON_H__
#endif // COMMON_H__

View File

@@ -1,3 +0,0 @@
int main() {
return 0;
}

0
laos/src/common/common.c Normal file
View File

6
laos/src/main.c Normal file
View File

@@ -0,0 +1,6 @@
#include <stdio.h>
int main() {
printf("%d", 123);
return 0;
}