Skip to content

Commit

Permalink
Merge pull request #30 from ToolmanP/lab2
Browse files Browse the repository at this point in the history
lab2: migrate to new architecture
  • Loading branch information
ToolmanP authored Sep 21, 2024
2 parents 415d7a6 + 987c4ca commit 59608cd
Show file tree
Hide file tree
Showing 251 changed files with 1,675 additions and 4,059 deletions.
2 changes: 2 additions & 0 deletions Lab2/.clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CompileFlags:
CompilationDatabase: build/kernel/
6 changes: 0 additions & 6 deletions Lab2/.gdbinit

This file was deleted.

29 changes: 29 additions & 0 deletions Lab2/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "QEMU (cppdbg)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/kernel.img",
"args": [],
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"stopAtEntry": true,
"stopAtConnect": true,
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
],
"MIMode": "gdb",
"targetArchitecture": "arm64",
"miDebuggerServerAddress": "localhost:1234",
"miDebuggerPath": "/usr/local/bin/gdb",
"preLaunchTask": "Setup QEMU"
}
]
}
6 changes: 6 additions & 0 deletions Lab2/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"clangd.arguments": [
"--compile-commands-dir=build/kernel"
],
"debug.allowBreakpointsEverywhere": true
}
21 changes: 21 additions & 0 deletions Lab2/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Setup QEMU",
"type": "shell",
"isBackground": true,
"command": "make qemu-gdb",
"problemMatcher": {
"pattern": {
"regexp": "^\\[QEMU\\] Waiting for GDB Connection"
},
"background": {
"activeOnStart": true,
"beginsPattern": "^\\[QEMU\\] Waiting for GDB Connection",
"endsPattern": "^\\[QEMU\\] Waiting for GDB Connection",
}
}
}
]
}
4 changes: 2 additions & 2 deletions Lab2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
cmake_minimum_required(VERSION 3.14)
project(ChCore)

set(_cmake_script_dir ${CMAKE_CURRENT_SOURCE_DIR}/scripts/build/cmake)
set(_cmake_script_dir ${CMAKE_CURRENT_SOURCE_DIR}/../Scripts/build/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_cmake_script_dir}/Modules)
set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR}/user)

Expand Down Expand Up @@ -201,7 +201,7 @@ chcore_add_subproject(
-DCHCORE_USER_INSTALL_DIR=${_system_services_install_dir} # used by kernel/CMakeLists.txt to incbin cpio files
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_TOOLCHAIN_FILE=${_cmake_script_dir}/Toolchains/kernel.cmake
CMAKE_CACHE_ARGS ${_cache_args}
${_cache_args}
DEPENDS kernel-clean-incbin
BUILD_ALWAYS TRUE)

Expand Down
47 changes: 1 addition & 46 deletions Lab2/Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,3 @@
LAB := 2

V := @
PROJECT_DIR := .
BUILD_DIR := $(PROJECT_DIR)/build
KERNEL_IMG := $(BUILD_DIR)/kernel.img
QEMU := qemu-system-aarch64
_QEMU := $(PROJECT_DIR)/scripts/qemu/qemu_wrapper.sh $(QEMU)
QEMU_GDB_PORT := 1234
QEMU_OPTS := -machine raspi3b -nographic -serial mon:stdio -m size=1G -kernel $(KERNEL_IMG)
GDB := gdb-multiarch
CHBUILD := $(PROJECT_DIR)/chbuild

.PHONY: all
all: build

.PHONY: defconfig build clean distclean

defconfig:
$(V)$(CHBUILD) defconfig

build:
$(V)test -f $(PROJECT_DIR)/.config || $(CHBUILD) defconfig
$(V)$(CHBUILD) build

clean:
$(V)$(CHBUILD) clean

distclean:
$(V)$(CHBUILD) distclean

.PHONY: qemu qemu-gdb gdb

qemu:
$(V)$(_QEMU) $(QEMU_OPTS)

qemu-gdb:
$(V)$(_QEMU) -S -gdb tcp::$(QEMU_GDB_PORT) $(QEMU_OPTS)

gdb:
$(V)$(GDB) -x $(PROJECT_DIR)/.gdbinit

.PHONY: grade

grade:
$(V)test -f $(PROJECT_DIR)/.config && cp $(PROJECT_DIR)/.config $(PROJECT_DIR)/.config.bak || true
$(V)$(PROJECT_DIR)/scripts/grade/lab$(LAB).sh
$(V)test -f $(PROJECT_DIR)/.config.bak && mv $(PROJECT_DIR)/.config.bak $(PROJECT_DIR)/.config || true
include $(CURDIR)/../Scripts/lab.mk
105 changes: 0 additions & 105 deletions Lab2/README.md

This file was deleted.

Loading

0 comments on commit 59608cd

Please sign in to comment.