aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvetch <vetch97@gmail.com>2020-01-04 19:37:32 +0100
committervetch <vetch97@gmail.com>2020-01-04 19:37:32 +0100
commit615e3302c9dd358bb64cd56d1f3814ad8d5df84d (patch)
tree07b0469807eb3bff7ff7d3f3576858642bc66675
parent885a097da42317f48cead2d91c0e0240066943a8 (diff)
downloadrpi-MMU-example-615e3302c9dd358bb64cd56d1f3814ad8d5df84d.tar.gz
rpi-MMU-example-615e3302c9dd358bb64cd56d1f3814ad8d5df84d.zip
rearranged files, updated makefile
-rw-r--r--TODOs4
-rw-r--r--docs/Latex/main.tex (renamed from kernel.c)0
-rw-r--r--src/PL0/PL0_test.c (renamed from PL0_test.c)0
-rw-r--r--src/PL0/PL0_test.ld (renamed from PL0_test.ld)0
-rw-r--r--src/PL0/PL0_utils.c (renamed from PL0_utils.c)0
-rw-r--r--src/PL0/PL0_utils.h (renamed from PL0_utils.h)0
-rw-r--r--src/atags/atags.c (renamed from atags.c)2
-rw-r--r--src/atags/atags.h (renamed from atags.h)0
-rw-r--r--src/boot/kernel_stage1.S (renamed from kernel_stage1.S)4
-rw-r--r--src/boot/kernel_stage1.ld (renamed from kernel_stage1.ld)0
-rw-r--r--src/boot/kernel_stage2.ld (renamed from kernel_stage2.ld)0
-rw-r--r--src/boot/loader_stage1.S (renamed from loader_stage1.S)2
-rw-r--r--src/boot/loader_stage1_linker.ld (renamed from loader_stage1_linker.ld)0
-rw-r--r--src/boot/loader_stage2.c (renamed from loader_stage2.c)6
-rw-r--r--src/boot/loader_stage2_linker.ld (renamed from loader_stage2_linker.ld)0
-rw-r--r--src/boot/psr.h (renamed from psr.h)0
-rw-r--r--src/boot/setup.c (renamed from setup.c)61
-rw-r--r--src/clock/armclock.h (renamed from armclock.h)0
-rw-r--r--src/clock/bcmclock.h (renamed from bcmclock.h)0
-rw-r--r--src/demo/demo_functionality.c (renamed from demo_functionality.c)4
-rw-r--r--src/demo/demo_functionality.h (renamed from demo_functionality.h)0
-rw-r--r--src/global.h (renamed from global.h)0
-rw-r--r--src/interrupts/interrupt_vector.S (renamed from interrupt_vector.S)0
-rw-r--r--src/interrupts/interrupts.c (renamed from interrupts.c)50
-rw-r--r--src/interrupts/interrupts.h (renamed from interrupts.h)0
-rw-r--r--src/memory/cp_regs.h (renamed from cp_regs.h)0
-rw-r--r--src/memory/makefs.c (renamed from makefs.c)0
-rw-r--r--src/memory/memory.h (renamed from memory.h)0
-rw-r--r--src/memory/paging.c (renamed from paging.c)4
-rw-r--r--src/memory/paging.h (renamed from paging.h)0
-rw-r--r--src/memory/ramfs.c (renamed from ramfs.c)0
-rw-r--r--src/memory/ramfs.h (renamed from ramfs.h)0
-rw-r--r--src/memory/translation_table_descriptors.h (renamed from translation_table_descriptors.h)0
-rw-r--r--src/scheduler.c (renamed from scheduler.c)0
-rw-r--r--src/scheduler.h (renamed from scheduler.h)0
-rw-r--r--src/utils/io.c (renamed from io.c)0
-rw-r--r--src/utils/io.h (renamed from io.h)0
-rw-r--r--src/utils/pipe_image.c (renamed from pipe_image.c)2
-rw-r--r--src/utils/strings.c (renamed from strings.c)0
-rw-r--r--src/utils/strings.h (renamed from strings.h)0
-rw-r--r--src/utils/svc.S (renamed from svc.S)0
-rw-r--r--src/utils/svc_interface.h (renamed from svc_interface.h)0
-rw-r--r--src/utils/uart.c (renamed from uart.c)4
-rw-r--r--src/utils/uart.h (renamed from uart.h)2
44 files changed, 74 insertions, 71 deletions
diff --git a/TODOs b/TODOs
index 23c3458..25efad8 100644
--- a/TODOs
+++ b/TODOs
@@ -1,6 +1,6 @@
* DONE * Remove duplications in Makefile... i.e. use generic recipes for .c -> .o compilations and many other things, that can be shortened this was
-* Implement some basic utilities for us to use (memcpy, printf, etc...)
+* DONE * Implement some basic utilities for us to use (memcpy, printf, etc...)
* ensure .bss section is zeroed properly in stage2 (stage1 and actual kernel do it in common boot.S file; stage2 doesn't use boot.S); Note, that:
- It works as it is right now. If we have no uninitialized static variables in stage2 code, then .bss is probably empty... so this is not really important
@@ -19,7 +19,7 @@
* Fix piping with pipe_image
-* write some procedures for dumping registers and other stuff (for use in debugging)
+* DONE * write some procedures for dumping registers and other stuff (for use in debugging)
* learn some asm and write exception handlers withour gcc's "interrupt" function attribute (this is so that we see what's happening - right now gcc hides some things from us...)
diff --git a/kernel.c b/docs/Latex/main.tex
index e69de29..e69de29 100644
--- a/kernel.c
+++ b/docs/Latex/main.tex
diff --git a/PL0_test.c b/src/PL0/PL0_test.c
index 0bfebc7..0bfebc7 100644
--- a/PL0_test.c
+++ b/src/PL0/PL0_test.c
diff --git a/PL0_test.ld b/src/PL0/PL0_test.ld
index b1d06f4..b1d06f4 100644
--- a/PL0_test.ld
+++ b/src/PL0/PL0_test.ld
diff --git a/PL0_utils.c b/src/PL0/PL0_utils.c
index d83edb9..d83edb9 100644
--- a/PL0_utils.c
+++ b/src/PL0/PL0_utils.c
diff --git a/PL0_utils.h b/src/PL0/PL0_utils.h
index c26a100..c26a100 100644
--- a/PL0_utils.h
+++ b/src/PL0/PL0_utils.h
diff --git a/atags.c b/src/atags/atags.c
index e2e6a24..3f3d1ba 100644
--- a/atags.c
+++ b/src/atags/atags.c
@@ -1,5 +1,5 @@
#include "atags.h"
-#include "io.h"
+#include "utils/io.h"
static inline struct atag_header *next_tag(struct atag_header *tag)
{
diff --git a/atags.h b/src/atags/atags.h
index 4b6879f..4b6879f 100644
--- a/atags.h
+++ b/src/atags/atags.h
diff --git a/kernel_stage1.S b/src/boot/kernel_stage1.S
index dd3e6fd..e770513 100644
--- a/kernel_stage1.S
+++ b/src/boot/kernel_stage1.S
@@ -8,7 +8,7 @@
*
* This file is based on (and almost identical with) loader_stage1.S
*/
-
+
.global _boot
_boot:
// Only let the first core execute
@@ -141,7 +141,7 @@ stage2_blob_copying: // copy stage2 of the kernel to address 0x0
// computing address of stage2_end into r7.
add r7, r3, r5
bx r7
-
+
blob_size:
.word stage2_end - stage2_start
stage1_size:
diff --git a/kernel_stage1.ld b/src/boot/kernel_stage1.ld
index 3130634..3130634 100644
--- a/kernel_stage1.ld
+++ b/src/boot/kernel_stage1.ld
diff --git a/kernel_stage2.ld b/src/boot/kernel_stage2.ld
index 9411ca2..9411ca2 100644
--- a/kernel_stage2.ld
+++ b/src/boot/kernel_stage2.ld
diff --git a/loader_stage1.S b/src/boot/loader_stage1.S
index 9326360..69d78c5 100644
--- a/loader_stage1.S
+++ b/src/boot/loader_stage1.S
@@ -50,6 +50,6 @@ loop:
bx r4
.align 4
-stage2_start:
+stage2_start:
.incbin "loader_stage2.img"
stage2_end:
diff --git a/loader_stage1_linker.ld b/src/boot/loader_stage1_linker.ld
index 711fcbf..711fcbf 100644
--- a/loader_stage1_linker.ld
+++ b/src/boot/loader_stage1_linker.ld
diff --git a/loader_stage2.c b/src/boot/loader_stage2.c
index 15d2003..fc3ae1c 100644
--- a/loader_stage2.c
+++ b/src/boot/loader_stage2.c
@@ -1,8 +1,8 @@
#include <stddef.h>
#include <stdint.h>
-#include <uart.h>
-#include <io.h>
-#include <global.h>
+#include "uart.h"
+#include "io.h"
+#include "global.h"
void *const kernel_load_addr = ((void*) 0x8000);
diff --git a/loader_stage2_linker.ld b/src/boot/loader_stage2_linker.ld
index 33e79e9..33e79e9 100644
--- a/loader_stage2_linker.ld
+++ b/src/boot/loader_stage2_linker.ld
diff --git a/psr.h b/src/boot/psr.h
index f300a7a..f300a7a 100644
--- a/psr.h
+++ b/src/boot/psr.h
diff --git a/setup.c b/src/boot/setup.c
index f1d1263..a96b19e 100644
--- a/setup.c
+++ b/src/boot/setup.c
@@ -1,5 +1,5 @@
#include "uart.h"
-#include "io.h"
+#include "utils/io.h"
#include "demo_functionality.h"
#include "paging.h"
#include "atags.h"
@@ -26,7 +26,9 @@ void setup(uint32_t r0, uint32_t machine_type,
// value 3 introduced by stage1 code means no atags was found
if (r0 == 3)
- puts("No ATAGS was found!");
+ {
+ puts ("No ATAGS was found!");
+ }
else
{
prints("ATAGS copied to 0x");
@@ -40,35 +42,36 @@ void setup(uint32_t r0, uint32_t machine_type,
memory_size = find_memory_size(atags);
}
-
+
if (memory_size)
{
- char *unit;
- uint32_t size_in_unit;
-
- if (memory_size % POWER_OF_2(10))
- {
- unit = "B";
- size_in_unit = memory_size;
- }
- else if (memory_size % POWER_OF_2(20))
- {
- unit = "KB";
- size_in_unit = memory_size / POWER_OF_2(10);
- }
- else if (memory_size % POWER_OF_2(30))
- {
- unit = "MB";
- size_in_unit = memory_size / POWER_OF_2(20);
- }
- else
- {
- unit = "GB";
- size_in_unit = memory_size / POWER_OF_2(30);
- }
-
- prints("memory available: ");
- printdect(size_in_unit); puts(unit);
+ char *unit;
+ uint32_t size_in_unit;
+
+ if (memory_size % POWER_OF_2(10))
+ {
+ unit = "B";
+ size_in_unit = memory_size;
+ }
+ else if (memory_size % POWER_OF_2(20))
+ {
+ unit = "KB";
+ size_in_unit = memory_size / POWER_OF_2(10);
+ }
+ else if (memory_size % POWER_OF_2(30))
+ {
+ unit = "MB";
+ size_in_unit = memory_size / POWER_OF_2(20);
+ }
+ else
+ {
+ unit = "GB";
+ size_in_unit = memory_size / POWER_OF_2(30);
+ }
+
+ prints ("memory available: ");
+ printdect (size_in_unit);
+ puts (unit);
}
else
{
diff --git a/armclock.h b/src/clock/armclock.h
index 32d6517..32d6517 100644
--- a/armclock.h
+++ b/src/clock/armclock.h
diff --git a/bcmclock.h b/src/clock/bcmclock.h
index 7070283..7070283 100644
--- a/bcmclock.h
+++ b/src/clock/bcmclock.h
diff --git a/demo_functionality.c b/src/demo/demo_functionality.c
index 217a858..14e37f2 100644
--- a/demo_functionality.c
+++ b/src/demo/demo_functionality.c
@@ -1,9 +1,9 @@
-#include "io.h"
+#include "utils/io.h"
#include "psr.h"
#include "memory.h"
#include "translation_table_descriptors.h"
#include "ramfs.h"
-#include "strings.h"
+#include "utils/strings.h"
#include "paging.h"
#include "armclock.h"
#include "scheduler.h"
diff --git a/demo_functionality.h b/src/demo/demo_functionality.h
index a338c71..a338c71 100644
--- a/demo_functionality.h
+++ b/src/demo/demo_functionality.h
diff --git a/global.h b/src/global.h
index c461703..c461703 100644
--- a/global.h
+++ b/src/global.h
diff --git a/interrupt_vector.S b/src/interrupts/interrupt_vector.S
index 1ec80f7..1ec80f7 100644
--- a/interrupt_vector.S
+++ b/src/interrupts/interrupt_vector.S
diff --git a/interrupts.c b/src/interrupts/interrupts.c
index 51cab25..121d79c 100644
--- a/interrupts.c
+++ b/src/interrupts/interrupts.c
@@ -108,28 +108,28 @@ void fiq_handler(void)
/* Here is your interrupt function */
-void
-__attribute__((interrupt("IRQ")))
-__attribute__((section(".interrupt_vectors.text")))
-irq_handler2(void) {
- /* You code goes here */
-// uart_puts("GOT INTERRUPT!\r\n");
-
- local_timer_clr_reload_reg_t temp = { .IntClear = 1, .Reload = 1 };
- QA7->TimerClearReload = temp; // Clear interrupt & reload
-}
-
-/* here is your main */
-int enable_timer(void) {
-
- QA7->TimerRouting.Routing = LOCALTIMER_TO_CORE0_IRQ; // Route local timer IRQ to Core0
- QA7->TimerControlStatus.ReloadValue = 100; // Timer period set
- QA7->TimerControlStatus.TimerEnable = 1; // Timer enabled
- QA7->TimerControlStatus.IntEnable = 1; // Timer IRQ enabled
- QA7->TimerClearReload.IntClear = 1; // Clear interrupt
- QA7->TimerClearReload.Reload = 1; // Reload now
- QA7->Core0TimerIntControl.nCNTPNSIRQ_IRQ = 1; // We are in NS EL1 so enable IRQ to core0 that level
- QA7->Core0TimerIntControl.nCNTPNSIRQ_FIQ = 0; // Make sure FIQ is zero
-// uart_puts("Enabled Timer\r\n");
- return(0);
-} \ No newline at end of file
+//void
+//__attribute__((interrupt("IRQ")))
+//__attribute__((section(".interrupt_vectors.text")))
+//irq_handler2(void) {
+// /* You code goes here */
+//// uart_puts("GOT INTERRUPT!\r\n");
+//
+// local_timer_clr_reload_reg_t temp = { .IntClear = 1, .Reload = 1 };
+// QA7->TimerClearReload = temp; // Clear interrupt & reload
+//}
+
+///* here is your main */
+//int enable_timer(void) {
+//
+// QA7->TimerRouting.Routing = LOCALTIMER_TO_CORE0_IRQ; // Route local timer IRQ to Core0
+// QA7->TimerControlStatus.ReloadValue = 100; // Timer period set
+// QA7->TimerControlStatus.TimerEnable = 1; // Timer enabled
+// QA7->TimerControlStatus.IntEnable = 1; // Timer IRQ enabled
+// QA7->TimerClearReload.IntClear = 1; // Clear interrupt
+// QA7->TimerClearReload.Reload = 1; // Reload now
+// QA7->Core0TimerIntControl.nCNTPNSIRQ_IRQ = 1; // We are in NS EL1 so enable IRQ to core0 that level
+// QA7->Core0TimerIntControl.nCNTPNSIRQ_FIQ = 0; // Make sure FIQ is zero
+//// uart_puts("Enabled Timer\r\n");
+// return(0);
+//} \ No newline at end of file
diff --git a/interrupts.h b/src/interrupts/interrupts.h
index e9ade80..e9ade80 100644
--- a/interrupts.h
+++ b/src/interrupts/interrupts.h
diff --git a/cp_regs.h b/src/memory/cp_regs.h
index e5e7063..e5e7063 100644
--- a/cp_regs.h
+++ b/src/memory/cp_regs.h
diff --git a/makefs.c b/src/memory/makefs.c
index 379e8c5..379e8c5 100644
--- a/makefs.c
+++ b/src/memory/makefs.c
diff --git a/memory.h b/src/memory/memory.h
index bdeba52..bdeba52 100644
--- a/memory.h
+++ b/src/memory/memory.h
diff --git a/paging.c b/src/memory/paging.c
index 771c681..c883d4e 100644
--- a/paging.c
+++ b/src/memory/paging.c
@@ -1,8 +1,8 @@
#include "cp_regs.h"
-#include "strings.h"
+#include "utils/strings.h"
#include "memory.h"
#include "translation_table_descriptors.h"
-#include "io.h"
+#include "utils/io.h"
#include "paging.h"
diff --git a/paging.h b/src/memory/paging.h
index 4ac8efa..4ac8efa 100644
--- a/paging.h
+++ b/src/memory/paging.h
diff --git a/ramfs.c b/src/memory/ramfs.c
index cc66b4c..cc66b4c 100644
--- a/ramfs.c
+++ b/src/memory/ramfs.c
diff --git a/ramfs.h b/src/memory/ramfs.h
index cf45736..cf45736 100644
--- a/ramfs.h
+++ b/src/memory/ramfs.h
diff --git a/translation_table_descriptors.h b/src/memory/translation_table_descriptors.h
index 981c3c7..981c3c7 100644
--- a/translation_table_descriptors.h
+++ b/src/memory/translation_table_descriptors.h
diff --git a/scheduler.c b/src/scheduler.c
index 141ba1d..141ba1d 100644
--- a/scheduler.c
+++ b/src/scheduler.c
diff --git a/scheduler.h b/src/scheduler.h
index 8c0f569..8c0f569 100644
--- a/scheduler.h
+++ b/src/scheduler.h
diff --git a/io.c b/src/utils/io.c
index bf9e0e3..bf9e0e3 100644
--- a/io.c
+++ b/src/utils/io.c
diff --git a/io.h b/src/utils/io.h
index dcad76e..dcad76e 100644
--- a/io.h
+++ b/src/utils/io.h
diff --git a/pipe_image.c b/src/utils/pipe_image.c
index 7e27fb9..77c3c07 100644
--- a/pipe_image.c
+++ b/src/utils/pipe_image.c
@@ -3,7 +3,7 @@
#include <endian.h>
#include <stdint.h>
#include <sys/types.h>
-#include "lib/rs232/rs232.h"
+#include "../lib/rs232/rs232.h"
#define ANSI_FG_RED "\033[0;31m"
#define ANSI_FG_DEFAULT "\033[0;39m"
diff --git a/strings.c b/src/utils/strings.c
index 368d7dc..368d7dc 100644
--- a/strings.c
+++ b/src/utils/strings.c
diff --git a/strings.h b/src/utils/strings.h
index aff0533..aff0533 100644
--- a/strings.h
+++ b/src/utils/strings.h
diff --git a/svc.S b/src/utils/svc.S
index 65200d8..65200d8 100644
--- a/svc.S
+++ b/src/utils/svc.S
diff --git a/svc_interface.h b/src/utils/svc_interface.h
index aa478ce..aa478ce 100644
--- a/svc_interface.h
+++ b/src/utils/svc_interface.h
diff --git a/uart.c b/src/utils/uart.c
index 2d4e176..4dd1c2b 100644
--- a/uart.c
+++ b/src/utils/uart.c
@@ -1,7 +1,7 @@
#include <stddef.h>
#include <stdint.h>
-#include <uart.h>
-#include <global.h>
+#include "uart.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/uart.h b/src/utils/uart.h
index 72f7f94..61c6a38 100644
--- a/uart.h
+++ b/src/utils/uart.h
@@ -2,7 +2,7 @@
#define UART_H
#include <stdint.h>
-#include <global.h>
+#include "global.h"
// The offsets for reach register.