aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvetch <vetch97@gmail.com>2020-01-13 12:40:38 +0100
committervetch <vetch97@gmail.com>2020-01-13 12:40:38 +0100
commit1af7591e37d09ddcd734ea07d0e999cf61c8bc5e (patch)
treea56c73c9eddeb148baffc3a31bf50edbbeb31074
parent300cf770698142b636da867b7e04bf2d6ae9baa4 (diff)
downloadrpi-MMU-example-1af7591e37d09ddcd734ea07d0e999cf61c8bc5e.tar.gz
rpi-MMU-example-1af7591e37d09ddcd734ea07d0e999cf61c8bc5e.zip
Great Reorganisation, modify structure and makefile
-rw-r--r--Makefile24
-rw-r--r--src/arm/PL0/PL0_test.c (renamed from src/PL0/PL0_test.c)0
-rw-r--r--src/arm/PL0/PL0_test.ld (renamed from src/PL0/PL0_test.ld)0
-rw-r--r--src/arm/PL0/PL0_utils.c (renamed from src/PL0/PL0_utils.c)2
-rw-r--r--src/arm/PL0/PL0_utils.h (renamed from src/PL0/PL0_utils.h)2
-rw-r--r--src/arm/PL0/svc.S (renamed from src/utils/svc.S)0
-rw-r--r--src/arm/PL1/PL1_common/global.h (renamed from src/global.h)0
-rw-r--r--src/arm/PL1/PL1_common/uart.c (renamed from src/utils/uart.c)2
-rw-r--r--src/arm/PL1/PL1_common/uart.h (renamed from src/utils/uart.h)4
-rw-r--r--src/arm/PL1/kernel/armclock.h (renamed from src/clock/armclock.h)4
-rw-r--r--src/arm/PL1/kernel/atags.c (renamed from src/atags/atags.c)2
-rw-r--r--src/arm/PL1/kernel/atags.h (renamed from src/atags/atags.h)0
-rw-r--r--src/arm/PL1/kernel/bcmclock.h (renamed from src/clock/bcmclock.h)4
-rw-r--r--src/arm/PL1/kernel/cp_regs.h (renamed from src/memory/cp_regs.h)0
-rw-r--r--src/arm/PL1/kernel/demo_functionality.c (renamed from src/demo/demo_functionality.c)18
-rw-r--r--src/arm/PL1/kernel/demo_functionality.h (renamed from src/demo/demo_functionality.h)0
-rw-r--r--src/arm/PL1/kernel/interrupt_vector.S (renamed from src/interrupts/interrupt_vector.S)0
-rw-r--r--src/arm/PL1/kernel/interrupts.c (renamed from src/interrupts/interrupts.c)10
-rw-r--r--src/arm/PL1/kernel/interrupts.h (renamed from src/interrupts/interrupts.h)0
-rw-r--r--src/arm/PL1/kernel/kernel_stage1.S (renamed from src/boot/kernel_stage1.S)0
-rw-r--r--src/arm/PL1/kernel/kernel_stage1.ld (renamed from src/boot/kernel_stage1.ld)0
-rw-r--r--src/arm/PL1/kernel/kernel_stage2.ld (renamed from src/boot/kernel_stage2.ld)0
-rw-r--r--src/arm/PL1/kernel/memory.h (renamed from src/memory/memory.h)0
-rw-r--r--src/arm/PL1/kernel/paging.c (renamed from src/memory/paging.c)4
-rw-r--r--src/arm/PL1/kernel/paging.h (renamed from src/memory/paging.h)0
-rw-r--r--src/arm/PL1/kernel/psr.h (renamed from src/boot/psr.h)0
-rw-r--r--src/arm/PL1/kernel/ramfs.c (renamed from src/memory/ramfs.c)0
-rw-r--r--src/arm/PL1/kernel/ramfs.h (renamed from src/memory/ramfs.h)0
-rw-r--r--src/arm/PL1/kernel/scheduler.c (renamed from src/scheduler.c)10
-rw-r--r--src/arm/PL1/kernel/scheduler.h (renamed from src/scheduler.h)2
-rw-r--r--src/arm/PL1/kernel/setup.c (renamed from src/boot/setup.c)16
-rw-r--r--src/arm/PL1/kernel/translation_table_descriptors.h (renamed from src/memory/translation_table_descriptors.h)0
-rw-r--r--src/arm/PL1/loader/loader_stage1.S (renamed from src/boot/loader_stage1.S)0
-rw-r--r--src/arm/PL1/loader/loader_stage1_linker.ld (renamed from src/boot/loader_stage1_linker.ld)0
-rw-r--r--src/arm/PL1/loader/loader_stage2.c (renamed from src/boot/loader_stage2.c)6
-rw-r--r--src/arm/PL1/loader/loader_stage2_linker.ld (renamed from src/boot/loader_stage2_linker.ld)0
-rw-r--r--src/arm/common/io.c (renamed from src/utils/io.c)0
-rw-r--r--src/arm/common/io.h (renamed from src/utils/io.h)0
-rw-r--r--src/arm/common/strings.c (renamed from src/utils/strings.c)0
-rw-r--r--src/arm/common/strings.h (renamed from src/utils/strings.h)0
-rw-r--r--src/arm/common/svc_interface.h (renamed from src/utils/svc_interface.h)0
-rw-r--r--src/host/makefs.c (renamed from src/memory/makefs.c)0
-rw-r--r--src/host/pipe_image.c (renamed from src/utils/pipe_image.c)2
-rw-r--r--src/lib/rs232/rs232.c (renamed from lib/rs232/rs232.c)0
-rw-r--r--src/lib/rs232/rs232.h (renamed from lib/rs232/rs232.h)0
45 files changed, 56 insertions, 56 deletions
diff --git a/Makefile b/Makefile
index ed090a3..a44eea2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS=-mcpu=cortex-a7 -ffreestanding -std=gnu11 -Wall -Wextra -I.
+CFLAGS=-mcpu=cortex-a7 -ffreestanding -std=gnu11 -Wall -Wextra $(addprefix -I,$(subst :, ,$(VPATH)))
ELFFLAGS=-nostdlib -lgcc
ARM_OBJECTS=kernel.o paging.o demo_functionality.o PL0_test.o uart.o loader_stage1.o loader_stage2.o
@@ -13,7 +13,7 @@ RAMFS_FILES=PL_0_test.img
all : kernel.img
-src = src:$(wildcard src/*)
+src= src:src/arm/common:src/arm/PL1/kernel:src/arm/PL1/PL1_common:src/arm/PL0:src/host:src/arm/PL1/loader:src/lib/rs232
VPATH=$(src)
%.o : %.c
@@ -28,25 +28,25 @@ VPATH=$(src)
%_embeddable.o : %.img
arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm $^ $@
-PL_0_test.elf : src/PL0/PL0_test.ld $(PL_0_TEST_OBJECTS)
+PL_0_test.elf : PL0_test.ld $(PL_0_TEST_OBJECTS)
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) $(PL_0_TEST_OBJECTS)
-kernel_stage1.o : src/boot/kernel_stage1.S kernel_stage2.img
+kernel_stage1.o : kernel_stage1.S kernel_stage2.img
arm-none-eabi-as -mcpu=cortex-a7 $< -o $@
-kernel.elf : src/boot/kernel_stage1.ld kernel_stage1.o
+kernel.elf : kernel_stage1.ld kernel_stage1.o
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) kernel_stage1.o
-kernel_stage2.elf : src/boot/kernel_stage2.ld $(KERNEL_STAGE2_OBJECTS)
+kernel_stage2.elf : kernel_stage2.ld $(KERNEL_STAGE2_OBJECTS)
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) $(KERNEL_STAGE2_OBJECTS)
-loader_stage2.elf : src/boot/loader_stage2_linker.ld $(LOADER_STAGE2_OBJECTS)
+loader_stage2.elf : loader_stage2_linker.ld $(LOADER_STAGE2_OBJECTS)
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) $(LOADER_STAGE2_OBJECTS)
-loader_stage1.o : src/boot/loader_stage1.S loader_stage2.img
+loader_stage1.o : loader_stage1.S loader_stage2.img
arm-none-eabi-as -mcpu=cortex-a7 $< -o $@
-loader.elf : src/boot/loader_stage1_linker.ld loader_stage1.o
+loader.elf : loader_stage1_linker.ld loader_stage1.o
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) loader_stage1.o
qemu-elf : kernel.elf
@@ -62,10 +62,10 @@ run-on-rpi : kernel.img pipe_image
./pipe_image --stdout | sudo socat FILE:/dev/ttyUSB0,b115200,raw -
screen /dev/ttyUSB0 115200,cs8,-parenb,-cstopb,-hupcl
-pipe_image : src/utils/pipe_image.c lib/rs232/rs232.c
- gcc -Wall -std=gnu99 -O3 $^ -o $@
+pipe_image : pipe_image.c rs232.c
+ gcc -Wall -std=gnu99 -Isrc/lib/rs232 -O3 $^ -o $@
-makefs : src/memory/makefs.c
+makefs : makefs.c
gcc -Wall -std=gnu99 -O3 $^ -o $@
ramfs.img : makefs $(RAMFS_FILES)
diff --git a/src/PL0/PL0_test.c b/src/arm/PL0/PL0_test.c
index 0bfebc7..0bfebc7 100644
--- a/src/PL0/PL0_test.c
+++ b/src/arm/PL0/PL0_test.c
diff --git a/src/PL0/PL0_test.ld b/src/arm/PL0/PL0_test.ld
index b1d06f4..b1d06f4 100644
--- a/src/PL0/PL0_test.ld
+++ b/src/arm/PL0/PL0_test.ld
diff --git a/src/PL0/PL0_utils.c b/src/arm/PL0/PL0_utils.c
index b9853fb..d83edb9 100644
--- a/src/PL0/PL0_utils.c
+++ b/src/arm/PL0/PL0_utils.c
@@ -1,7 +1,7 @@
#include <stddef.h>
#include <stdint.h>
-#include "../utils/svc_interface.h"
+#include "svc_interface.h"
#include "PL0_utils.h"
// most generic definition possible
diff --git a/src/PL0/PL0_utils.h b/src/arm/PL0/PL0_utils.h
index e87b1f0..c26a100 100644
--- a/src/PL0/PL0_utils.h
+++ b/src/arm/PL0/PL0_utils.h
@@ -1,6 +1,6 @@
#ifndef PL0_UTILS_H
#define PL0_UTILS_H
-#include "../utils/io.h"
+#include "io.h"
#endif // PL0_UTILS_H
diff --git a/src/utils/svc.S b/src/arm/PL0/svc.S
index 65200d8..65200d8 100644
--- a/src/utils/svc.S
+++ b/src/arm/PL0/svc.S
diff --git a/src/global.h b/src/arm/PL1/PL1_common/global.h
index 4e17b44..4e17b44 100644
--- a/src/global.h
+++ b/src/arm/PL1/PL1_common/global.h
diff --git a/src/utils/uart.c b/src/arm/PL1/PL1_common/uart.c
index a389e41..4dd1c2b 100644
--- a/src/utils/uart.c
+++ b/src/arm/PL1/PL1_common/uart.c
@@ -1,7 +1,7 @@
#include <stddef.h>
#include <stdint.h>
#include "uart.h"
-#include "../global.h"
+#include "global.h"
// Loop <delay> times in a way that the compiler won't optimize away
static inline void delay(int32_t count)
diff --git a/src/utils/uart.h b/src/arm/PL1/PL1_common/uart.h
index 2a8b7d4..96f3634 100644
--- a/src/utils/uart.h
+++ b/src/arm/PL1/PL1_common/uart.h
@@ -2,8 +2,8 @@
#define UART_H
#include <stdint.h>
-#include "../global.h"
-#include "../interrupts/interrupts.h"
+#include "global.h"
+#include "interrupts.h"
// The offsets for reach register.
diff --git a/src/clock/armclock.h b/src/arm/PL1/kernel/armclock.h
index 0d83fc2..0792ad3 100644
--- a/src/clock/armclock.h
+++ b/src/arm/PL1/kernel/armclock.h
@@ -3,8 +3,8 @@
#include <stdint.h>
-#include "../global.h"
-#include "../interrupts/interrupts.h"
+#include "global.h"
+#include "interrupts.h"
#define ARMCLK_LOAD (ARM_BASE + 0x400)
#define ARMCLK_VALUE (ARM_BASE + 0x404)
#define ARMCLK_CONTROL (ARM_BASE + 0x408)
diff --git a/src/atags/atags.c b/src/arm/PL1/kernel/atags.c
index 54740d8..e2e6a24 100644
--- a/src/atags/atags.c
+++ b/src/arm/PL1/kernel/atags.c
@@ -1,5 +1,5 @@
#include "atags.h"
-#include "../utils/io.h"
+#include "io.h"
static inline struct atag_header *next_tag(struct atag_header *tag)
{
diff --git a/src/atags/atags.h b/src/arm/PL1/kernel/atags.h
index 4b6879f..4b6879f 100644
--- a/src/atags/atags.h
+++ b/src/arm/PL1/kernel/atags.h
diff --git a/src/clock/bcmclock.h b/src/arm/PL1/kernel/bcmclock.h
index d08912b..462346d 100644
--- a/src/clock/bcmclock.h
+++ b/src/arm/PL1/kernel/bcmclock.h
@@ -2,8 +2,8 @@
#define BCMCLOCK_H
#include <stdint.h>
-#include "../interrupts/interrupts.h"
-#include "../global.h"
+#include "interrupts.h"
+#include "global.h"
#define ST_BASE (PERIF_BASE + 0x3000) // System Timer
diff --git a/src/memory/cp_regs.h b/src/arm/PL1/kernel/cp_regs.h
index e5e7063..e5e7063 100644
--- a/src/memory/cp_regs.h
+++ b/src/arm/PL1/kernel/cp_regs.h
diff --git a/src/demo/demo_functionality.c b/src/arm/PL1/kernel/demo_functionality.c
index d9c0888..217a858 100644
--- a/src/demo/demo_functionality.c
+++ b/src/arm/PL1/kernel/demo_functionality.c
@@ -1,12 +1,12 @@
-#include "../utils/io.h"
-#include "../boot/psr.h"
-#include "../memory/memory.h"
-#include "../memory/translation_table_descriptors.h"
-#include "../memory/ramfs.h"
-#include "../utils/strings.h"
-#include "../memory/paging.h"
-#include "../clock/armclock.h"
-#include "../scheduler.h"
+#include "io.h"
+#include "psr.h"
+#include "memory.h"
+#include "translation_table_descriptors.h"
+#include "ramfs.h"
+#include "strings.h"
+#include "paging.h"
+#include "armclock.h"
+#include "scheduler.h"
void demo_paging_support(void)
{
diff --git a/src/demo/demo_functionality.h b/src/arm/PL1/kernel/demo_functionality.h
index a338c71..a338c71 100644
--- a/src/demo/demo_functionality.h
+++ b/src/arm/PL1/kernel/demo_functionality.h
diff --git a/src/interrupts/interrupt_vector.S b/src/arm/PL1/kernel/interrupt_vector.S
index 1ec80f7..1ec80f7 100644
--- a/src/interrupts/interrupt_vector.S
+++ b/src/arm/PL1/kernel/interrupt_vector.S
diff --git a/src/interrupts/interrupts.c b/src/arm/PL1/kernel/interrupts.c
index 5c30375..121d79c 100644
--- a/src/interrupts/interrupts.c
+++ b/src/arm/PL1/kernel/interrupts.c
@@ -1,8 +1,8 @@
-#include "../utils/io.h"
-#include "../utils/uart.h"
-#include "../utils/svc_interface.h"
-#include "../clock/armclock.h"
-#include "../scheduler.h"
+#include "io.h"
+#include "uart.h"
+#include "svc_interface.h"
+#include "armclock.h"
+#include "scheduler.h"
/**
@brief The undefined instruction interrupt handler
**/
diff --git a/src/interrupts/interrupts.h b/src/arm/PL1/kernel/interrupts.h
index c2818ee..c2818ee 100644
--- a/src/interrupts/interrupts.h
+++ b/src/arm/PL1/kernel/interrupts.h
diff --git a/src/boot/kernel_stage1.S b/src/arm/PL1/kernel/kernel_stage1.S
index e770513..e770513 100644
--- a/src/boot/kernel_stage1.S
+++ b/src/arm/PL1/kernel/kernel_stage1.S
diff --git a/src/boot/kernel_stage1.ld b/src/arm/PL1/kernel/kernel_stage1.ld
index 3130634..3130634 100644
--- a/src/boot/kernel_stage1.ld
+++ b/src/arm/PL1/kernel/kernel_stage1.ld
diff --git a/src/boot/kernel_stage2.ld b/src/arm/PL1/kernel/kernel_stage2.ld
index 9411ca2..9411ca2 100644
--- a/src/boot/kernel_stage2.ld
+++ b/src/arm/PL1/kernel/kernel_stage2.ld
diff --git a/src/memory/memory.h b/src/arm/PL1/kernel/memory.h
index bdeba52..bdeba52 100644
--- a/src/memory/memory.h
+++ b/src/arm/PL1/kernel/memory.h
diff --git a/src/memory/paging.c b/src/arm/PL1/kernel/paging.c
index aa18087..771c681 100644
--- a/src/memory/paging.c
+++ b/src/arm/PL1/kernel/paging.c
@@ -1,8 +1,8 @@
#include "cp_regs.h"
-#include "../utils/strings.h"
+#include "strings.h"
#include "memory.h"
#include "translation_table_descriptors.h"
-#include "../utils/io.h"
+#include "io.h"
#include "paging.h"
diff --git a/src/memory/paging.h b/src/arm/PL1/kernel/paging.h
index 4ac8efa..4ac8efa 100644
--- a/src/memory/paging.h
+++ b/src/arm/PL1/kernel/paging.h
diff --git a/src/boot/psr.h b/src/arm/PL1/kernel/psr.h
index f300a7a..f300a7a 100644
--- a/src/boot/psr.h
+++ b/src/arm/PL1/kernel/psr.h
diff --git a/src/memory/ramfs.c b/src/arm/PL1/kernel/ramfs.c
index cc66b4c..cc66b4c 100644
--- a/src/memory/ramfs.c
+++ b/src/arm/PL1/kernel/ramfs.c
diff --git a/src/memory/ramfs.h b/src/arm/PL1/kernel/ramfs.h
index cf45736..cf45736 100644
--- a/src/memory/ramfs.h
+++ b/src/arm/PL1/kernel/ramfs.h
diff --git a/src/scheduler.c b/src/arm/PL1/kernel/scheduler.c
index 146eb29..141ba1d 100644
--- a/src/scheduler.c
+++ b/src/arm/PL1/kernel/scheduler.c
@@ -1,9 +1,9 @@
#include "scheduler.h"
-#include "utils/uart.h"
-#include "utils/strings.h"
-#include "clock/armclock.h"
-#include "memory/memory.h"
-#include "utils/io.h"
+#include "uart.h"
+#include "strings.h"
+#include "armclock.h"
+#include "memory.h"
+#include "io.h"
// for now we only have 1 process in "queue"
// later there is going to be an actual queue
diff --git a/src/scheduler.h b/src/arm/PL1/kernel/scheduler.h
index 58f659c..8c0f569 100644
--- a/src/scheduler.h
+++ b/src/arm/PL1/kernel/scheduler.h
@@ -3,7 +3,7 @@
#include <stdint.h>
-#include "boot/psr.h"
+#include "psr.h"
extern PSR_t PL1_PSR;
diff --git a/src/boot/setup.c b/src/arm/PL1/kernel/setup.c
index 2f74e64..bf7c9a1 100644
--- a/src/boot/setup.c
+++ b/src/arm/PL1/kernel/setup.c
@@ -1,12 +1,12 @@
-#include "../utils/uart.h"
-#include "../utils/io.h"
-#include "../demo/demo_functionality.h"
-#include "../memory/paging.h"
-#include "../atags/atags.h"
+#include "uart.h"
+#include "io.h"
+#include "demo_functionality.h"
+#include "paging.h"
+#include "atags.h"
// for POWER_OF_2() macro... perhaps the macro should be moved
-#include "../memory/memory.h"
-#include "../clock/armclock.h"
-#include "../scheduler.h"
+#include "memory.h"
+#include "armclock.h"
+#include "scheduler.h"
void setup(uint32_t r0, uint32_t machine_type,
struct atag_header *atags)
diff --git a/src/memory/translation_table_descriptors.h b/src/arm/PL1/kernel/translation_table_descriptors.h
index 981c3c7..981c3c7 100644
--- a/src/memory/translation_table_descriptors.h
+++ b/src/arm/PL1/kernel/translation_table_descriptors.h
diff --git a/src/boot/loader_stage1.S b/src/arm/PL1/loader/loader_stage1.S
index 69d78c5..69d78c5 100644
--- a/src/boot/loader_stage1.S
+++ b/src/arm/PL1/loader/loader_stage1.S
diff --git a/src/boot/loader_stage1_linker.ld b/src/arm/PL1/loader/loader_stage1_linker.ld
index 711fcbf..711fcbf 100644
--- a/src/boot/loader_stage1_linker.ld
+++ b/src/arm/PL1/loader/loader_stage1_linker.ld
diff --git a/src/boot/loader_stage2.c b/src/arm/PL1/loader/loader_stage2.c
index e08756b..fc3ae1c 100644
--- a/src/boot/loader_stage2.c
+++ b/src/arm/PL1/loader/loader_stage2.c
@@ -1,8 +1,8 @@
#include <stddef.h>
#include <stdint.h>
-#include "../utils/uart.h"
-#include "../utils/io.h"
-#include "../global.h"
+#include "uart.h"
+#include "io.h"
+#include "global.h"
void *const kernel_load_addr = ((void*) 0x8000);
diff --git a/src/boot/loader_stage2_linker.ld b/src/arm/PL1/loader/loader_stage2_linker.ld
index 33e79e9..33e79e9 100644
--- a/src/boot/loader_stage2_linker.ld
+++ b/src/arm/PL1/loader/loader_stage2_linker.ld
diff --git a/src/utils/io.c b/src/arm/common/io.c
index bf9e0e3..bf9e0e3 100644
--- a/src/utils/io.c
+++ b/src/arm/common/io.c
diff --git a/src/utils/io.h b/src/arm/common/io.h
index dcad76e..dcad76e 100644
--- a/src/utils/io.h
+++ b/src/arm/common/io.h
diff --git a/src/utils/strings.c b/src/arm/common/strings.c
index 368d7dc..368d7dc 100644
--- a/src/utils/strings.c
+++ b/src/arm/common/strings.c
diff --git a/src/utils/strings.h b/src/arm/common/strings.h
index aff0533..aff0533 100644
--- a/src/utils/strings.h
+++ b/src/arm/common/strings.h
diff --git a/src/utils/svc_interface.h b/src/arm/common/svc_interface.h
index aa478ce..aa478ce 100644
--- a/src/utils/svc_interface.h
+++ b/src/arm/common/svc_interface.h
diff --git a/src/memory/makefs.c b/src/host/makefs.c
index 379e8c5..379e8c5 100644
--- a/src/memory/makefs.c
+++ b/src/host/makefs.c
diff --git a/src/utils/pipe_image.c b/src/host/pipe_image.c
index b148ac4..105f9a1 100644
--- a/src/utils/pipe_image.c
+++ b/src/host/pipe_image.c
@@ -3,7 +3,7 @@
#include <endian.h>
#include <stdint.h>
#include <sys/types.h>
-#include "../../lib/rs232/rs232.h"
+#include "rs232.h"
#define ANSI_FG_RED "\033[0;31m"
#define ANSI_FG_DEFAULT "\033[0;39m"
diff --git a/lib/rs232/rs232.c b/src/lib/rs232/rs232.c
index 0ae2a59..0ae2a59 100644
--- a/lib/rs232/rs232.c
+++ b/src/lib/rs232/rs232.c
diff --git a/lib/rs232/rs232.h b/src/lib/rs232/rs232.h
index 73a2040..73a2040 100644
--- a/lib/rs232/rs232.h
+++ b/src/lib/rs232/rs232.h