Close

UART constants

A project log for Sparkfun RED-V bare metal

I wanted to learn RISC-V, not on an emulator, but on a real bare metal RISC-V processor. Even though Sparkfun RED-V is no longer produced.

olaf-baeyensOlaf Baeyens 10/23/2024 at 19:070 Comments

Previous post became too big but these are the constants.s file with the RED-V constants for the UART.

# constants.s

.equ UART_REG_TXFIFO, 0
.equ UART_BASE, 0x10013000

.equ UART0_BASE, 0x10013000

.equ UART_TXDATA, UART0_BASE + 0x00
.equ UART_RXDATA, UART0_BASE + 0x04
.equ UART_TXCTRL, UART0_BASE + 0x08
.equ UART_RXCTRL, UART0_BASE + 0x0C
.equ UART_IE,     UART0_BASE + 0x10
.equ UART_IP,     UART0_BASE + 0x14
.equ UART_DIV,    UART0_BASE + 0x18


.equ GPIO_BASE,     0x10012000

.equ GPIO_IOF_EN,   GPIO_BASE + 0x38
.equ GPIO_IOF_SEL,  GPIO_BASE + 0x3C

.equ IOF_UART0_RX,  (1 << 16)    # GPIO16
.equ IOF_UART0_TX,  (1 << 17)    # GPIO17
.equ IOF_UART0_MASK, IOF_UART0_RX | IOF_UART0_TX

Discussions