diff options
author | Wojtek Kosior <kwojtus@protonmail.com> | 2019-11-20 08:29:33 +0100 |
---|---|---|
committer | Wojtek Kosior <kwojtus@protonmail.com> | 2019-11-20 08:29:33 +0100 |
commit | 6eba61fede40efda3651bceb559f8d1fa372fa73 (patch) | |
tree | b90f28b2c0c58e5a62cfde0008769292520ff600 | |
parent | 42fa390951fa7a35cc60d935ae3140d735ec61e1 (diff) | |
parent | d302f79c13df6ecaa63c477c6a811fa94996b7cb (diff) | |
download | rpi-MMU-example-6eba61fede40efda3651bceb559f8d1fa372fa73.tar.gz rpi-MMU-example-6eba61fede40efda3651bceb559f8d1fa372fa73.zip |
merge alice to bob
-rw-r--r-- | Makefile | 8 | ||||
m--------- | RS-232 | 0 | ||||
-rw-r--r-- | interrupts.c | 15 | ||||
-rw-r--r-- | kernel.c | 2 | ||||
-rw-r--r-- | pipe_image.c | 24 |
5 files changed, 38 insertions, 11 deletions
@@ -1,5 +1,4 @@ CFLAGS=-mcpu=cortex-a7 -ffreestanding -std=gnu11 -Wall -Wextra -I. - ELFFLAGS=-ffreestanding -O2 -nostdlib -lgcc -I. ARM_OBJECTS=kernel.o paging.o demo_functionality.o PL0_test.o uart.o loader_stage1.o loader_stage2.o @@ -41,10 +40,9 @@ qemu-elf : kernel.elf qemu-bin : loader.elf kernel.img pipe_image ./pipe_image --stdout | qemu-system-arm -m 256 -M raspi2 -serial stdio -kernel $< -run-on-rpi : kernel.img pipe_image - ./pipe_image --stdout | socat FILE:/dev/ttyUSB0,b115200,raw - - sleep 1 - screen /dev/ttyUSB0 115200,cs8,-parenb,-cstopb,-hupcl +run-on-rpi : kernel7.img pipe_image + ./pipe_image --stdout | sudo socat FILE:/dev/ttyUSB0,b115200,raw - +# screen /dev/ttyUSB0 115200,cs8,-parenb,-cstopb,-hupcl pipe_image : pipe_image.c lib/rs232/rs232.c gcc -Wall -std=gnu99 -O3 $^ -o $@ diff --git a/RS-232 b/RS-232 deleted file mode 160000 -Subproject 9016e7a369f9eab0525aaf9d7653a50de05011e diff --git a/interrupts.c b/interrupts.c new file mode 100644 index 0000000..3dc3d6f --- /dev/null +++ b/interrupts.c @@ -0,0 +1,15 @@ +#include "uart.h" +/** + @brief The undefined instruction interrupt handler + + If an undefined instruction is encountered, the CPU will start + executing this function. Just trap here as a debug solution. +*/ +void __attribute__((interrupt("UNDEF"))) undefined_instruction_vector(void) +{ + uart_puts("Undefined instruction occured"); + while( 1 ) + { + /* Do Nothing! */ + } +}
\ No newline at end of file @@ -14,7 +14,7 @@ void kernel_main(uint32_t r0, uint32_t r1, uint32_t atags) // When we attach screen session after loading kernel with socat // we miss kernel's greeting... So we'll make the kernel wait for // one char we're going to send from within screen - uart_getc(); + // uart_getc(); uart_puts("Hello, kernel World!\r\n"); diff --git a/pipe_image.c b/pipe_image.c index 987ae99..7e27fb9 100644 --- a/pipe_image.c +++ b/pipe_image.c @@ -15,7 +15,7 @@ int main(int argc, const char **argv) { const char *image_file_name = "kernel.img"; _Bool stdout_instead_of_uart = 0; - + if (argc > 1) if (!strcmp(argv[1], "--stdout")) { @@ -50,7 +50,7 @@ int main(int argc, const char **argv) { const int comport=16; if (!stdout_instead_of_uart) - if (RS232_OpenComport(comport, 115200, "8N1", 0) == 1) + if (RS232_OpenComport(comport, 115200, "8N1", 1) == 1) err(-1, "Error opening comport"); uint32_t image_size_le = htole32(image_size); @@ -63,7 +63,7 @@ int main(int argc, const char **argv) { else { if (RS232_SendBuf(comport, (unsigned char*) &image_size_le, 4) - == 1) + == -1) err(-1, "error writing number to serial"); } @@ -84,13 +84,27 @@ int main(int argc, const char **argv) { } else { - if (RS232_SendBuf(comport, buf, bytes_read) == 1) + if (RS232_SendBuf(comport, buf, bytes_read) == -1) err(-1, "error writing to serial"); } bytes_left -= bytes_read; } - +/* + while(1){ + int bytes_read=read(0,buf,sizeof(buf)); + if (stdout_instead_of_uart) + { + if (fwrite((unsigned char*) buf, bytes_read, 1, stdout) != 1) + err(-1, "error writing to stdout"); + } + else + { + if (RS232_SendBuf(comport, buf, bytes_read) == 1) + err(-1, "error writing to serial"); + } + } + */ if (!stdout_instead_of_uart) RS232_CloseComport(comport); |