commit 8fb61c246547b061114c2ad9a397f81c25748be1
parent 7f131a68cdeb3babc153df74f5950506c15e07a7
Author: Brian Swetland <swetland@frotz.net>
Date: Wed, 4 May 2022 16:57:01 -0700
hw: update linker scripts and glue code to use new hw defs
Diffstat:
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/hw/bios.ld b/hw/bios.ld
@@ -3,7 +3,7 @@ ENTRY(_start)
SECTIONS
{
- . = 0x80000000;
+ . = 0x40000000;
.start : { *(.start) }
.text : { *(.text*) }
.rodata : { *(.rodata*) }
diff --git a/hw/simple.ld b/hw/simple.ld
@@ -3,7 +3,7 @@ ENTRY(_start)
SECTIONS
{
- . = 0x80004000;
+ . = 0x40008000;
.start : { *(.start) }
.text : { *(.text*) }
.rodata : { *(.rodata*) }
diff --git a/hw/src/debug.c b/hw/src/debug.c
@@ -4,15 +4,19 @@
#include <stdio.h>
#include <stdarg.h>
-#define UART_BASE 0x10000000
+#include <hw/platform.h>
+#include <hw/litex.h>
-#define wr8(v,a) (*((volatile unsigned char*) (a)) = v)
+#define uart_rd(a) io_rd32(UART0_BASE + LX_UART_ ## a)
+#define uart_wr(a,v) io_wr32(UART0_BASE + LX_UART_ ## a, v)
void xputc(unsigned c) {
if (c == '\n') {
- wr8('\r', UART_BASE);
+ while (uart_rd(TXFULL)) ;
+ uart_wr(TX, '\r');
}
- wr8(c, UART_BASE);
+ while (uart_rd(TXFULL)) ;
+ uart_wr(TX, c);
}
void xputs(const char* s) {
diff --git a/hw/src/start.S b/hw/src/start.S
@@ -1,9 +1,11 @@
// Copyright 2022, Brian Swetland <swetland@frotz.net>
// Licensed under the Apache License, Version 2.0
+#include <hw/platform.h>
+
.globl _start
_start:
- li sp, 0x81000000
+ li sp, (DRAM_BASE + DRAM_SIZE)
jal start
.globl exit