build: migrate to CMake

This commit is contained in:
anna 2021-07-31 19:39:51 +02:00
parent fc63785ca6
commit 643d3ed251
Signed by: fef
GPG key ID: EC22E476DC2D3D84
38 changed files with 318 additions and 279 deletions

7
.gitignore vendored
View file

@ -1,9 +1,4 @@
*.gch
*.o
*.elf
*.bin
*.hex
/.config
build/
# vim
[._]*.s[a-v][a-z]

View file

@ -12,7 +12,9 @@
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-arm",
"includePath": [
"./include"
"./include",
"./build/include",
"./arch/at91sam3x8e/include"
],
"compilerArgs": [
"-mcpu=cortex-m3",

96
CMakeLists.txt Normal file
View file

@ -0,0 +1,96 @@
# See the end of this file for copyright and license terms.
cmake_minimum_required(VERSION 3.14.0)
set(ARCH "at91sam3x8e" CACHE STRING "Target architecture")
include(arch/${ARCH}/toolchain.cmake)
project(ardix VERSION 0.1.0 LANGUAGES C ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_EXTENSIONS ON)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
option(DEBUG "Enable debug features" ON)
endif()
include(options.cmake)
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE ardix_GIT_REVISION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (NOT "${ardix_GIT_REVISION}" STREQUAL "")
set(ardix_VERSION_SUFFIX "-${ardix_GIT_REVISION}")
endif()
endif()
add_library(ardix INTERFACE)
set(ARDIX_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/arch/${ARCH}/include
${CMAKE_CURRENT_BINARY_DIR}/include
)
set(ARDIX_COMPILE_OPTIONS
-nodefaultlibs
-nostartfiles
-fno-builtin
-Wall
-Wno-sign-conversion
-Wstrict-prototypes
-Wredundant-decls
-Wnested-externs
-Wbad-function-cast
-Wshadow
-Wsign-compare
-Wunreachable-code
-Wwrite-strings
-Wconversion
-Waggregate-return
-Winline
-Wcast-align
)
configure_file(
${CMAKE_SOURCE_DIR}/include/config.h.in
${CMAKE_BINARY_DIR}/include/config.h
)
# this must be included before any other subdirectories because
# it updates ARDIX_INCLUDE_DIRS and ARDIX_COMPILE_OPTIONS
add_subdirectory(arch)
add_subdirectory(init)
add_subdirectory(kernel)
add_subdirectory(lib)
target_include_directories(ardix INTERFACE ${ARDIX_INCLUDE_DIRS})
target_compile_options(ardix INTERFACE ${ARDIX_COMPILE_OPTIONS})
# TODO: don't use this hack lmao
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/empty.c "")
add_executable(ardix.elf ${CMAKE_CURRENT_BINARY_DIR}/empty.c)
target_link_libraries(ardix.elf PRIVATE ardix)
add_custom_target(ardix.bin ALL DEPENDS ardix.elf)
add_custom_command(
TARGET ardix.bin
COMMAND ${CMAKE_OBJCOPY}
ARGS -O binary -R .eeprom ardix.elf ardix.bin
)
# This file is part of Ardix.
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.

View file

@ -1,95 +0,0 @@
#
# This file is part of Ardix.
# Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.
#
AVR_CC ?= $(shell which avr-gcc)
AVR_OBJCOPY ?= $(shell which avr-objcopy)
AVR_LD ?= $(shell which avr-ld)
ARM_CC ?= $(shell which arm-none-eabi-gcc)
ARM_LD ?= $(shell which arm-none-eabi-ld)
ARM_OBJCOPY ?= $(shell which arm-none-eabi-objcopy)
EXTRA_CFLAGS ?=
CFLAGS = $(EXTRA_CFLAGS)
CFLAGS += -g -nodefaultlibs -nostartfiles
CFLAGS += -I$(PWD)/include
CFLAGS += -DARCH=$(ARCH)
CFLAGS += -fno-builtin -std=gnu11
EXTRA_LDFLAGS ?=
LDFLAGS = $(EXTRA_LDFLAGS)
ifeq ($(ARCH), at91sam3x8e)
CFLAGS += -mcpu=cortex-m3 -mthumb -mabi=aapcs -march=armv7-m -masm-syntax-unified
CC = $(ARM_CC)
LD = $(ARM_LD)
OBJCOPY = $(ARM_OBJCOPY)
else
CFLAGS += -mmcu=$(ARCH)
LDFLAGS += -mmcu=$(ARCH)
CC = $(AVR_CC)
LD = $(AVR_LD)
OBJCOPY = $(AVR_OBJCOPY)
endif
CFLAGS += -Wall \
-Wno-sign-conversion \
-Wstrict-prototypes \
-Wredundant-decls \
-Wnested-externs \
-Wbad-function-cast \
-Wshadow \
-Wsign-compare \
-Wunreachable-code \
-Wwrite-strings \
-Wconversion \
-Waggregate-return \
-Winline \
-Wcast-align
ifdef DEBUG
CFLAGS += -DDEBUG
endif
ARDIX_ASM_SOURCES =
ARDIX_SOURCES =
include arch/Makefile
include init/Makefile
include lib/Makefile
include kernel/Makefile
ARDIX_OBJS = $(ARDIX_SOURCES:.c=.o)
ARDIX_ASM_OBJS = $(ARDIX_ASM_SOURCES:.S=.o)
%.o: %.S | %.c
$(CC) -c -Os $(CFLAGS) $<
ardix.elf: $(ARDIX_ASM_OBJS) $(ARDIX_OBJS)
$(LD) $(LDFLAGS) -o $@ $^
ardix.hex: ardix.elf
$(OBJCOPY) -O ihex -R .eeprom $^ $@
ardix.bin: ardix.elf
$(OBJCOPY) -O binary -R .eeprom $^ $@
clean:
rm -f ardix.elf ardix.hex ardix.bin $(ARDIX_OBJS) $(ARDIX_ASM_OBJS)
config:
./configure
all: ardix.hex ardix.bin

View file

@ -24,24 +24,21 @@ permitted by applicable law. See the CNPLv6+ for details.
* `arm-gcc`
* `arm-ld`
* `arm-objcopy`
- GNU `make`
- CMake >= 3.14
- A programmer (`bossac` recommended)
- A Unix-like shell (sorry Microsoft lackeys, you can use the Windows Subsystem for Linux for
compiling but probably not for flashing)
### Configuration
Right now, you have to manually define environment variables:
Configuration is done with the standard CMake config system.
The following options are available:
- `ARM_CC`: Full path to `arm-none-eabi-gcc`. If unset, we will search for it in your PATH.
- `ARM_LD`: Full path to `arm-none-eabi-ld`. If unset, we will search for it in your PATH.
- `ARM_OBJCOPY`: Full path to `arm-none-eabi-objcopy`.
If unset, we will search for it in your PATH.
- `ARCH`: Codename for the target architecture. This is mandatory.
- `TOOLCHAIN_PATH`: Path where the compiler toolchain is located.
Defaults to `/usr/bin`.
- `ARCH`: Codename for the target architecture.
The following architectures are currently supported:
* `at91sam3x8e` (Arduino Due)
- `EXTRA_CFLAGS`: Any additional arguments that should be passed to the compiler.
- `EXTRA_LDFLAGS`: Any additional arguments that should be passed to the linker.
### Build
@ -49,17 +46,18 @@ To build the EEPROM image, execute the following command:
```shell
# Replace <target> with one of the target architectures from the list above
ARCH='<target>' make ardix.bin
cmake -DARCH=<arch> -B build -S .
cmake --build build
```
This will create the `ardix.bin` file, which can be passed to `bossac` for flashing.
This will create `ardix.bin` in the `build` directory, which can be passed to `bossac` for flashing.
If you are using an Arduino DUE (at91sam3x8e), make sure to connect the USB cable to the programmer
port (the one closer to the power jack).
```shell
# Replace <tty> with the name of the tty device in /dev
# that is connected to your Arduino
bossac -e -w -v -b -a --port=<tty> ardix.bin
bossac -e -w -v -b -a --port=<tty> build/ardix.bin
```
Please refer to `bossac --help` for more information on how to use it.

View file

@ -1,6 +1,9 @@
#
# See the end of this file for copyright and license terms.
add_subdirectory(${ARCH})
# This file is part of Ardix.
# Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
@ -9,9 +12,3 @@
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.
#
ARDIX_INIT_PWD := $(PWD)/init
ARDIX_SOURCES += \
$(ARDIX_INIT_PWD)/main.c

View file

@ -1,18 +0,0 @@
#
# This file is part of Ardix.
# Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.
#
ifeq ($(ARCH), at91sam3x8e)
include arch/at91sam3x8e/Makefile
else
$(error ARCH is not set to a supported value)
endif

View file

@ -0,0 +1,33 @@
# See the end of this file for copyright and license terms.
add_library(ardix_arch STATIC)
target_link_libraries(ardix INTERFACE ardix_arch)
target_compile_options(ardix_arch PRIVATE ${ARDIX_COMPILE_OPTIONS})
target_include_directories(ardix_arch PRIVATE ${ARDIX_INCLUDE_DIRS})
target_sources(ardix_arch PRIVATE
atom.c
atomic.c
entry.c
interrupt.c
irq_pend_sv.S
irq_svc.S
sched.c
serial.c
startup.c
sys.c
syscall.S
watchdog.c
)
# This file is part of Ardix.
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.

View file

@ -1,37 +0,0 @@
#
# This file is part of Ardix.
# Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.
#
ARDIX_ARCH_PWD = $(PWD)/arch/at91sam3x8e
ARDIX_SOURCES += \
$(ARDIX_ARCH_PWD)/atom.c \
$(ARDIX_ARCH_PWD)/atomic.c \
$(ARDIX_ARCH_PWD)/entry.c \
$(ARDIX_ARCH_PWD)/interrupt.c \
$(ARDIX_ARCH_PWD)/sched.c \
$(ARDIX_ARCH_PWD)/serial.c \
$(ARDIX_ARCH_PWD)/startup.c \
$(ARDIX_ARCH_PWD)/sys.c \
$(ARDIX_ARCH_PWD)/watchdog.c
ARDIX_ASM_SOURCES += \
$(ARDIX_ARCH_PWD)/irq_pend_sv.S \
$(ARDIX_ARCH_PWD)/irq_svc.S \
$(ARDIX_ARCH_PWD)/syscall.S
CFLAGS += \
-DARCH_AT91SAM3X8E
LDFLAGS += \
-T$(ARDIX_ARCH_PWD)/config.ld \
-T$(ARDIX_ARCH_PWD)/flash.ld

View file

@ -1,6 +1,6 @@
/* See the end of this file for copyright, license, and warranty information. */
#include <arch/entry.h>
#include <arch-generic/entry.h>
#include <arch/hardware.h>
#include <ardix/syscall.h>

View file

@ -2,6 +2,7 @@
#pragma once
#include <arch-generic/serial.h>
#include <ardix/dma.h>
#include <ardix/serial.h>
#include <ardix/util.h>

View file

@ -1,7 +1,7 @@
/* See the end of this file for copyright, license, and warranty information. */
#include <arch/at91sam3x8e/hardware.h>
#include <arch/at91sam3x8e/interrupt.h>
#include <arch/hardware.h>
#include <arch/interrupt.h>
void arch_irq_enable(enum irqno irqno)
{

View file

@ -1,8 +1,8 @@
/* See the end of this file for copyright, license, and warranty information. */
#include <arch/sched.h>
#include <arch/at91sam3x8e/hardware.h>
#include <arch/at91sam3x8e/interrupt.h>
#include <arch-generic/sched.h>
#include <arch/hardware.h>
#include <arch/interrupt.h>
#include <ardix/atomic.h>
#include <ardix/sched.h>

View file

@ -8,9 +8,9 @@
#include <ardix/serial.h>
#include <ardix/types.h>
#include <arch/at91sam3x8e/hardware.h>
#include <arch/at91sam3x8e/interrupt.h>
#include <arch/serial.h>
#include <arch/hardware.h>
#include <arch/interrupt.h>
#include <arch-generic/serial.h>
#include <errno.h>
#include <stddef.h>

View file

@ -1,7 +1,8 @@
/* See the end of this file for copyright, license, and warranty information. */
#include <arch/at91sam3x8e/hardware.h>
#include <arch/at91sam3x8e/interrupt.h>
#include <arch/hardware.h>
#include <arch/interrupt.h>
#include <arch-generic/hardware.h>
#include <ardix/malloc.h>

View file

@ -1,7 +1,8 @@
/* See the end of this file for copyright, license, and warranty information. */
#include <arch/at91sam3x8e/interrupt.h>
#include <arch/interrupt.h>
#include <arch/hardware.h>
#include <arch-generic/hardware.h>
#include <stddef.h>
#include <stdint.h>

View file

@ -0,0 +1,38 @@
# See the end of this file for copyright and license terms.
set(TOOLCHAIN_PATH "/usr/bin" CACHE STRING "Directory in which the toolchain binaries are located")
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(CMAKE_AR ${TOOLCHAIN_PATH}/arm-none-eabi-ar${CMAKE_EXECUTABLE_SUFFIX})
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PATH}/arm-none-eabi-gcc${CMAKE_EXECUTABLE_SUFFIX})
set(CMAKE_C_COMPILER ${TOOLCHAIN_PATH}/arm-none-eabi-gcc${CMAKE_EXECUTABLE_SUFFIX})
set(CMAKE_LINKER ${TOOLCHAIN_PATH}/arm-none-eabi-ld${CMAKE_EXECUTABLE_SUFFIX})
set(CMAKE_OBJCOPY ${TOOLCHAIN_PATH}/arm-none-eabi-objcopy${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
set(CMAKE_RANLIB ${TOOLCHAIN_PATH}/arm-none-eabi-ranlib${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
set(CMAKE_SZE ${TOOLCHAIN_PATH}/arm-none-eabi-size${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
set(CMAKE_STRIP ${TOOLCHAIN_PATH}/arm-none-eabi-strip${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
set(CMAKE_C_FLAGS "-Os -nodefaultlibs -nostartfiles -mcpu=cortex-m3 -mthumb -mabi=aapcs -march=armv7-m -masm-syntax-unified")
set(CMAKE_C_FLAGS_DEBUG -g)
set(CMAKE_EXE_LINKER_FLAGS "-T${CMAKE_CURRENT_LIST_DIR}/config.ld -T${CMAKE_CURRENT_LIST_DIR}/flash.ld")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# This file is part of Ardix.
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.

View file

@ -1,7 +1,7 @@
/* See the end of this file for copyright, license, and warranty information. */
#include <arch/at91sam3x8e/hardware.h>
#include <arch/watchdog.h>
#include <arch/hardware.h>
#include <arch-generic/watchdog.h>
int arch_watchdog_init(void)
{

View file

@ -2,8 +2,6 @@
#pragma once
#include <arch/arch_include.h>
/**
* Block the CPU by continuously checking the same expression in an
* infinite loop, until the condition is true. Useful for polling.
@ -30,13 +28,6 @@
*/
void sys_init(void);
#ifndef STACK_SIZE
/** stack size per process in bytes */
#define STACK_SIZE 2048U
#endif
#include ARCH_INCLUDE(hardware.h)
/*
* This file is part of Ardix.
* Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.

View file

@ -4,7 +4,6 @@
#include <arch/hardware.h>
#include <stdbool.h>
#include <toolchain.h>
struct process; /* see include/ardix/sched.h */

View file

@ -2,8 +2,6 @@
#pragma once
#include <arch/arch_include.h>
#include <ardix/dma.h>
#include <ardix/serial.h>
@ -33,7 +31,7 @@ ssize_t arch_serial_write(struct serial_device *dev, const void *buf, size_t len
*/
ssize_t serial_write_dma(struct serial_device *dev, struct dmabuf *buf);
#include ARCH_INCLUDE(serial.h)
#include <arch/serial.h>
/*
* This file is part of Ardix.

View file

@ -2,7 +2,7 @@
#pragma once
#include <arch/syscall.h>
#include <arch-generic/syscall.h>
#include <ardix/types.h>

View file

@ -2,6 +2,7 @@
#pragma once
#include <config.h>
#include <stdint.h>
#if CONFIG_SCHED_MAXPROC < 128

View file

@ -2,11 +2,16 @@
#pragma once
#ifdef ARCH_AT91SAM3X8E
#define ARCH_INCLUDE(file) <arch/at91sam3x8e/file>
#else
#error "Unsupported architecture"
#endif
#define ARDIX_VERSION_MAJOR @ardix_VERSION_MAJOR@
#define ARDIX_VERSION_MINOR @ardix_VERSION_MINOR@
#define ARDIX_VERSION_PATCH @ardix_VERSION_PATCH@
#define ARDIX_VERSION "@ardix_VERSION@@ardix_VERSION_SUFFIX"
#cmakedefine DEBUG
#cmakedefine ARCH
#define CONFIG_STACK_SIZE @CONFIG_STACK_SIZE@
#define CONFIG_SCHED_MAXPROC @CONFIG_SCHED_MAXPROC@
/*
* This file is part of Ardix.

View file

@ -1,6 +1,17 @@
#
# See the end of this file for copyright and license terms.
add_library(ardix_init STATIC)
target_link_libraries(ardix INTERFACE ardix_init)
target_compile_options(ardix_init PRIVATE ${ARDIX_COMPILE_OPTIONS})
target_include_directories(ardix_init PRIVATE ${ARDIX_INCLUDE_DIRS})
target_sources(ardix_init PRIVATE
main.c
)
# This file is part of Ardix.
# Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
@ -9,14 +20,3 @@
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.
#
ARDIX_LIB_PWD := $(PWD)/lib
ARDIX_SOURCES += \
$(ARDIX_LIB_PWD)/ctype.c \
$(ARDIX_LIB_PWD)/errno.c \
$(ARDIX_LIB_PWD)/list.c \
$(ARDIX_LIB_PWD)/malloc.c \
$(ARDIX_LIB_PWD)/string.c \
$(ARDIX_LIB_PWD)/unistd.c

31
kernel/CMakeLists.txt Normal file
View file

@ -0,0 +1,31 @@
# See the end of this file for copyright and license terms.
add_library(ardix_kernel STATIC)
target_link_libraries(ardix INTERFACE ardix_kernel)
target_compile_options(ardix_kernel PRIVATE ${ARDIX_COMPILE_OPTIONS})
target_include_directories(ardix_kernel PRIVATE ${ARDIX_INCLUDE_DIRS})
target_sources(ardix_kernel PRIVATE
device.c
dma.c
io.c
kent.c
printk.c
ringbuf.c
sched.c
serial.c
syscall.c
userspace.c
)
# This file is part of Ardix.
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.

View file

@ -1,28 +0,0 @@
#
# This file is part of Ardix.
# Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.
#
ARDIX_KERNEL_PWD = $(PWD)/kernel
include $(ARDIX_KERNEL_PWD)/fs/Makefile
include $(ARDIX_KERNEL_PWD)/io/Makefile
ARDIX_SOURCES += \
$(ARDIX_KERNEL_PWD)/device.c \
$(ARDIX_KERNEL_PWD)/dma.c \
$(ARDIX_KERNEL_PWD)/kent.c \
$(ARDIX_KERNEL_PWD)/printk.c \
$(ARDIX_KERNEL_PWD)/ringbuf.c \
$(ARDIX_KERNEL_PWD)/sched.c \
$(ARDIX_KERNEL_PWD)/serial.c \
$(ARDIX_KERNEL_PWD)/syscall.c \
$(ARDIX_KERNEL_PWD)/userspace.c

23
kernel/fs/CMakeLists.txt Normal file
View file

@ -0,0 +1,23 @@
# See the end of this file for copyright and license terms.
add_library(ardix_kernel_fs STATIC)
target_link_libraries(ardix_kernel PUBLIC ardix_kernel_fs)
target_compile_options(ardix_kernel_fs PRIVATE ${ARDIX_COMPILE_OPTIONS})
target_include_directories(ardix_kernel_fs PRIVATE ${ARDIX_INCLUDE_DIRS})
target_sources(ardix_kernel_fs PRIVATE
read.c
write.c
)
# This file is part of Ardix.
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.

View file

@ -1,17 +0,0 @@
#
# This file is part of Ardix.
# Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.
#
ARDIX_KERNEL_IO_PWD = $(ARDIX_KERNEL_PWD)/io
ARDIX_SOURCES += \
$(ARDIX_KERNEL_IO_PWD)/io.c

View file

@ -1,7 +1,7 @@
/* See the end of this file for copyright, license, and warranty information. */
#include <arch/sched.h>
#include <arch/watchdog.h>
#include <arch-generic/sched.h>
#include <arch-generic/watchdog.h>
#include <ardix/atomic.h>
#include <ardix/malloc.h>

27
lib/CMakeLists.txt Normal file
View file

@ -0,0 +1,27 @@
# See the end of this file for copyright and license terms.
add_library(ardix_lib STATIC)
target_link_libraries(ardix INTERFACE ardix_lib)
target_compile_options(ardix_lib PRIVATE ${ARDIX_COMPILE_OPTIONS})
target_include_directories(ardix_lib PRIVATE ${ARDIX_INCLUDE_DIRS})
target_sources(ardix_lib PRIVATE
ctype.c
errno.c
list.c
malloc.c
string.c
unistd.c
)
# This file is part of Ardix.
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
# the LICENSE file in the source code root directory or at
# <https://git.pixie.town/thufie/CNPL>.
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.

View file

@ -1,6 +1,10 @@
#
# See the end of this file for copyright and license terms.
set(CONFIG_STACK_SIZE 2048 CACHE STRING "Stack size in bytes")
set(CONFIG_SCHED_MAXPROC 8 CACHE STRING "Maximum number of processes")
# This file is part of Ardix.
# Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
#
# Ardix is non-violent software: you may only use, redistribute,
# and/or modify it under the terms of the CNPLv6+ as found in
@ -9,10 +13,3 @@
#
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
# permitted by applicable law. See the CNPLv6+ for details.
#
ARDIX_KERNEL_FS_PWD = $(ARDIX_KERNEL_PWD)/fs
ARDIX_SOURCES += \
$(ARDIX_KERNEL_FS_PWD)/read.c \
$(ARDIX_KERNEL_FS_PWD)/write.c