aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-10-11 18:59:16 +0200
committerWojtek Kosior <kwojtus@protonmail.com>2019-10-11 18:59:16 +0200
commitbc9ee9f0acc0ec26acda4ffd8f5fdcd04a6375c5 (patch)
treeabb9e1e6632a902fa2aa4acc1be21cfb9421e312
parentb452b0edbc784722c25014a20f554737d64ba758 (diff)
downloadrpi-MMU-example-bc9ee9f0acc0ec26acda4ffd8f5fdcd04a6375c5.tar.gz
rpi-MMU-example-bc9ee9f0acc0ec26acda4ffd8f5fdcd04a6375c5.zip
initialize uart in bootloader's stage2, not stage1
-rw-r--r--Makefile2
-rw-r--r--loader_stage1.c5
-rw-r--r--loader_stage2.c2
3 files changed, 2 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 2fbb0aa..7632283 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ loader_stage2_embeddable.o : loader_stage2.img
loader_stage1.o : loader_stage1.c
arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
-loader.elf : boot.o loader_stage1.o uart.o loader_stage2_embeddable.o
+loader.elf : boot.o loader_stage1.o loader_stage2_embeddable.o
arm-none-eabi-gcc -T loader_stage1.ld -o $@ -ffreestanding -O2 -nostdlib $^ -lgcc
loader.img : loader.elf
diff --git a/loader_stage1.c b/loader_stage1.c
index 9492747..d209c15 100644
--- a/loader_stage1.c
+++ b/loader_stage1.c
@@ -1,6 +1,5 @@
#include <stddef.h>
#include <stdint.h>
-#include <uart.h>
#include <global.h>
char *const stage2_addr = ((void*) 0x4000);
@@ -15,10 +14,6 @@ extern char
void kernel_main(uint32_t r0, uint32_t r1, uint32_t atags)
{
- // uart_init() call to be moved to stage2...
- uart_init();
- uart_puts("Hello, bootloader World!\r\n");
-
// stage2 of the bootloader is a blob embedded in executable;
// copy it over to it's destination place
// TODO implement a memcpy() somewhere and use it instead of loops
diff --git a/loader_stage2.c b/loader_stage2.c
index 98ce571..e221dda 100644
--- a/loader_stage2.c
+++ b/loader_stage2.c
@@ -13,7 +13,7 @@ stage2(uint32_t r0, uint32_t r1, uint32_t atags)
(void) r1;
(void) atags;
- uart_puts("hello stage2!\n\r");
+ uart_init();
// get kernel size via uart (little endian)
uint32_t b0, b1, b2, b3;