From a0a6b10e0b5f04a729899c5b2b486a37c4f14f16 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Sun, 17 Feb 2019 20:20:16 -0800 Subject: [PATCH] [arch][riscv32] rename the qemu target sifive-e The initial port is really a Sifive E platform. Call it what it is and make space for bringing up the Sifive U and virt qemu target. --- .travis.yml | 4 +-- arch/riscv/start.S | 33 +------------------ platform/sifive/rules.mk | 4 +++ project/qemu-riscv32-test.mk | 2 -- project/sifive-e-test.mk | 2 ++ project/target/qemu-riscv32.mk | 3 -- project/target/sifive-e.mk | 3 ++ scripts/do-qemuriscv32 | 4 +-- .../qemu-riscv/include/target/debugconfig.h | 26 --------------- .../qemu-riscv/include/target/riscv-config.h | 26 --------------- target/{qemu-riscv => sifive-e}/rules.mk | 2 +- 11 files changed, 15 insertions(+), 94 deletions(-) delete mode 100644 project/qemu-riscv32-test.mk create mode 100644 project/sifive-e-test.mk delete mode 100644 project/target/qemu-riscv32.mk create mode 100644 project/target/sifive-e.mk delete mode 100644 target/qemu-riscv/include/target/debugconfig.h delete mode 100644 target/qemu-riscv/include/target/riscv-config.h rename target/{qemu-riscv => sifive-e}/rules.mk (88%) diff --git a/.travis.yml b/.travis.yml index 0d6d01cc..b9f8ff14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ env: - PROJECT=nucleo-f072rb TOOLCHAIN=arm-eabi-7.3.0-Linux-x86_64 - PROJECT=qemu-microblaze-test TOOLCHAIN=microblaze-elf-7.3.0-Linux-x86_64 - PROJECT=qemu-mips-test TOOLCHAIN=mips-elf-7.3.0-Linux-x86_64 - - PROJECT=qemu-riscv32-test TOOLCHAIN=riscv32-elf-7.3.0-Linux-x86_64 + - PROJECT=sifive-e-test TOOLCHAIN=riscv32-elf-7.3.0-Linux-x86_64 - PROJECT=pc-x86-test TOOLCHAIN=i386-elf-7.3.0-Linux-x86_64 - PROJECT=pc-x86-64-test TOOLCHAIN=x86_64-elf-7.3.0-Linux-x86_64 @@ -31,7 +31,7 @@ env: - PROJECT=pc-x86-64-test TOOLCHAIN=x86_64-elf-7.3.0-Linux-x86_64 DEBUG=0 - PROJECT=qemu-microblaze-test TOOLCHAIN=microblaze-elf-7.3.0-Linux-x86_64 DEBUG=0 - PROJECT=qemu-mips-test TOOLCHAIN=mips-elf-7.3.0-Linux-x86_64 DEBUG=0 - - PROJECT=qemu-riscv32-test TOOLCHAIN=riscv32-elf-7.3.0-Linux-x86_64 DEBUG=0 + - PROJECT=sifive-e-test TOOLCHAIN=riscv32-elf-7.3.0-Linux-x86_64 DEBUG=0 # run in a container sudo: false diff --git a/arch/riscv/start.S b/arch/riscv/start.S index 4ce8f668..1af4ff13 100644 --- a/arch/riscv/start.S +++ b/arch/riscv/start.S @@ -80,40 +80,9 @@ FUNCTION(_start) # call main jal lk_main + # should never return here j . -#if 0 - # set the default stack - addik r1, r0, default_stack_top - - # set up small data pointers - addik r2, r0, _SDATA2_START__ - addik r13, r0, _SDATA_START__ - - # set the processor mode to default - mts rmsr, r0 - - # zero out bss sections - addik r5, r0, __bss_start - addik r6, r0, 0 - rsubik r7, r5, __bss_end - brlid r15, memset - nop - - # arguments to main - addik r5, r0, 1 - addik r6, r0, 2 - addik r7, r0, 3 - brlid r15, lk_main - addik r8, r0, 4 - - # shouldn't be here - bri . - -FUNCTION(unhandled_exception) - bri . -#endif - .bss .align 4 LOCAL_DATA(default_stack) diff --git a/platform/sifive/rules.mk b/platform/sifive/rules.mk index 6c73d572..3e3ef512 100644 --- a/platform/sifive/rules.mk +++ b/platform/sifive/rules.mk @@ -4,6 +4,7 @@ MODULE := $(LOCAL_DIR) ARCH := riscv SUBARCH ?= 32 +VARIANT ?= sifive_e MODULE_DEPS += lib/cbuf @@ -15,6 +16,9 @@ ROMBASE ?= 0x20400000 # if running from rom, start here MEMBASE ?= 0x80000000 MEMSIZE ?= 0x00100000 # default to 1MB +# sifive_e or _u? +GLOBAL_DEFINES += PLATFORM_${VARIANT}=1 + # set some global defines based on capability GLOBAL_DEFINES += PLATFORM_HAS_DYNAMIC_TIMER=1 GLOBAL_DEFINES += ARCH_RISCV_CLINT_BASE=0x02000000 diff --git a/project/qemu-riscv32-test.mk b/project/qemu-riscv32-test.mk deleted file mode 100644 index a7620d75..00000000 --- a/project/qemu-riscv32-test.mk +++ /dev/null @@ -1,2 +0,0 @@ -include project/target/qemu-riscv32.mk -include project/virtual/test.mk diff --git a/project/sifive-e-test.mk b/project/sifive-e-test.mk new file mode 100644 index 00000000..c3eae31a --- /dev/null +++ b/project/sifive-e-test.mk @@ -0,0 +1,2 @@ +include project/target/sifive-e.mk +include project/virtual/test.mk diff --git a/project/target/qemu-riscv32.mk b/project/target/qemu-riscv32.mk deleted file mode 100644 index 18fd15cf..00000000 --- a/project/target/qemu-riscv32.mk +++ /dev/null @@ -1,3 +0,0 @@ -TARGET := qemu-riscv -SUBARCH := 32 - diff --git a/project/target/sifive-e.mk b/project/target/sifive-e.mk new file mode 100644 index 00000000..9eedd1b5 --- /dev/null +++ b/project/target/sifive-e.mk @@ -0,0 +1,3 @@ +TARGET := sifive-e +SUBARCH := 32 + diff --git a/scripts/do-qemuriscv32 b/scripts/do-qemuriscv32 index 366adb0e..bc2f0a17 100755 --- a/scripts/do-qemuriscv32 +++ b/scripts/do-qemuriscv32 @@ -1,4 +1,4 @@ #!/bin/sh -make qemu-riscv32-test -j4 && -qemu-system-riscv32 -machine sifive_e -kernel build-qemu-riscv32-test/lk.elf -nographic $@ +make sifive-e-test -j4 && +qemu-system-riscv32 -machine sifive_e -kernel build-sifive-e-test/lk.elf -nographic $@ diff --git a/target/qemu-riscv/include/target/debugconfig.h b/target/qemu-riscv/include/target/debugconfig.h deleted file mode 100644 index 554bdc11..00000000 --- a/target/qemu-riscv/include/target/debugconfig.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2015 Travis Geiselbrecht - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#pragma once - -#define DEBUG_UART 0 - diff --git a/target/qemu-riscv/include/target/riscv-config.h b/target/qemu-riscv/include/target/riscv-config.h deleted file mode 100644 index da276bc1..00000000 --- a/target/qemu-riscv/include/target/riscv-config.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2015 Travis Geiselbrecht - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#pragma once - -#define TIMER_RATE (62*1000000) - diff --git a/target/qemu-riscv/rules.mk b/target/sifive-e/rules.mk similarity index 88% rename from target/qemu-riscv/rules.mk rename to target/sifive-e/rules.mk index 192199a9..92ea518a 100644 --- a/target/qemu-riscv/rules.mk +++ b/target/sifive-e/rules.mk @@ -3,7 +3,7 @@ LOCAL_DIR := $(GET_LOCAL_DIR) GLOBAL_INCLUDES += $(LOCAL_DIR)/include PLATFORM := sifive -SUBARCH ?= 32 +VARIANT := sifive_e MEMSIZE ?= 0x4000 # 16KB