From d9999d3ed3e8e6f3f1228ad3b7f181b095591b61 Mon Sep 17 00:00:00 2001 From: Greg Bowne Date: Tue, 24 Oct 2023 14:21:14 -0700 Subject: [PATCH] Fixing up CMakeLists.txt --- .clang_complete | 3 ++ .clangd | 2 +- .vscode/settings.json | 1 + CMakeLists.txt | 31 +++++++++++++------ Makefile | 2 +- make.config | 2 ++ src/drivers/audio/audio.c | 64 +++++++++++++++++++-------------------- 7 files changed, 61 insertions(+), 44 deletions(-) diff --git a/.clang_complete b/.clang_complete index cb4710e..fe5496d 100644 --- a/.clang_complete +++ b/.clang_complete @@ -1,4 +1,7 @@ -std=c17 -Wall +-Wextra +-Wpedantic +-Werror -O2 -I/path/to/include diff --git a/.clangd b/.clangd index 51e49c4..8499ec7 100644 --- a/.clangd +++ b/.clangd @@ -1,6 +1,6 @@ CompileFlags: Add: ["-std=c17"] - Remove: ["-Werror"] + Remove: ["-Wall -Wpedantic -Wextra -Werror"] Index: Background: true OnDidChange: true diff --git a/.vscode/settings.json b/.vscode/settings.json index 7ff079b..98bf01f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,6 +30,7 @@ "C_Cpp_Runner.warnings": [ "-Wall", "-Wextra", + "-Wextra", "-Wpedantic" ], "C_Cpp_Runner.enableWarnings": true, diff --git a/CMakeLists.txt b/CMakeLists.txt index ba263ac..dc8ac8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ project(ClassicOS VERSION 0.0.1 DESCRIPTION "An x86 Operating System for your pleasure and enjoyment" HOMEPAGE_URL "https://github.com/gbowne1/ClassicOS" - LANGUAGES C ASM_NASM) + LANGUAGES C) # Source files set(BOOT_SOURCE_FILES @@ -66,28 +66,39 @@ add_executable(ClassicOS set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +if(WIN32) + # Define build steps for Windows +elseif(LINUX) + # Define build steps for other platforms +elseif(UNIX) + +endif() + # Enable testing enable_testing() target_link_libraries(ClassicOS PRIVATE) -set(CMAKE_C_COMPILER gcc) -set(CMAKE_LINKER ld) +set(CMAKE_C_COMPILER /usr/bin/gcc) +set(CMAKE_LINKER /usr/bin/ld) set(CMAKE_EXE_LINKER_FLAGS "-g -s") +# set(CMAKE_LINK_FLAGS) usage is deprecated, use CMAKE_EXE_LINKER_FLAGS). set(CMAKE_LINK_FLAGS "${CMAKE_LINK_FLAGS} -e kernel_main") -set(CMAKE_CXX_FLAGS "-g -Wall") -set(CMAKE_C_FLAGS "-g -Wall -m32") -set(CMAKE_C_FLAGS_DEBUG "-g") +set(CMAKE_CXX_FLAGS "-g Wall ") +set(CMAKE_C_FLAGS "-g -Wall") +set(CMAKE_C_FLAGS_DEBUG "-g -Wall") set(CMAKE_BUILD_TYPE Debug) -set(CMAKE_GDB_COMMAND gdb) +set(CMAKE_GDB_COMMAND "/usr/bin/gdb") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") set(CMAKE_CXX_COMPILER g++) -set(CMAKE_ASM_COMPILER nasm) -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} --32") +set(CMAKE_ASM_COMPILER /usr/bin/nasm) +set(CMAKE_ASM_NASM_FLAGS "-f elf32 -g -F dwarf") +set(CMAKE_ASM_FLAGS "-m32 -g") set(CMAKE_ASM_NASM_OBJECT_FORMAT bin) +set(CMAKE_HOST_SYSTEM_PROCESSOR x86_64) set(CMAKE_SYSTEM_PROCESSOR i386) set(CMAKE_SYSTEM_NAME None) -set(CMAKE_ASM_NASM_COMPILER nasm) +set(CMAKE_ASM_NASM_COMPILER user/bin/nasm) set(CMAKE_C_STANDARD 17) set(CMAKE_CXX_STANDARD 17) set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) diff --git a/Makefile b/Makefile index eb11340..b72a05b 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CXX = g++ AS = nasm LD = ld CFLAGS = -g -Wall -CXXFLAGS = -g -Wall +CXXFLAGS = -g -Wall -Werror -Wpedantic -Wextra LDFLAGS = -T linker.ld # Source files diff --git a/make.config b/make.config index e69de29..1e680d4 100644 --- a/make.config +++ b/make.config @@ -0,0 +1,2 @@ +CFLAGS=-Os -march=i386 -mtune=i386 +LDFLAGS=-s \ No newline at end of file diff --git a/src/drivers/audio/audio.c b/src/drivers/audio/audio.c index 4c161d0..e12c523 100644 --- a/src/drivers/audio/audio.c +++ b/src/drivers/audio/audio.c @@ -1,32 +1,32 @@ -#include "audio.h" - -#include -#include -#include - -// Audio controller base address -#define AUDIO_BASE_ADDRESS 0x0000 - -// Audio controller data port -#define AUDIO_DATA_PORT 0x00 - -// Audio controller command port -#define AUDIO_COMMAND_PORT 0x01 - -// Initialize the audio driver -void audio_init() -{ - // Add any necessary initialization code here -} - -// Play audio from a buffer -void audio_play(const uint8_t *buffer, size_t size) -{ - // Add any necessary code to play audio from the buffer here -} - -// Stop audio playback -void audio_stop() -{ - // Add any necessary code to stop audio playback here -} \ No newline at end of file +#include "audio.h" + +#include +#include +#include + +// Audio controller base address +#define AUDIO_BASE_ADDRESS 0x0000 + +// Audio controller data port +#define AUDIO_DATA_PORT 0x00 + +// Audio controller command port +#define AUDIO_COMMAND_PORT 0x01 + +// Initialize the audio driver +void audio_init() +{ + // Add any necessary initialization code here +} + +// Play audio from a buffer +void audio_play(const uint8_t *buffer, size_t size) +{ + // Add any necessary code to play audio from the buffer here +} + +// Stop audio playback +void audio_stop() +{ + // Add any necessary code to stop audio playback here +}