-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zone.N <[email protected]>
- Loading branch information
Showing
67 changed files
with
2,645 additions
and
6 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
# This file is a part of Simple-XX/SimpleRTOS | ||
# (https://github.com/Simple-XX/SimpleRTOS). | ||
# | ||
# .clang-format for Simple-XX/SimpleRTOS. | ||
|
||
--- | ||
# @version clang-format version 15 | ||
# @see https://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
# 使用 LLVM 规范 | ||
BasedOnStyle: LLVM | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
# This file is a part of Simple-XX/SimpleRTOS | ||
# (https://github.com/Simple-XX/SimpleRTOS). | ||
# | ||
# .clang-tidy for Simple-XX/SimpleRTOS. | ||
|
||
--- | ||
Checks: '-*,\ | ||
bugprone-*,\ | ||
clang-analyzer-*,\ | ||
cppcoreguidelines-*,\ | ||
hicpp-*,\ | ||
llvm-*,\ | ||
misc-* | ||
modernize-*,\ | ||
performance-*,\ | ||
portability-*,\ | ||
readability-*,\ | ||
-cppcoreguidelines-pro-type-reinterpret-cast' | ||
HeaderFilterRegex: '^${sourceDir}/src' | ||
AnalyzeTemporaryDtors: true | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
|
||
# This file is a part of Simple-XX/SimpleRTOS | ||
# (https://github.com/Simple-XX/SimpleRTOS). | ||
# | ||
# workflow.yml for Simple-XX/SimpleRTOS. | ||
|
||
name: build | ||
|
||
on: | ||
- push | ||
- pull_request | ||
- release | ||
|
||
env: | ||
CMAKE_BUILD_TYPE: Release | ||
|
||
jobs: | ||
build_docs: | ||
name: Build and publish documentation | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install --fix-missing -y doxygen graphviz clang-format clang-tidy cppcheck qemu-system lcov | ||
sudo apt install --fix-missing -y gcc g++ gcc-riscv64-linux-gnu g++-riscv64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
- name: Build | ||
run: | | ||
cmake --preset=build_x86_64 | ||
cmake --build build_x86_64 --target doc | ||
- name: Publish | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ${{github.workspace}}/doc/html | ||
|
||
build_ubuntu: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install --fix-missing -y doxygen graphviz clang-format clang-tidy cppcheck qemu-system lcov | ||
sudo apt install --fix-missing -y gcc g++ gcc-riscv64-linux-gnu g++-riscv64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
- name: x86_64 | ||
run: | | ||
cmake --preset=build_x86_64 | ||
# @todo ci 暂时跑不过 | ||
# cmake --build build_x86_64 --target boot | ||
# cmake --build build_x86_64 --target kernel | ||
cmake --build build_x86_64 --target coverage | ||
- name: riscv64 | ||
run: | | ||
cmake --preset=build_riscv64 | ||
# @todo ci 暂时跑不过 | ||
# cmake --build build_riscv64 --target kernel | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: build_x86_64/coverage/coverage.info | ||
verbose: true | ||
|
||
# build_osx: | ||
# runs-on: macos-latest | ||
# steps: | ||
# - name: get code | ||
# uses: actions/checkout@v3 | ||
# | ||
# - name: setup toolchain | ||
# shell: bash | ||
# run: | | ||
# brew install x86_64-elf-gcc | ||
# brew tap riscv-software-src/riscv | ||
# brew install riscv-tools | ||
# | ||
# - name: make build dir | ||
# shell: bash | ||
# run: | | ||
# mkdir ${{github.workspace}}/build | ||
# | ||
# - name: osx-i386 | ||
# shell: bash | ||
# working-directory: ${{github.workspace}}/build | ||
# run: | | ||
# cmake -DTOOLCHAIN_PREFIX=x86_64-elf- -DCMAKE_C_COMPILER=x86_64-elf-gcc -DCMAKE_CXX_COMPILER=x86_64-elf-g++ -DARCH=i386 -DCMAKE_BUILD_TYPE=RELEASE -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 .. | ||
# make | ||
# rm -rf ./* | ||
# | ||
# - name: osx-x86_64 | ||
# shell: bash | ||
# working-directory: ${{github.workspace}}/build | ||
# run: | | ||
# cmake -DTOOLCHAIN_PREFIX=x86_64-elf- -DCMAKE_C_COMPILER=x86_64-elf-gcc -DCMAKE_CXX_COMPILER=x86_64-elf-g++ -DARCH=x86_64 -DCMAKE_BUILD_TYPE=RELEASE -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 .. | ||
# make | ||
# rm -rf ./* | ||
# | ||
# - name: osx-riscv64 | ||
# shell: bash | ||
# working-directory: ${{github.workspace}}/build | ||
# run: | | ||
# cmake -DTOOLCHAIN_PREFIX=riscv64-unknown-elf- -DCMAKE_C_COMPILER=riscv64-unknown-elf-gcc -DCMAKE_CXX_COMPILER=riscv64-unknown-elf-g++ -DARCH=riscv64 -DCMAKE_BUILD_TYPE=RELEASE -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 .. | ||
# make | ||
# rm -rf ./* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
# This file is a part of Simple-XX/SimpleRTOS | ||
# (https://github.com/Simple-XX/SimpleRTOS). | ||
# | ||
# .gitignore for Simple-XX/SimpleRTOS. | ||
|
||
*.o | ||
.DS_Store | ||
build | ||
build_aarch64 | ||
build_riscv64 | ||
build_x86_64 | ||
doc/html | ||
cmake-build* | ||
.gdbinit | ||
tools/opensbi/build | ||
.vscode | ||
.idea | ||
3rd | ||
Doxyfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
# This file is a part of Simple-XX/SimpleRTOS | ||
# (https://github.com/Simple-XX/SimpleRTOS). | ||
# | ||
# CMakeLists.txt for Simple-XX/SimpleRTOS. | ||
|
||
# 设置最小 cmake 版本 | ||
cmake_minimum_required(VERSION 3.27 FATAL_ERROR) | ||
|
||
# 设置项目名与版本 | ||
project( | ||
SimpleRTOS | ||
VERSION 0.0.1 | ||
) | ||
|
||
# 禁止原地编译 | ||
if (${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR}) | ||
# 如果你看到这句话,cmake 此时已经在根目录下生成了一些临时文件,你需要删除它们 | ||
# CMakeFiles, CMakeCache.txt | ||
message( | ||
FATAL_ERROR | ||
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there." | ||
) | ||
endif () | ||
|
||
# 设置辅助 cmake 脚本路径 | ||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") | ||
|
||
# 导入项目配置 | ||
include(project_config) | ||
# 导入头文件处理 | ||
include(add_header) | ||
# 导入函数 | ||
include(functions) | ||
|
||
# 导入第三方依赖 | ||
include(3rd) | ||
|
||
# 导入编译配置 | ||
include(compile_config) | ||
|
||
# qemu 参数设置 | ||
list(APPEND QEMU_FLAGS | ||
# 使用标准输出显示 | ||
-serial stdio | ||
# 启动 telnet 服务,使用 2333 端口,不等待连接 | ||
-monitor ${QEMU_MONITOR_ARG} | ||
) | ||
# 目标平台参数 | ||
if(TARGET_ARCH STREQUAL "x86_64") | ||
list(APPEND QEMU_FLAGS | ||
-m 128M | ||
-net none | ||
-bios ${ovmf_BINARY_DIR}/OVMF_${TARGET_ARCH}.fd | ||
-hda fat:rw:./image/ | ||
) | ||
elseif(TARGET_ARCH STREQUAL "riscv64") | ||
list(APPEND QEMU_FLAGS | ||
-machine virt | ||
-nographic | ||
# 可选项,qemu7.0 自带了 opensbi1.0 | ||
-bios ${opensbi_BINARY_DIR}/platform/generic/firmware/fw_jump.elf | ||
-kernel $<TARGET_FILE:kernel> | ||
) | ||
elseif(TARGET_ARCH STREQUAL "aarch64") | ||
# @todo | ||
endif() | ||
|
||
# 添加要编译的目录 | ||
add_subdirectory(${PROJECT_SOURCE_DIR}/src) | ||
add_subdirectory(${PROJECT_SOURCE_DIR}/test) | ||
add_subdirectory(${PROJECT_SOURCE_DIR}/doc) | ||
|
||
# 添加 run 和 debug target | ||
add_run_target(NAME run | ||
DEPENDS $<$<STREQUAL:${TARGET_ARCH},x86_64>:boot> kernel ${RUN_DEPENDS} ${DEBUG_DEPENDS} | ||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} | ||
TARGET ${TARGET_ARCH} | ||
BOOT ${PROJECT_BINARY_DIR}/src/boot/boot.efi | ||
KERNEL $<TARGET_FILE:kernel> | ||
QEMU_FLAGS ${QEMU_FLAGS} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
{ | ||
"version": 6, | ||
"cmakeMinimumRequired": { | ||
"major": 3, | ||
"minor": 27, | ||
"patch": 0 | ||
}, | ||
"configurePresets": [ | ||
{ | ||
"name": "std", | ||
"description": "This preset makes sure the project actually builds with at least the specified standard", | ||
"hidden": true, | ||
"cacheVariables": { | ||
"CMAKE_C_EXTENSIONS": "OFF", | ||
"CMAKE_C_STANDARD": "17", | ||
"CMAKE_C_STANDARD_REQUIRED": "ON", | ||
"CMAKE_CXX_EXTENSIONS": "OFF", | ||
"CMAKE_CXX_STANDARD": "20", | ||
"CMAKE_CXX_STANDARD_REQUIRED": "ON" | ||
} | ||
}, | ||
{ | ||
"name": "configurePresets_base", | ||
"hidden": true, | ||
"inherits": [ | ||
"std" | ||
], | ||
"condition": true, | ||
"displayName": "configurePresets_base", | ||
"description": "base configurePresets", | ||
"generator": "Unix Makefiles", | ||
"toolchainFile": "", | ||
"binaryDir": "", | ||
"installDir": "", | ||
"cacheVariables": { | ||
"CMAKE_VERBOSE_MAKEFILE": { | ||
"type": "BOOL", | ||
"value": "TRUE" | ||
}, | ||
"CMAKE_EXPORT_COMPILE_COMMANDS": { | ||
"type": "BOOL", | ||
"value": "ON" | ||
}, | ||
"CMAKE_BUILD_TYPE": { | ||
"type": "STRING", | ||
"value": "Debug" | ||
}, | ||
"COVERAGE_OUTPUT_DIR": { | ||
"type": "STRING", | ||
"value": "coverage" | ||
}, | ||
"PLATFORM": { | ||
"type": "STRING", | ||
"value": "qemu" | ||
}, | ||
"QEMU_GDB_PORT": { | ||
"type": "STRING", | ||
"value": "tcp::1234" | ||
}, | ||
"QEMU_MONITOR_ARG": { | ||
"type": "STRING", | ||
"value": "telnet::2333,server,nowait" | ||
}, | ||
"BOOT_ELF_OUTPUT_NAME": { | ||
"type": "STRING", | ||
"value": "boot.elf" | ||
}, | ||
"BOOT_EFI_OUTPUT_NAME": { | ||
"type": "STRING", | ||
"value": "boot.efi" | ||
}, | ||
"KERNEL_ELF_OUTPUT_NAME": { | ||
"type": "STRING", | ||
"value": "kernel.elf" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "build_x86_64", | ||
"hidden": false, | ||
"inherits": [ | ||
"configurePresets_base" | ||
], | ||
"displayName": "build x86_64 kernel", | ||
"description": "build x86_64 kernel", | ||
"toolchainFile": "${sourceDir}/cmake/x86_64-x86_64-gcc.cmake", | ||
"binaryDir": "${sourceDir}/build_x86_64", | ||
"cacheVariables": { | ||
"TARGET_ARCH": { | ||
"type": "STRING", | ||
"value": "x86_64" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "build_riscv64", | ||
"hidden": false, | ||
"inherits": [ | ||
"configurePresets_base" | ||
], | ||
"displayName": "build riscv64 kernel", | ||
"description": "build riscv64 kernel", | ||
"toolchainFile": "${sourceDir}/cmake/x86_64-riscv64-gcc.cmake", | ||
"binaryDir": "${sourceDir}/build_riscv64", | ||
"cacheVariables": { | ||
"TARGET_ARCH": { | ||
"type": "STRING", | ||
"value": "riscv64" | ||
} | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.