commit - f9977d5b1ec596532f80fbeb1a112024f8f6d43f
commit + 621c3fa7e60bd46123980e938e3e9342b6ab4f3b
blob - 24f15702cdb5ba0ca3a48174cca2ef20f7d0f547
blob + 349071597c6fca19429942fb86deeb6f1892a6f6
--- Makefile
+++ Makefile
ASFLAGS = -target ${TARGET}
ASFILES = boot.o
-CXXFLAGS = -target ${TARGET} -Wall -Wextra -nostdlib -fno-exceptions
+CXXFLAGS = -target ${TARGET}
+CXXFLAGS +=-Wall -Wextra -Werror
+CXXFLAGS +=-nostdlib -fno-exceptions -std=c++11
CXXFLAGS +=-ffreestanding -mgeneral-regs-only
-CXXFLAGS +=-Iinclude -std=c++11
+CXXFLAGS +=-Iinclude
CXXFILES = kernel.cc uart_${BOARD}.cc
OBJS = ${ASFILES:.S=.o} ${CXXFILES:.cc=.o}
blob - 66a22a047beaacf08b00ea31812c9be3b8d2076a
blob + 60bb64a260ae9b8f384a0d42559ad7c8bbd90448
--- kernel.cc
+++ kernel.cc
uart_send_string(const char *szContent)
{
const char *szCurrent = szContent;
- while (*szCurrent) {
+ while (*szCurrent)
+ {
Board::Uart::send(*szCurrent);
++szCurrent;
}
}
+void
+uart_echo_test_mode()
+{
+ uart_send_string("UART echo test mode\r\n> ");
+ for (; ; )
+ {
+ Board::Uart::send(Board::Uart::recv());
+ }
+}
+
+
} // anonymous namespace
Board::Uart::initialize();
uart_send_string("Squat entry point\r\n");
- for (; ; )
- ;
+ uart_echo_test_mode();
}
blob - 74896d01b6a78d7f2a5bd6bb89926a2e82b31c27
blob + 7663a12da52749a2f572dedb6a5cbed5c08869f6
--- uart_virt.cc
+++ uart_virt.cc
Pl011::ControlRegister ControlRegister;
ControlRegister.m_u.m_Bits.m_UartEnable = 1;
ControlRegister.m_u.m_Bits.m_TransmitEnable = 1;
+ ControlRegister.m_u.m_Bits.m_ReceiveEnable = 1;
Hw::write32(UART_BASE + Pl011::CONTROL_REGISTER, ControlRegister.m_u.m_nValue);
}
uint8_t recv()
{
- return 0;
+ for (; ; )
+ {
+ Pl011::FlagRegister FlagRegister{Hw::read32(UART_BASE + Pl011::FLAG_REGISTER)};
+ if (!FlagRegister.m_u.m_Bits.m_ReceiveFifoEmpty)
+ break;
+ }
+ return Hw::read32(UART_BASE + Pl011::DATA_REGISTER) & 0xff;
}