adds RISCV-VP platform

This commit is contained in:
2025-07-30 06:35:53 +02:00
parent 0843d92878
commit 20161cc1af
7 changed files with 413 additions and 0 deletions

48
env/riscv_vp/platform.h vendored Normal file
View File

@@ -0,0 +1,48 @@
// See LICENSE for license details.
#ifndef _ISS_PLATFORM_H
#define _ISS_PLATFORM_H
#if __riscv_xlen == 32
#define MCAUSE_INT 0x80000000UL
#define MCAUSE_CAUSE 0x000003FFUL
#else
#define MCAUSE_INT 0x8000000000000000UL
#define MCAUSE_CAUSE 0x00000000000003FFUL
#endif
#define APB_BUS
#include "minres/devices/aclint.h"
#include "minres/devices/dma.h"
#include "minres/devices/gen/sysctrl.h"
#include "minres/devices/gpio.h"
#include "minres/devices/i2s.h"
#include "minres/devices/qspi.h"
#include "minres/devices/timer.h"
#include "minres/devices/uart.h"
#define PERIPH(TYPE, ADDR) ((volatile TYPE*)(ADDR))
// values from memory_map.ld
#define XIP_START_LOC 0x30000000
#define RAM_START_LOC 0x00000000
#define APB_BASE 0x10000000
#define gpio PERIPH(gpio_t, APB_BASE + 0x0000)
#define uart PERIPH(uart_t, APB_BASE + 0x01000)
#define timer PERIPH(timercounter_t, APB_BASE + 0x20000)
#define aclint PERIPH(aclint_t, APB_BASE + 0x30000)
#define sysctrl PERIPH(sysctrl_t, APB_BASE + 0x40000)
#define qspi PERIPH(qspi_t, APB_BASE + 0x50000)
#define i2s PERIPH(i2s_t, APB_BASE + 0x90000)
#define dma PERIPH(dma_t, APB_BASE + 0xB0000)
// Misc
#include <stdint.h>
void init_pll(void);
unsigned long get_cpu_freq(void);
unsigned long get_timer_freq(void);
#endif /* _ISS_PLATFORM_H */