commit - 986015452b0226be1a802ce0d713871752e3de04
commit + 8b3b29b72611d5dc8b7eaf9afa06539c1f244950
blob - 210d8e6b2ecb429b7112ce6106163429f7816805
blob + 99e101c743e11449079a4ce05b4f19a5025f8839
--- Makefile
+++ Makefile
CXX = ${BIN}clang++
CXXFLAGS = -target ${TARGET} -Wall -Wextra -nostdlib -fno-exceptions
CXXFLAGS += -ffreestanding -mgeneral-regs-only
-CXXFLAGS += -Iinclude -DBOARD_${BOARD}
+CXXFLAGS += -Iinclude
CXXFILES = kernel.cc uart_${BOARD}.cc
OBJS = ${ASFILES:.S=.o} ${CXXFILES:.cc=.o}
blob - /dev/null
blob + 68fc2f5a6027ee720e39076492517add5595bdc7 (mode 644)
--- /dev/null
+++ include/uart.h
+// uart.h
+
+#pragma once
+
+#include <stdint.h>
+
+
+namespace Board
+{
+namespace Uart
+{
+
+void
+initialize();
+
+void
+send(uint8_t value);
+
+uint8_t
+recv();
+
+
+} // namespace Uart
+} // namespace Board
blob - d7a104bbfdcf25e3c85f03e5e252d47860b12dd2
blob + e36dbd2dd0cb445249dc0ce911795ab47e383191
--- kernel.cc
+++ kernel.cc
// kernel.cc
-#ifdef BOARD_qemu_virt
-#include "uart_qemu_virt.h"
-#endif // BOARD_
+#include <uart.h>
namespace
{
-/*
+
void
-uart_send_string(Board::Uart &uart, const char *szContent)
+uart_send_string(const char *szContent)
{
const char *szCurrent = szContent;
while (*szCurrent)
- uart.send(*szCurrent);
+ Board::Uart::send(*szCurrent);
}
-*/
+
}
void
kernel_entry_point()
{
- Board::Uart uart;
- // uart_send_string(uart, "Test ECHO mode\r\n");
+ Board::Uart::initialize();
+
+ uart_send_string("Test ECHO mode\r\n");
+
for (; ; )
- ; // uart.send(uart.recv());
+ Board::Uart::send(Board::Uart::recv());
}
blob - 635fccb4acd8223f03c3600f2f9a0252178222c2
blob + 2c204bd74ac532abd15db2c11e2ca91fc87dd4d2
--- linker.ld
+++ linker.ld
{
.text.boot : { *(.text.boot) }
.text : { *(.text) }
- .rodata : { *(.rodata) }
+ .rodata : { *(.rodata*) }
.data : { *(.data) }
. = ALIGN(32);
bss_begin = .;
blob - cd825d51e1f10e3a4fd945438eb19be7fadb115d
blob + 820aadda2dab2213e682641d7a460988c84a4047
--- uart_qemu_virt.cc
+++ uart_qemu_virt.cc
#include <hw.h>
-#include "uart_qemu_virt.h"
+#include <uart.h>
namespace Board
{
+namespace Uart
+{
namespace
}
-Uart::Uart()
+void initialize()
{
}
-// void
-// Uart::send(uint8_t value)
-// {
-// }
+void send(uint8_t /*value*/)
+{
+}
-// uint8_t
-// Uart::recv()
-// {
-// }
+uint8_t recv()
+{
+ return 0;
+}
+} // namespace Uart
} // namespace Board
blob - 3cc750465caea9040243a244ec1f82092b16806e (mode 644)
blob + /dev/null
--- uart_qemu_virt.h
+++ /dev/null
-// uart_qemu_virt.h
-
-#pragma once
-
-#include <stdint.h>
-
-
-namespace Board
-{
-
-
-class Uart
-{
-public:
- Uart();
-
- void send(uint8_t value);
- uint8_t recv();
-};
-
-
-} // namespace Board