Added carriage returns to line feed characters. UART messages print properly now.

This commit is contained in:
Jacob Pease 2024-07-25 13:05:57 -05:00
parent a36e846b02
commit 3975f60299
4 changed files with 18 additions and 15 deletions

View File

@ -49,6 +49,7 @@ int disk_read(BYTE * buf, LBA_t sector, UINT count) {
if (sd_cmd(18, sector & 0xffffffff, crc) != 0x00) {
print_uart("disk_read: CMD18 failed. r = ");
print_uart_byte(r & 0xff);
print_uart("\r\n");
return -1;
}
@ -61,6 +62,7 @@ int disk_read(BYTE * buf, LBA_t sector, UINT count) {
if (r != SD_DATA_TOKEN) {
print_uart("Didn't receive data token first thing. Shoot: ");
print_uart_byte(r & 0xff);
print_uart("\r\n");
return -1;
}
@ -97,7 +99,8 @@ void copyFlash(QWORD address, QWORD * Dst, DWORD numBlocks) {
// Initialize UART for messages
init_uart(20000000, 115200);
print_uart("Booting wally.\r\n");
// Print the wally banner
print_uart(BANNER);

View File

@ -19,15 +19,15 @@ typedef QWORD LBA_t;
#define OPENSBI_ADDRESS 0x80000000 // FW_TEXT_START
#define KERNEL_ADDRESS 0x80200000 // FW_JUMP_ADDR
#define BANNER " █▀█ █▀█ █▀█ █▀▀ █ █\n" \
" █ █ █ █▄▀ █▄▄ ▄▄▄ █ █\n" \
" █▄█ █▄█ █ █ █▄▄ ▀▄▀\n" \
" ____ ____ ____ ___ ___ ____ ___\n" \
" \\ \\ / / / \\ | | | | \\ \\ / /\n" \
" \\ \\ __ / / / \\ | | | | \\ \\/ /\n" \
" \\ \\/ \\/ / / /\\ \\ | | | | \\ /\n" \
" \\ / / ____ \\ | |___ | |___ | |\n" \
" \\___/\\___/ /___/ \\___\\|_______||_______| |___|\n\n"
#define BANNER " █▀█ █▀█ █▀█ █▀▀ █ █\r\n" \
" █ █ █ █▄▀ █▄▄ ▄▄▄ █ █\r\n" \
" █▄█ █▄█ █ █ █▄▄ ▀▄▀\r\n" \
" ____ ____ ____ ___ ___ ____ ___\r\n" \
" \\ \\ / / / \\ | | | | \\ \\ / /\r\n" \
" \\ \\ __ / / / \\ | | | | \\ \\/ /\r\n" \
" \\ \\/ \\/ / / /\\ \\ | | | | \\ /\r\n" \
" \\ / / ____ \\ | |___ | |___ | |\r\n" \
" \\___/\\___/ /___/ \\___\\|_______||_______| |___|\r\n\r\n"
// Export disk_read
int disk_read(BYTE * buf, LBA_t sector, UINT count);

View File

@ -42,21 +42,21 @@ int gpt_load_partitions() {
// Load device tree
ret = disk_read((BYTE *)FDT_ADDRESS, fdt->first_lba, fdt->last_lba - fdt->first_lba + 1);
if (ret < 0) {
print_uart("Failed to load device tree!");
print_uart("Failed to load device tree!\r\n");
return -1;
}
// Load OpenSBI
ret = disk_read((BYTE *)OPENSBI_ADDRESS, opensbi->first_lba, opensbi->last_lba - opensbi->first_lba + 1);
if (ret < 0) {
print_uart("Failed to load OpenSBI!");
print_uart("Failed to load OpenSBI!\r\n");
return -1;
}
// Load Linux
ret = disk_read((BYTE *)KERNEL_ADDRESS, kernel->first_lba,kernel->last_lba - kernel->first_lba + 1);
if (ret < 0) {
print_uart("Failed to load Linux!");
print_uart("Failed to load Linux!\r\n");
return -1;
}

View File

@ -133,7 +133,7 @@ void init_sd(){
uint64_t r;
print_uart("Initializing SD Card in SPI mode");
print_uart("Initializing SD Card in SPI mode.\r\n");
// Reset SD Card command
// Initializes SD card into SPI mode if CS is asserted '0'
@ -155,6 +155,6 @@ void init_sd(){
r = ACMD41();
} while (r == 0x1);
print_uart("SD card is initialized");
print_uart("SD card is initialized.\n\r");
}