From f20eb4d5413efc663c6882ad5ea7877b140b5dd1 Mon Sep 17 00:00:00 2001 From: Dolu1990 Date: Wed, 18 Mar 2020 12:02:27 +0100 Subject: [PATCH] Merge pull request #115 from antmicro/fix_emulator emulator: Use external hw/common.h from LiteX --- src/main/c/emulator/makefile | 7 ++++--- src/main/c/emulator/src/hal.c | 32 -------------------------------- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/src/main/c/emulator/makefile b/src/main/c/emulator/makefile index 7534d08..6f3c8fc 100755 --- a/src/main/c/emulator/makefile +++ b/src/main/c/emulator/makefile @@ -18,10 +18,11 @@ sim: all qemu: CFLAGS += -DQEMU qemu: all -litex: CFLAGS += -DLITEX -I${LITEX_BASE}/software/include -litex: | check_litex_base all -check_litex_base: +litex: CFLAGS += -DLITEX -I${LITEX_GENERATED} -I${LITEX_BASE}/litex/soc/software/include +litex: | check_litex all +check_litex: @[ "${LITEX_BASE}" ] || ( echo ">> LITEX_BASE is not set"; exit 1 ) + @[ "${LITEX_GENERATED}" ] || ( echo ">> LITEX_GENERATED is not set"; exit 1 ) include ${STANDALONE}/common/riscv64-unknown-elf.mk include ${STANDALONE}/common/standalone.mk diff --git a/src/main/c/emulator/src/hal.c b/src/main/c/emulator/src/hal.c index 5a151bb..aa6745b 100644 --- a/src/main/c/emulator/src/hal.c +++ b/src/main/c/emulator/src/hal.c @@ -146,38 +146,6 @@ void halInit(){ #ifdef LITEX -// this is copied from LiteX -#define CSR_ACCESSORS_DEFINED -static inline void csr_writeb(uint8_t value, unsigned long addr) -{ - *((volatile uint8_t *)addr) = value; -} - -static inline uint8_t csr_readb(unsigned long addr) -{ - return *(volatile uint8_t *)addr; -} - -static inline void csr_writew(uint16_t value, unsigned long addr) -{ - *((volatile uint16_t *)addr) = value; -} - -static inline uint16_t csr_readw(unsigned long addr) -{ - return *(volatile uint16_t *)addr; -} - -static inline void csr_writel(uint32_t value, unsigned long addr) -{ - *((volatile uint32_t *)addr) = value; -} - -static inline uint32_t csr_readl(unsigned long addr) -{ - return *(volatile uint32_t *)addr; -} - // this is a file generated by LiteX #include